[PATCH] Added btrfs support for vfs_min_size.
by Maxim Perevedentsev
---
daemon/btrfs.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++
daemon/daemon.h | 1 +
daemon/fs-min-size.c | 50 ++++++++++++++++++++++++++++++++++++-
generator/actions.ml | 6 ++++-
4 files changed, 124 insertions(+), 2 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index ddb029d..d2d85f3 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -2190,3 +2190,72 @@ do_btrfs_replace (const char *srcdev, const char *targetdev,
return 0;
}
+
+/* btrfs command add a new command
+ * inspect-internal min-dev-size <path>
+ * since v4.2
+ * We could check whether 'btrfs' supports
+ * 'min-dev-size' command by checking the output of
+ * 'btrfs --help' command.
+ */
+static int
+test_btrfs_min_dev_size (void)
+{
+ CLEANUP_FREE char *err = NULL, *out = NULL;
+ static int result = -1;
+ if (result != -1)
+ return result;
+
+ const char *cmd_pattern = "btrfs inspect-internal min-dev-size";
+
+ int r = commandr (&out, &err, str_btrfs, "--help", NULL);
+
+ if (r == -1) {
+ reply_with_error ("btrfs: %s", err);
+ return -1;
+ }
+
+ if (strstr (out, cmd_pattern) == NULL)
+ result = 0;
+ else
+ result = 1;
+
+ return result;
+}
+
+int64_t
+btrfs_minimum_size (const char *path)
+{
+ CLEANUP_FREE char *err = NULL, *out = NULL;
+ int64_t ret = 0;
+ int min_size_supported = test_btrfs_min_dev_size ();
+ if (min_size_supported == -1)
+ return -1;
+ else if (min_size_supported == 0)
+ NOT_SUPPORTED (-1, "'btrfs inspect-internal min-dev-size' \
+ needs btrfs-progs >= 4.2");
+
+ int r = command (&out, &err, str_btrfs, "inspect-internal",
+ "min-dev-size", path, NULL);
+
+ if (r == -1) {
+ reply_with_error ("%s", err);
+ return -1;
+ }
+
+#if __WORDSIZE == 64
+#define XSTRTOD64 xstrtol
+#else
+#define XSTRTOD64 xstrtoll
+#endif
+
+ if (XSTRTOD64 (out, NULL, 10, &ret, NULL) != LONGINT_OK) {
+ reply_with_error ("cannot parse minimum size");
+ return -1;
+ }
+
+#undef XSTRTOD64
+
+ return ret;
+}
+
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 8bcc9bd..4a969dd 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -280,6 +280,7 @@ extern char *btrfs_get_label (const char *device);
extern int btrfs_set_label (const char *device, const char *label);
extern int btrfs_set_uuid (const char *device, const char *uuid);
extern int btrfs_set_uuid_random (const char *device);
+extern int64_t btrfs_minimum_size (const char *path);
/*-- in ntfs.c --*/
extern char *ntfs_get_label (const char *device);
diff --git a/daemon/fs-min-size.c b/daemon/fs-min-size.c
index 4f93f8c..cb67b6f 100644
--- a/daemon/fs-min-size.c
+++ b/daemon/fs-min-size.c
@@ -21,16 +21,57 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <mntent.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include "daemon.h"
#include "actions.h"
+static char*
+get_mount_point (const char *device)
+{
+ FILE *fp;
+ struct mntent *m;
+ struct stat stat1, stat2;
+ char *path;
+
+ if (stat (device, &stat1) == -1) {
+ reply_with_perror ("stat: %s", device);
+ return NULL;
+ }
+
+ /* NB: Eventually we should aim to parse /proc/self/mountinfo, but
+ * that requires custom parsing code.
+ */
+ fp = setmntent ("/proc/mounts", "r");
+ if (fp == NULL) {
+ fprintf (stderr, "setmntent: %s: %m\n", "/proc/mounts");
+ exit (EXIT_FAILURE);
+ }
+
+ while ((m = getmntent (fp)) != NULL) {
+ if (stat (m->mnt_fsname, &stat2) == 0) {
+ if (stat1.st_rdev == stat2.st_rdev) {
+ /* found it */
+ path = strdup (m->mnt_dir);
+ endmntent (fp);
+ return path;
+ }
+ }
+ }
+
+ endmntent (fp);
+ reply_with_error ("device not mounted: %s", device);
+ return NULL;
+}
+
int64_t
do_vfs_minimum_size (const mountable_t *mountable)
{
int64_t r;
- /* How we set the label depends on the filesystem type. */
+ /* How we get minimum size depends on the filesystem type. */
CLEANUP_FREE char *vfs_type = do_vfs_type (mountable);
if (vfs_type == NULL)
return -1;
@@ -41,6 +82,13 @@ do_vfs_minimum_size (const mountable_t *mountable)
else if (STREQ (vfs_type, "ntfs"))
r = ntfs_minimum_size (mountable->device);
+ else if (STREQ (vfs_type, "btrfs")) {
+ CLEANUP_FREE char *path = get_mount_point (mountable->device);
+ if (path == NULL)
+ return -1;
+ r = btrfs_minimum_size (path);
+ }
+
else
NOT_SUPPORTED (-1, "don't know how to get minimum size of '%s' filesystems",
vfs_type);
diff --git a/generator/actions.ml b/generator/actions.ml
index 62176ab..8832410 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12761,6 +12761,10 @@ To read the UUID on a filesystem, call C<guestfs_vfs_uuid>." };
InitPartition, IfAvailable "ntfsprogs", TestRun(
[["mkfs"; "ntfs"; "/dev/sda1"; ""; "NOARG"; ""; ""; "NOARG"];
["vfs_minimum_size"; "/dev/sda1"]]), [];
+ InitPartition, Always, TestRun (
+ [["mkfs"; "btrfs"; "/dev/sda1"; ""; "NOARG"; ""; ""; "NOARG"];
+ ["mount"; "/dev/sda1"; "/"];
+ ["vfs_minimum_size"; "/dev/sda1"]]), [];
];
shortdesc = "get minimum filesystem size";
longdesc = "\
@@ -12770,7 +12774,7 @@ This is the minimum possible size for filesystem shrinking.
If getting minimum size of specified filesystem is not supported,
this will fail and set errno as ENOTSUP.
-See also L<ntfsresize(8)>, L<resize2fs(8)>." };
+See also L<ntfsresize(8)>, L<resize2fs(8)>, L<btrfs(8)>." };
]
--
1.8.3.1
9 years, 2 months
[PATCH] perl: Switch to using Module::Build.
by Richard W.M. Jones
Switch from 'ExtUtils::MakeMaker' to 'Module::Build'.
There's not really a huge difference here. The interfacing gymnastics
that we have to do to make Makefile.am and Module::Build talk to each
other is probably a little bit simpler.
I compared the output of 'make install' before and after, and there's
not much difference. 'perllocal.pod' is not installed (see recent bug
report), and 'bindtests.pl' is also not installed. However the empty
file 'Guestfs.bs' is now copied in, but in Fedora we were already
removing any '*.bs' files.
This is good reading (make sure to read the comments too):
http://blogs.perl.org/users/rurban/2011/01/why-modulebuild-sucks.html
Rich.
9 years, 2 months
Re: [Libguestfs] [libguestfs] Cannot install libguestfs 1.31.19 (#14)
by Richard W.M. Jones
On Fri, Oct 23, 2015 at 02:34:53AM -0700, Jean-Christophe Manciot wrote:
> Compiled from github sources and installed:
>
> "trying to overwrite
> '/usr/lib/x86_64-linux-gnu/perl/5.20.2/perllocal.pod', which is also
> in package git 1:2.6.0-1"
>
> What should be done to overcome that incompatibility with git?
First off, don't use 'make install' except when building a distro
package, as you'll end up with multiple versions of libguestfs
installed and that causes pain.
In Fedora, we do 'make install DESTDIR=...' in a buildroot, and then
remove the 'perllocal.pod' file before building the final distro
package. See:
http://pkgs.fedoraproject.org/cgit/libguestfs.git/tree/libguestfs.spec?id...
So if you're building a distro package, then you probably want to do
something similar to this and the problem doesn't arise.
When we install the Perl files, all we do is run Perl's
ExtUtils::MakeMaker. See:
https://github.com/libguestfs/libguestfs/blob/master/perl/Makefile.am
https://github.com/libguestfs/libguestfs/blob/master/perl/Makefile.PL.in
So if there is a proper solution to this, it must lie with ExtUtils.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
9 years, 2 months
[PATCH] Bugfix in number parsing in vfs_min_size.
by Maxim Perevedentsev
---
The number changed means base (radix) of numbers parsed.
daemon/ext2.c | 2 +-
daemon/ntfs.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/daemon/ext2.c b/daemon/ext2.c
index 342d217..6543574 100644
--- a/daemon/ext2.c
+++ b/daemon/ext2.c
@@ -336,7 +336,7 @@ ext_minimum_size (const char *device)
for (i = 0; lines[i] != NULL; ++i) {
if (STRPREFIX (lines[i], pattern)) {
if (XSTRTOD64 (lines[i] + strlen (pattern),
- NULL, 20, &ret, NULL) != LONGINT_OK) {
+ NULL, 10, &ret, NULL) != LONGINT_OK) {
reply_with_error ("cannot parse minimum size");
return -1;
}
diff --git a/daemon/ntfs.c b/daemon/ntfs.c
index ea0844f..8e1aa5a 100644
--- a/daemon/ntfs.c
+++ b/daemon/ntfs.c
@@ -201,7 +201,7 @@ ntfs_minimum_size (const char *device)
}
else if (STRPREFIX (lines[i], volume_size_pattern)) {
if (XSTRTOD64 (lines[i] + strlen (volume_size_pattern),
- NULL, 20, &volume_size, NULL) != LONGINT_OK) {
+ NULL, 10, &volume_size, NULL) != LONGINT_OK) {
reply_with_error ("cannot parse volume size");
return -1;
}
@@ -226,7 +226,7 @@ ntfs_minimum_size (const char *device)
if (STRPREFIX (lines[i], size_pattern)) {
int64_t ret;
if (XSTRTOD64 (lines[i] + strlen (size_pattern),
- NULL, 20, &ret, NULL) != LONGINT_OK) {
+ NULL, 10, &ret, NULL) != LONGINT_OK) {
reply_with_error ("cannot parse minimum size");
return -1;
}
--
1.8.3.1
9 years, 2 months
"could not parse ovf:Name" converting OVA
by Don Marti
I got the "IE10 on Win 8" VM download from here:
https://dev.modern.ie/tools/vms/linux/
and am trying to convert the .ova file to a format that
will work with virt-manager and KVM on Fedora 21.
I tried this:
$ virt-v2v -v -x -i ova -o libvirt IE10\ -\ Win8.ova
and got this output:
virt-v2v: libguestfs 1.28.12 (x86_64)
[ 0.0] Opening the source -i ova IE10 - Win8.ova
tar -xf 'IE10 - Win8.ova' -C '/var/tmp/ova.Jecd3x'
virt-v2v: error: could not parse ovf:Name from OVF document
If reporting bugs, run virt-v2v with debugging enabled and include the
complete output:
virt-v2v -v -x [...]
Anything else I need to be doing in order to
convert this OVA?
--
Don Marti <dmarti(a)zgp.org>
http://zgp.org/~dmarti/
Are you safe from 3rd-party web tracking? http://www.aloodo.org/test/
9 years, 2 months
[PATCH] v2v: -o libvirt: dump XML for libvirt if verbose
by Pino Toscano
When running in verbose mode, dump the XML we created for libvirt:
this way it is easier to debug mismatches between what we want to setup
in libvirt, and what actually gets defined.
---
v2v/output_libvirt.ml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index abdd410..f86f336 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -407,6 +407,12 @@ class output_libvirt oc output_pool = object
DOM.doc_to_chan chan doc;
close_out chan;
+ if verbose () then (
+ printf "resulting XML for libvirt:\n%!";
+ DOM.doc_to_chan stdout doc;
+ printf "\n%!";
+ );
+
(* Define the domain in libvirt. *)
let cmd =
match oc with
--
2.1.0
9 years, 2 months
[PATCH] v2v: -o libvirt: fix <video> element (RHBZ#1225789)
by Pino Toscano
Create the correct tags for <video> in the libvirtxml, so all the
attributes are in a <model> child of <video> instead of <video> itself.
Adapt the XML of test-v2v-i-ova to the different expected XML.
---
v2v/output_libvirt.ml | 9 +++++----
v2v/test-v2v-i-ova.xml | 4 +++-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index 0255e15..abdd410 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -223,16 +223,17 @@ let create_libvirt_xml ?pool source target_buses guestcaps
* missing from the old metadata.
*)
let video, graphics =
- let video, graphics =
+ let video_model, graphics =
match guestcaps.gcaps_video with
| QXL ->
- e "video" [ "type", "qxl"; "ram", "65536" ] [],
+ e "model" [ "type", "qxl"; "ram", "65536" ] [],
e "graphics" [ "type", "vnc" ] []
| Cirrus ->
- e "video" [ "type", "cirrus"; "vram", "9216" ] [],
+ e "model" [ "type", "cirrus"; "vram", "9216" ] [],
e "graphics" [ "type", "spice" ] [] in
- append_attr ("heads", "1") video;
+ append_attr ("heads", "1") video_model;
+ let video = e "video" [] [ video_model ] in
(match source.s_display with
| Some { s_keymap = Some km } -> append_attr ("keymap", km) graphics
diff --git a/v2v/test-v2v-i-ova.xml b/v2v/test-v2v-i-ova.xml
index 2eeff83..bb765e3 100644
--- a/v2v/test-v2v-i-ova.xml
+++ b/v2v/test-v2v-i-ova.xml
@@ -33,7 +33,9 @@
<source network='Ethernet 1'/>
<model type='virtio'/>
</interface>
- <video type='qxl' ram='65536' heads='1'/>
+ <video>
+ <model type='qxl' ram='65536' heads='1'/>
+ </video>
<graphics type='vnc' autoport='yes' port='-1'/>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
--
2.1.0
9 years, 2 months
Outline Rust bindings
by Richard W.M. Jones
Outline Rust bindings, obviously incomplete.
Attached is an example program showing how these bindings might be
used. The most obvious thing is all the explicit error checking that
the caller must do (same as in C). I'm not sure how natural that is,
but the alternatives seem to be lots of calls to either 'assert!' or
'panic!' functions.
To try it out:
(1) Apply the patch.
(2) Copy attached main.rc into rust/src/
(3) Build libguestfs.
(4) Do:
cd rust
cargo build
cargo run
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
9 years, 2 months
[PATCH 1/2] build: isolate common po-docs logic
by Pino Toscano
Move most of the content of either po-docs/ja/Makefile.am or
po-docs/uk/Makefile.am to po-docs/language.mk, and use it exclusively
instead of the former contents of the languange-specific Makefile.am.
This way, either adding a new documentation or enabling a new language
will not require copying over the same make code.
---
po-docs/ja/Makefile.am | 174 +-------------------------------------------
po-docs/language.mk | 191 +++++++++++++++++++++++++++++++++++++++++++++++++
po-docs/uk/Makefile.am | 174 +-------------------------------------------
3 files changed, 195 insertions(+), 344 deletions(-)
create mode 100644 po-docs/language.mk
diff --git a/po-docs/ja/Makefile.am b/po-docs/ja/Makefile.am
index 0f45b11..a6ebec2 100644
--- a/po-docs/ja/Makefile.am
+++ b/po-docs/ja/Makefile.am
@@ -18,176 +18,6 @@
# Note that each Makefile.am in po-docs/$lang/Makefile.am should be
# identical. If you create a new $lang.po, create the $lang/
# subdirectory and copy the Makefile.am from an existing language.
+# All the actual logic should be in language.mk.
-include $(top_srcdir)/subdir-rules.mk
-
-LINGUA = $(shell basename -- `pwd`)
-
-CLEANFILES = *.1 *.3 *.5
-
-# Before 1.23.23, the old Perl tools were called *.pl.
-CLEANFILES += *.pl
-
-MANPAGES = \
- guestfish.1 \
- guestfs.3 \
- guestfs-erlang.3 \
- guestfs-examples.3 \
- guestfs-faq.1 \
- guestfs-golang.3 \
- guestfs-java.3 \
- guestfs-lua.3 \
- guestfs-ocaml.3 \
- guestfs-performance.1 \
- guestfs-perl.3 \
- guestfs-python.3 \
- guestfs-recipes.1 \
- guestfs-release-notes.1 \
- guestfs-ruby.3 \
- guestfs-testing.1 \
- guestfsd.8 \
- guestmount.1 \
- guestunmount.1 \
- libguestfs-make-fixed-appliance.1 \
- libguestfs-test-tool.1 \
- libguestfs-tools.conf.5 \
- virt-alignment-scan.1 \
- virt-builder.1 \
- virt-cat.1 \
- virt-copy-in.1 \
- virt-copy-out.1 \
- virt-customize.1 \
- virt-df.1 \
- virt-diff.1 \
- virt-edit.1 \
- virt-filesystems.1 \
- virt-format.1 \
- virt-index-validate.1 \
- virt-inspector.1 \
- virt-list-filesystems.1 \
- virt-list-partitions.1 \
- virt-log.1 \
- virt-ls.1 \
- virt-make-fs.1 \
- virt-p2v.1 \
- virt-p2v-make-disk.1 \
- virt-p2v-make-kickstart.1 \
- virt-rescue.1 \
- virt-resize.1 \
- virt-sparsify.1 \
- virt-sysprep.1 \
- virt-tar.1 \
- virt-tar-in.1 \
- virt-tar-out.1 \
- virt-v2v.1 \
- virt-v2v-test-harness.1 \
- virt-win-reg.1
-
-podfiles := $(shell for f in `cat $(top_srcdir)/po-docs/podfiles`; do echo `basename $$f .pod`.pod; done)
-
-# Ship the POD files and the translated manpages in the tarball. This
-# just simplifies building from the tarball, at a small cost in extra
-# size.
-EXTRA_DIST = \
- $(MANPAGES) \
- $(podfiles)
-
-all-local: $(MANPAGES)
-
-guestfs.3: guestfs.pod guestfs-actions.pod guestfs-availability.pod guestfs-structs.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --section 3 \
- --license LGPLv2+ \
- --insert $(srcdir)/guestfs-actions.pod:__ACTIONS__ \
- --insert $(srcdir)/guestfs-availability.pod:__AVAILABILITY__ \
- --insert $(srcdir)/guestfs-structs.pod:__STRUCTS__ \
- $<
-
-guestfish.1: guestfish.pod guestfish-actions.pod guestfish-commands.pod guestfish-prepopts.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --license GPLv2+ \
- --insert $(srcdir)/guestfish-actions.pod:__ACTIONS__ \
- --insert $(srcdir)/guestfish-commands.pod:__FISH_COMMANDS__ \
- --insert $(srcdir)/guestfish-prepopts.pod:__PREPOPTS__ \
- $<
-
-virt-builder.1: virt-builder.pod customize-synopsis.pod customize-options.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --license GPLv2+ \
- --insert $(srcdir)/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
- --insert $(srcdir)/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
- $<
-
-virt-customize.1: virt-customize.pod customize-synopsis.pod customize-options.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --license GPLv2+ \
- --insert $(srcdir)/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
- --insert $(srcdir)/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
- $<
-
-virt-sysprep.1: virt-sysprep.pod sysprep-extra-options.pod sysprep-operations.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --license GPLv2+ \
- --insert $(srcdir)/sysprep-extra-options.pod:__EXTRA_OPTIONS__ \
- --insert $(srcdir)/sysprep-operations.pod:__OPERATIONS__ \
- $<
-
-%.1: %.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- $<
-
-%.3: %.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --section 3 \
- $<
-
-%.5: %.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --section 5 \
- $<
-
-%.8: %.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --section 8 \
- $<
-
-# If a POD file is missing, the user needs to run make update-po.
-# This cannot be done automatically by make because it would be unsafe
-# to run po4a or update podfiles potentially in parallel. Therefore
-# tell the user what to do and stop.
-$(podfiles):
- @if ! test -f $@; then \
- echo "***"; \
- echo "*** You need to run the following commands:"; \
- echo "*** rm po-docs/podfiles; make -C po-docs update-po"; \
- echo "*** After that, rerun make."; \
- echo "***"; \
- exit 1; \
- fi
-
-# XXX Can automake do this properly?
-install-data-hook:
- $(MKDIR_P) $(DESTDIR)$(mandir)/$(LINGUA)/man1
- $(INSTALL) -m 0644 $(srcdir)/*.1 $(DESTDIR)$(mandir)/$(LINGUA)/man1
- $(MKDIR_P) $(DESTDIR)$(mandir)/$(LINGUA)/man3
- $(INSTALL) -m 0644 $(srcdir)/*.3 $(DESTDIR)$(mandir)/$(LINGUA)/man3
- $(MKDIR_P) $(DESTDIR)$(mandir)/$(LINGUA)/man5
- $(INSTALL) -m 0644 $(srcdir)/*.5 $(DESTDIR)$(mandir)/$(LINGUA)/man5
+include $(srcdir)/../language.mk
diff --git a/po-docs/language.mk b/po-docs/language.mk
new file mode 100644
index 0000000..d5c9ba2
--- /dev/null
+++ b/po-docs/language.mk
@@ -0,0 +1,191 @@
+# libguestfs translations of man pages and POD files
+# Copyright (C) 2010-2012 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Common logic for generating translated documentation.
+
+include $(top_srcdir)/subdir-rules.mk
+
+LINGUA = $(shell basename -- `pwd`)
+
+CLEANFILES = *.1 *.3 *.5
+
+# Before 1.23.23, the old Perl tools were called *.pl.
+CLEANFILES += *.pl
+
+MANPAGES = \
+ guestfish.1 \
+ guestfs.3 \
+ guestfs-erlang.3 \
+ guestfs-examples.3 \
+ guestfs-faq.1 \
+ guestfs-golang.3 \
+ guestfs-java.3 \
+ guestfs-lua.3 \
+ guestfs-ocaml.3 \
+ guestfs-performance.1 \
+ guestfs-perl.3 \
+ guestfs-python.3 \
+ guestfs-recipes.1 \
+ guestfs-release-notes.1 \
+ guestfs-ruby.3 \
+ guestfs-testing.1 \
+ guestfsd.8 \
+ guestmount.1 \
+ guestunmount.1 \
+ libguestfs-make-fixed-appliance.1 \
+ libguestfs-test-tool.1 \
+ libguestfs-tools.conf.5 \
+ virt-alignment-scan.1 \
+ virt-builder.1 \
+ virt-cat.1 \
+ virt-copy-in.1 \
+ virt-copy-out.1 \
+ virt-customize.1 \
+ virt-df.1 \
+ virt-diff.1 \
+ virt-edit.1 \
+ virt-filesystems.1 \
+ virt-format.1 \
+ virt-index-validate.1 \
+ virt-inspector.1 \
+ virt-list-filesystems.1 \
+ virt-list-partitions.1 \
+ virt-log.1 \
+ virt-ls.1 \
+ virt-make-fs.1 \
+ virt-p2v.1 \
+ virt-p2v-make-disk.1 \
+ virt-p2v-make-kickstart.1 \
+ virt-rescue.1 \
+ virt-resize.1 \
+ virt-sparsify.1 \
+ virt-sysprep.1 \
+ virt-tar.1 \
+ virt-tar-in.1 \
+ virt-tar-out.1 \
+ virt-v2v.1 \
+ virt-v2v-test-harness.1 \
+ virt-win-reg.1
+
+podfiles := $(shell for f in `cat $(top_srcdir)/po-docs/podfiles`; do echo `basename $$f .pod`.pod; done)
+
+# Ship the POD files and the translated manpages in the tarball. This
+# just simplifies building from the tarball, at a small cost in extra
+# size.
+EXTRA_DIST = \
+ $(MANPAGES) \
+ $(podfiles)
+
+all-local: $(MANPAGES)
+
+guestfs.3: guestfs.pod guestfs-actions.pod guestfs-availability.pod guestfs-structs.pod
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ --section 3 \
+ --license LGPLv2+ \
+ --insert $(srcdir)/guestfs-actions.pod:__ACTIONS__ \
+ --insert $(srcdir)/guestfs-availability.pod:__AVAILABILITY__ \
+ --insert $(srcdir)/guestfs-structs.pod:__STRUCTS__ \
+ $<
+
+guestfish.1: guestfish.pod guestfish-actions.pod guestfish-commands.pod guestfish-prepopts.pod
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ --license GPLv2+ \
+ --insert $(srcdir)/guestfish-actions.pod:__ACTIONS__ \
+ --insert $(srcdir)/guestfish-commands.pod:__FISH_COMMANDS__ \
+ --insert $(srcdir)/guestfish-prepopts.pod:__PREPOPTS__ \
+ $<
+
+virt-builder.1: virt-builder.pod customize-synopsis.pod customize-options.pod
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ --license GPLv2+ \
+ --insert $(srcdir)/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
+ --insert $(srcdir)/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
+ $<
+
+virt-customize.1: virt-customize.pod customize-synopsis.pod customize-options.pod
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ --license GPLv2+ \
+ --insert $(srcdir)/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
+ --insert $(srcdir)/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
+ $<
+
+virt-sysprep.1: virt-sysprep.pod sysprep-extra-options.pod sysprep-operations.pod
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ --license GPLv2+ \
+ --insert $(srcdir)/sysprep-extra-options.pod:__EXTRA_OPTIONS__ \
+ --insert $(srcdir)/sysprep-operations.pod:__OPERATIONS__ \
+ $<
+
+%.1: %.pod
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ $<
+
+%.3: %.pod
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ --section 3 \
+ $<
+
+%.5: %.pod
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ --section 5 \
+ $<
+
+%.8: %.pod
+ $(PODWRAPPER) \
+ --no-strict-checks \
+ --man $@ \
+ --section 8 \
+ $<
+
+# If a POD file is missing, the user needs to run make update-po.
+# This cannot be done automatically by make because it would be unsafe
+# to run po4a or update podfiles potentially in parallel. Therefore
+# tell the user what to do and stop.
+$(podfiles):
+ @if ! test -f $@; then \
+ echo "***"; \
+ echo "*** You need to run the following commands:"; \
+ echo "*** rm po-docs/podfiles; make -C po-docs update-po"; \
+ echo "*** After that, rerun make."; \
+ echo "***"; \
+ exit 1; \
+ fi
+
+# XXX Can automake do this properly?
+install-data-hook:
+ $(MKDIR_P) $(DESTDIR)$(mandir)/$(LINGUA)/man1
+ $(INSTALL) -m 0644 $(srcdir)/*.1 $(DESTDIR)$(mandir)/$(LINGUA)/man1
+ $(MKDIR_P) $(DESTDIR)$(mandir)/$(LINGUA)/man3
+ $(INSTALL) -m 0644 $(srcdir)/*.3 $(DESTDIR)$(mandir)/$(LINGUA)/man3
+ $(MKDIR_P) $(DESTDIR)$(mandir)/$(LINGUA)/man5
+ $(INSTALL) -m 0644 $(srcdir)/*.5 $(DESTDIR)$(mandir)/$(LINGUA)/man5
diff --git a/po-docs/uk/Makefile.am b/po-docs/uk/Makefile.am
index 0f45b11..a6ebec2 100644
--- a/po-docs/uk/Makefile.am
+++ b/po-docs/uk/Makefile.am
@@ -18,176 +18,6 @@
# Note that each Makefile.am in po-docs/$lang/Makefile.am should be
# identical. If you create a new $lang.po, create the $lang/
# subdirectory and copy the Makefile.am from an existing language.
+# All the actual logic should be in language.mk.
-include $(top_srcdir)/subdir-rules.mk
-
-LINGUA = $(shell basename -- `pwd`)
-
-CLEANFILES = *.1 *.3 *.5
-
-# Before 1.23.23, the old Perl tools were called *.pl.
-CLEANFILES += *.pl
-
-MANPAGES = \
- guestfish.1 \
- guestfs.3 \
- guestfs-erlang.3 \
- guestfs-examples.3 \
- guestfs-faq.1 \
- guestfs-golang.3 \
- guestfs-java.3 \
- guestfs-lua.3 \
- guestfs-ocaml.3 \
- guestfs-performance.1 \
- guestfs-perl.3 \
- guestfs-python.3 \
- guestfs-recipes.1 \
- guestfs-release-notes.1 \
- guestfs-ruby.3 \
- guestfs-testing.1 \
- guestfsd.8 \
- guestmount.1 \
- guestunmount.1 \
- libguestfs-make-fixed-appliance.1 \
- libguestfs-test-tool.1 \
- libguestfs-tools.conf.5 \
- virt-alignment-scan.1 \
- virt-builder.1 \
- virt-cat.1 \
- virt-copy-in.1 \
- virt-copy-out.1 \
- virt-customize.1 \
- virt-df.1 \
- virt-diff.1 \
- virt-edit.1 \
- virt-filesystems.1 \
- virt-format.1 \
- virt-index-validate.1 \
- virt-inspector.1 \
- virt-list-filesystems.1 \
- virt-list-partitions.1 \
- virt-log.1 \
- virt-ls.1 \
- virt-make-fs.1 \
- virt-p2v.1 \
- virt-p2v-make-disk.1 \
- virt-p2v-make-kickstart.1 \
- virt-rescue.1 \
- virt-resize.1 \
- virt-sparsify.1 \
- virt-sysprep.1 \
- virt-tar.1 \
- virt-tar-in.1 \
- virt-tar-out.1 \
- virt-v2v.1 \
- virt-v2v-test-harness.1 \
- virt-win-reg.1
-
-podfiles := $(shell for f in `cat $(top_srcdir)/po-docs/podfiles`; do echo `basename $$f .pod`.pod; done)
-
-# Ship the POD files and the translated manpages in the tarball. This
-# just simplifies building from the tarball, at a small cost in extra
-# size.
-EXTRA_DIST = \
- $(MANPAGES) \
- $(podfiles)
-
-all-local: $(MANPAGES)
-
-guestfs.3: guestfs.pod guestfs-actions.pod guestfs-availability.pod guestfs-structs.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --section 3 \
- --license LGPLv2+ \
- --insert $(srcdir)/guestfs-actions.pod:__ACTIONS__ \
- --insert $(srcdir)/guestfs-availability.pod:__AVAILABILITY__ \
- --insert $(srcdir)/guestfs-structs.pod:__STRUCTS__ \
- $<
-
-guestfish.1: guestfish.pod guestfish-actions.pod guestfish-commands.pod guestfish-prepopts.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --license GPLv2+ \
- --insert $(srcdir)/guestfish-actions.pod:__ACTIONS__ \
- --insert $(srcdir)/guestfish-commands.pod:__FISH_COMMANDS__ \
- --insert $(srcdir)/guestfish-prepopts.pod:__PREPOPTS__ \
- $<
-
-virt-builder.1: virt-builder.pod customize-synopsis.pod customize-options.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --license GPLv2+ \
- --insert $(srcdir)/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
- --insert $(srcdir)/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
- $<
-
-virt-customize.1: virt-customize.pod customize-synopsis.pod customize-options.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --license GPLv2+ \
- --insert $(srcdir)/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
- --insert $(srcdir)/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
- $<
-
-virt-sysprep.1: virt-sysprep.pod sysprep-extra-options.pod sysprep-operations.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --license GPLv2+ \
- --insert $(srcdir)/sysprep-extra-options.pod:__EXTRA_OPTIONS__ \
- --insert $(srcdir)/sysprep-operations.pod:__OPERATIONS__ \
- $<
-
-%.1: %.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- $<
-
-%.3: %.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --section 3 \
- $<
-
-%.5: %.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --section 5 \
- $<
-
-%.8: %.pod
- $(PODWRAPPER) \
- --no-strict-checks \
- --man $@ \
- --section 8 \
- $<
-
-# If a POD file is missing, the user needs to run make update-po.
-# This cannot be done automatically by make because it would be unsafe
-# to run po4a or update podfiles potentially in parallel. Therefore
-# tell the user what to do and stop.
-$(podfiles):
- @if ! test -f $@; then \
- echo "***"; \
- echo "*** You need to run the following commands:"; \
- echo "*** rm po-docs/podfiles; make -C po-docs update-po"; \
- echo "*** After that, rerun make."; \
- echo "***"; \
- exit 1; \
- fi
-
-# XXX Can automake do this properly?
-install-data-hook:
- $(MKDIR_P) $(DESTDIR)$(mandir)/$(LINGUA)/man1
- $(INSTALL) -m 0644 $(srcdir)/*.1 $(DESTDIR)$(mandir)/$(LINGUA)/man1
- $(MKDIR_P) $(DESTDIR)$(mandir)/$(LINGUA)/man3
- $(INSTALL) -m 0644 $(srcdir)/*.3 $(DESTDIR)$(mandir)/$(LINGUA)/man3
- $(MKDIR_P) $(DESTDIR)$(mandir)/$(LINGUA)/man5
- $(INSTALL) -m 0644 $(srcdir)/*.5 $(DESTDIR)$(mandir)/$(LINGUA)/man5
+include $(srcdir)/../language.mk
--
2.1.0
9 years, 2 months