[PATCH] v2v: Citrix Xen has been tested, adapt the documentation
by Tomáš Golembiovský
Conversion from Citrix Xen has now been tested and should work. Remove
the comment about it from the documentation.
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
v2v/virt-v2v.pod | 2 --
1 file changed, 2 deletions(-)
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index d06094c..93d73bd 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -171,8 +171,6 @@ OVAs from other hypervisors will not work.
=item Citrix Xen
-Citrix Xen has not been recently tested.
-
=item Hyper-V
Not recently tested. Requires that you export the disk or use
--
2.9.2
8 years, 4 months
[PATCH v4 0/6] New API: find_inode
by Matteo Cafasso
v4:
- refactor entry_is_dot
My apologies for the duplicated submission but I did not read the next e-mail.
The tsk_fs_dir_walk API will list all the entries including '.' and '..'
in a similar manner as for 'ls -a'.
This means our callback will be called for the following entries:
. <-- the Root entry
etc/.
etc/.. <-- again the Root entry
etc/systemd/.
etc/systemd/..
bin/.
bin/.. <-- again the Root entry
We want to return the Root entry only once.
Therefore, once we know that the entry under analysis is a dot
if (TSK_FS_ISDOT (fsfile->name->name))
We check whether the inode is root
if (fsfile->fs_info->root_inum == fsfile->name->meta_addr)
But we want to make sure is the first root entry and not the parent directory
of other directories.
if (STREQ(fsfile->name->name, ".")
I opened up a bit the logic to make it more clear.
Matteo Cafasso (6):
filesystem_walk: fixed root inode listing
daemon: refactor tsk code
lib: rename tsk internal function
New API: internal_find_inode
New API: find_inode
find_inode: added API tests
daemon/tsk.c | 161 ++++++++++++++++++++++++++++++-------------
generator/actions.ml | 21 ++++++
src/MAX_PROC_NR | 2 +-
src/tsk.c | 32 ++++++++-
tests/tsk/Makefile.am | 3 +-
tests/tsk/test-find-inode.sh | 66 ++++++++++++++++++
6 files changed, 233 insertions(+), 52 deletions(-)
create mode 100755 tests/tsk/test-find-inode.sh
--
2.9.3
8 years, 4 months
[PATCH] v2v: Use unitless methods for methods which don't change the internal state.
by Richard W.M. Jones
Methods in OCaml which don't take any parameters don't require the
dummy unit arg, ie writing:
method foo = ...
is fine. The reason you might need the unit arg is if you need to
create a closure from the method without calling it, for example if
you need to use the method in a callback.
In lablgtk2 the convention is to use unitless methods if either: the
method shouldn't be used as a callback; or: (conceptually) the method
doesn't change the object's internal state. Let's do that here.
---
v2v/convert_linux.ml | 2 +-
v2v/linux_bootloaders.ml | 14 ++++++--------
v2v/linux_bootloaders.mli | 2 +-
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 7829612..e1a769b 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -240,7 +240,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
* list is the default booting kernel.
*)
let grub_kernels : kernel_info list =
- let vmlinuzes = bootloader#list_kernels () in
+ let vmlinuzes = bootloader#list_kernels in
(* Map these to installed kernels. *)
filter_map (
diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml
index d12edf8..f41947e 100644
--- a/v2v/linux_bootloaders.ml
+++ b/v2v/linux_bootloaders.ml
@@ -29,7 +29,7 @@ module G = Guestfs
class virtual bootloader = object
method virtual name : string
method virtual augeas_device_patterns : string list
- method virtual list_kernels : unit -> string list
+ method virtual list_kernels : string list
method virtual set_default_kernel : string -> unit
method set_augeas_configuration () = false
method virtual configure_console : unit -> unit
@@ -69,7 +69,7 @@ object
"/files/etc/sysconfig/grub/boot";
]
- method list_kernels () =
+ method list_kernels =
let paths =
let expr = sprintf "/files%s/title/kernel" grub_config in
let paths = g#aug_match expr in
@@ -189,7 +189,7 @@ class bootloader_grub2 (g : G.guestfs) grub_config =
object (self)
inherit bootloader
- method private grub2_update_console ~remove =
+ method private grub2_update_console ~remove () =
let rex = Str.regexp "\\(.*\\)\\bconsole=[xh]vc0\\b\\(.*\\)" in
let paths = [
@@ -235,7 +235,7 @@ object (self)
"/files/boot/grub2/device.map/*[label() != \"#comment\"]";
]
- method list_kernels () =
+ method list_kernels =
let get_default_image () =
let cmd =
if g#exists "/sbin/grubby" then
@@ -285,11 +285,9 @@ object (self)
" vmlinuz |] in
ignore (g#command cmd)
- method configure_console () =
- self#grub2_update_console ~remove:false
+ method configure_console = self#grub2_update_console ~remove:false
- method remove_console () =
- self#grub2_update_console ~remove:true
+ method remove_console = self#grub2_update_console ~remove:true
method update () =
ignore (g#command [| "grub2-mkconfig"; "-o"; grub_config |])
diff --git a/v2v/linux_bootloaders.mli b/v2v/linux_bootloaders.mli
index cf115e3..3500415 100644
--- a/v2v/linux_bootloaders.mli
+++ b/v2v/linux_bootloaders.mli
@@ -21,7 +21,7 @@ class virtual bootloader : object
(** The name of the bootloader. *)
method virtual augeas_device_patterns : string list
(** A list of Augeas patterns to search for device names. *)
- method virtual list_kernels : unit -> string list
+ method virtual list_kernels : string list
(** Lists all the kernels configured in the bootloader. *)
method virtual set_default_kernel : string -> unit
(** Sets the specified vmlinuz path as default bootloader entry. *)
--
2.7.4
8 years, 4 months
[PATCH v3 0/6] New API: find_inode
by Matteo Cafasso
v3:
- coding style fixes
- comment entry_is_dot logic
Matteo Cafasso (6):
filesystem_walk: fixed root inode listing
daemon: refactor tsk code
lib: rename tsk internal function
New API: internal_find_inode
New API: find_inode
find_inode: added API tests
daemon/tsk.c | 157 ++++++++++++++++++++++++++++++-------------
generator/actions.ml | 21 ++++++
src/MAX_PROC_NR | 2 +-
src/tsk.c | 32 ++++++++-
tests/tsk/Makefile.am | 3 +-
tests/tsk/test-find-inode.sh | 66 ++++++++++++++++++
6 files changed, 230 insertions(+), 51 deletions(-)
create mode 100755 tests/tsk/test-find-inode.sh
--
2.9.3
8 years, 4 months
[PATCH v2] v2v: factor out bootloader handling
by Pino Toscano
Create an object hierarchy to represent different bootloaders for Linux
guests, moving the separate handling of grub1 and grub2 in different
classes: this isolates the code for each type of bootloader together,
instead of scattering it all around.
This is mostly code refactoring, with no actual behaviour change.
---
po/POTFILES-ml | 1 +
v2v/Makefile.am | 2 +
v2v/convert_linux.ml | 294 ++---------------------------------------
v2v/linux_bootloaders.ml | 325 ++++++++++++++++++++++++++++++++++++++++++++++
v2v/linux_bootloaders.mli | 44 +++++++
5 files changed, 385 insertions(+), 281 deletions(-)
create mode 100644 v2v/linux_bootloaders.ml
create mode 100644 v2v/linux_bootloaders.mli
diff --git a/po/POTFILES-ml b/po/POTFILES-ml
index b7b39fa..6a22f2c 100644
--- a/po/POTFILES-ml
+++ b/po/POTFILES-ml
@@ -120,6 +120,7 @@ v2v/input_libvirtxml.ml
v2v/input_ova.ml
v2v/inspect_source.ml
v2v/linux.ml
+v2v/linux_bootloaders.ml
v2v/modules_list.ml
v2v/output_glance.ml
v2v/output_libvirt.ml
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index d53e6e6..8a59ab5 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -42,6 +42,7 @@ SOURCES_MLI = \
input_ova.mli \
inspect_source.mli \
linux.mli \
+ linux_bootloaders.mli \
modules_list.mli \
output_glance.mli \
output_libvirt.mli \
@@ -81,6 +82,7 @@ SOURCES_ML = \
input_libvirt_xen_ssh.ml \
input_libvirt.ml \
input_ova.ml \
+ linux_bootloaders.ml \
convert_linux.ml \
convert_windows.ml \
output_null.ml \
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 2a53315..7829612 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -87,45 +87,9 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
(* Clean RPM database. This must be done early to avoid RHBZ#1143866. *)
Array.iter g#rm_f (g#glob_expand "/var/lib/rpm/__db.00?");
- (* What grub is installed? *)
- let grub_config, grub =
- let locations = [
- "/boot/grub2/grub.cfg", `Grub2;
- "/boot/grub/menu.lst", `Grub1;
- "/boot/grub/grub.conf", `Grub1;
- ] in
- let locations =
- match inspect.i_firmware with
- | I_UEFI _ ->
- [
- "/boot/efi/EFI/redhat/grub.cfg", `Grub2;
- "/boot/efi/EFI/redhat/grub.conf", `Grub1;
- ] @ locations
- | I_BIOS -> locations in
- try
- List.find (
- fun (grub_config, _) -> g#is_file ~followsymlinks:true grub_config
- ) locations
- with
- Not_found ->
- error (f_"no grub1/grub-legacy or grub2 configuration file was found") in
-
- (* Grub prefix? Usually "/boot". *)
- let grub_prefix =
- match grub with
- | `Grub2 -> ""
- | `Grub1 ->
- if grub_config = "/boot/efi/EFI/redhat/grub.conf" then (
- g#aug_transform "grub" "/boot/efi/EFI/redhat/grub.conf";
- Linux.augeas_reload g;
- );
-
- let mounts = g#inspect_get_mountpoints inspect.i_root in
- try
- List.find (
- fun path -> List.mem_assoc path mounts
- ) [ "/boot/grub"; "/boot" ]
- with Not_found -> "" in
+ (* Detect the installed bootloader. *)
+ let bootloader = Linux_bootloaders.detect_bootloader g inspect in
+ Linux.augeas_reload g;
(* What kernel/kernel-like packages are installed on the current guest? *)
let installed_kernels : kernel_info list =
@@ -276,88 +240,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
* list is the default booting kernel.
*)
let grub_kernels : kernel_info list =
- (* Helper function for SUSE: remove (hdX,X) prefix from a path. *)
- let remove_hd_prefix =
- let rex = Str.regexp "^(hd.*)\\(.*\\)" in
- Str.replace_first rex "\\1"
- in
-
- let vmlinuzes =
- match grub with
- | `Grub1 ->
- let paths =
- let expr = sprintf "/files%s/title/kernel" grub_config in
- let paths = g#aug_match expr in
- let paths = Array.to_list paths in
-
- (* Remove duplicates. *)
- let paths = remove_duplicates paths in
-
- (* Get the default kernel from grub if it's set. *)
- let default =
- let expr = sprintf "/files%s/default" grub_config in
- try
- let idx = g#aug_get expr in
- let idx = int_of_string idx in
- (* Grub indices are zero-based, augeas is 1-based. *)
- let expr =
- sprintf "/files%s/title[%d]/kernel" grub_config (idx+1) in
- Some expr
- with G.Error msg
- when String.find msg "aug_get: no matching node" >= 0 ->
- None in
-
- (* If a default kernel was set, put it at the beginning of the paths
- * list. If not set, assume the first kernel always boots (?)
- *)
- match default with
- | None -> paths
- | Some p -> p :: List.filter ((<>) p) paths in
-
- (* Resolve the Augeas paths to kernel filenames. *)
- let vmlinuzes = List.map g#aug_get paths in
-
- (* Make sure kernel does not begin with (hdX,X). *)
- let vmlinuzes = List.map remove_hd_prefix vmlinuzes in
-
- (* Prepend grub filesystem. *)
- List.map ((^) grub_prefix) vmlinuzes
-
- | `Grub2 ->
- let get_default_image () =
- let cmd =
- if g#exists "/sbin/grubby" then
- [| "grubby"; "--default-kernel" |]
- else
- [| "/usr/bin/perl"; "-MBootloader::Tools"; "-e"; "
- InitLibrary();
- my $default = Bootloader::Tools::GetDefaultSection();
- print $default->{image};
- " |] in
- match g#command cmd with
- | "" -> None
- | k ->
- let len = String.length k in
- let k =
- if len > 0 && k.[len-1] = '\n' then
- String.sub k 0 (len-1)
- else k in
- Some (remove_hd_prefix k)
- in
-
- let vmlinuzes =
- (match get_default_image () with
- | None -> []
- | Some k -> [k]) @
- (* This is how the grub2 config generator enumerates kernels. *)
- Array.to_list (g#glob_expand "/boot/kernel-*") @
- Array.to_list (g#glob_expand "/boot/vmlinuz-*") @
- Array.to_list (g#glob_expand "/vmlinuz-*") in
- let rex = Str.regexp ".*\\.\\(dpkg-.*|rpmsave|rpmnew\\)$" in
- let vmlinuzes = List.filter (
- fun file -> not (Str.string_match rex file 0)
- ) vmlinuzes in
- vmlinuzes in
+ let vmlinuzes = bootloader#list_kernels () in
(* Map these to installed kernels. *)
filter_map (
@@ -396,21 +279,8 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
(* Conversion step. *)
let rec augeas_grub_configuration () =
- match grub with
- | `Grub1 ->
- (* Ensure Augeas is reading the grub configuration file, and if not
- * then add it.
- *)
- let incls = g#aug_match "/augeas/load/Grub/incl" in
- let incls = Array.to_list incls in
- let incls_contains_conf =
- List.exists (fun incl -> g#aug_get incl = grub_config) incls in
- if not incls_contains_conf then (
- g#aug_set "/augeas/load/Grub/incl[last()+1]" grub_config;
- Linux.augeas_reload g;
- )
-
- | `Grub2 -> () (* Not necessary for grub2. *)
+ if bootloader#set_augeas_configuration () then
+ Linux.augeas_reload g
and unconfigure_xen () =
(* Remove kmod-xenpv-* (RHEL 3). *)
@@ -740,7 +610,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
let kernels = List.rev kernels (* so best is first *) in
List.hd kernels in
if best_kernel <> List.hd grub_kernels then
- grub_set_bootable best_kernel;
+ bootloader#set_default_kernel best_kernel.ki_vmlinuz;
(* Does the best/bootable kernel support virtio? *)
let virtio = best_kernel.ki_supports_virtio in
@@ -758,46 +628,6 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
best_kernel, virtio
- and grub_set_bootable kernel =
- match grub with
- | `Grub1 ->
- if not (String.is_prefix kernel.ki_vmlinuz grub_prefix) then
- error (f_"kernel %s is not under grub tree %s")
- kernel.ki_vmlinuz grub_prefix;
- let kernel_under_grub_prefix =
- let prefix_len = String.length grub_prefix in
- let kernel_len = String.length kernel.ki_vmlinuz in
- String.sub kernel.ki_vmlinuz prefix_len (kernel_len - prefix_len) in
-
- (* Find the grub entry for the given kernel. *)
- let paths = g#aug_match (sprintf "/files%s/title/kernel[. = '%s']"
- grub_config kernel_under_grub_prefix) in
- let paths = Array.to_list paths in
- if paths = [] then
- error (f_"didn't find grub entry for kernel %s") kernel.ki_vmlinuz;
- let path = List.hd paths in
- let rex = Str.regexp ".*/title\\[\\([1-9][0-9]*\\)\\]/kernel" in
- if not (Str.string_match rex path 0) then
- error (f_"internal error: regular expression did not match '%s'")
- path;
- let index = int_of_string (Str.matched_group 1 path) - 1 in
- g#aug_set (sprintf "/files%s/default" grub_config) (string_of_int index);
- g#aug_save ()
-
- | `Grub2 ->
- let cmd =
- if g#exists "/sbin/grubby" then
- [| "grubby"; "--set-default"; kernel.ki_vmlinuz |]
- else
- [| "/usr/bin/perl"; "-MBootloader::Tools"; "-e"; sprintf "
- InitLibrary();
- my @sections = GetSectionList(type=>image, image=>\"%s\");
- my $section = GetSection(@sections);
- my $newdefault = $section->{name};
- SetGlobals(default, \"$newdefault\");
- " kernel.ki_vmlinuz |] in
- ignore (g#command cmd)
-
(* Even though the kernel was already installed (this version of
* virt-v2v does not install new kernels), it could have an
* initrd that does not have support virtio. Therefore rebuild
@@ -963,28 +793,6 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
g#aug_save ()
- and grub_configure_console () =
- match grub with
- | `Grub1 ->
- let rex = Str.regexp "\\(.*\\)\\b\\([xh]vc0\\)\\b\\(.*\\)" in
- let expr = sprintf "/files%s/title/kernel/console" grub_config in
-
- let paths = g#aug_match expr in
- let paths = Array.to_list paths in
- List.iter (
- fun path ->
- let console = g#aug_get path in
- if Str.string_match rex console 0 then (
- let console = Str.global_replace rex "\\1ttyS0\\3" console in
- g#aug_set path console
- )
- ) paths;
-
- g#aug_save ()
-
- | `Grub2 ->
- grub2_update_console ~remove:false
-
(* If the target doesn't support a serial console, we want to remove
* all references to it instead.
*)
@@ -1013,71 +821,6 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
g#aug_save ()
- and grub_remove_console () =
- match grub with
- | `Grub1 ->
- let rex = Str.regexp "\\(.*\\)\\b\\([xh]vc0\\)\\b\\(.*\\)" in
- let expr = sprintf "/files%s/title/kernel/console" grub_config in
-
- let rec loop = function
- | [] -> ()
- | path :: paths ->
- let console = g#aug_get path in
- if Str.string_match rex console 0 then (
- ignore (g#aug_rm path);
- (* All the paths are invalid, restart the loop. *)
- let paths = g#aug_match expr in
- let paths = Array.to_list paths in
- loop paths
- )
- else
- loop paths
- in
- let paths = g#aug_match expr in
- let paths = Array.to_list paths in
- loop paths;
-
- g#aug_save ()
-
- | `Grub2 ->
- grub2_update_console ~remove:true
-
- and grub2_update_console ~remove =
- let rex = Str.regexp "\\(.*\\)\\bconsole=[xh]vc0\\b\\(.*\\)" in
-
- let paths = [
- "/files/etc/sysconfig/grub/GRUB_CMDLINE_LINUX";
- "/files/etc/default/grub/GRUB_CMDLINE_LINUX";
- "/files/etc/default/grub/GRUB_CMDLINE_LINUX_DEFAULT"
- ] in
- let paths = List.map g#aug_match paths in
- let paths = List.map Array.to_list paths in
- let paths = List.flatten paths in
- match paths with
- | [] ->
- if not remove then
- warning (f_"could not add grub2 serial console (ignored)")
- else
- warning (f_"could not remove grub2 serial console (ignored)")
- | path :: _ ->
- let grub_cmdline = g#aug_get path in
- if Str.string_match rex grub_cmdline 0 then (
- let new_grub_cmdline =
- if not remove then
- Str.global_replace rex "\\1console=ttyS0\\2" grub_cmdline
- else
- Str.global_replace rex "\\1\\2" grub_cmdline in
- g#aug_set path new_grub_cmdline;
- g#aug_save ();
-
- try
- ignore (g#command [| "grub2-mkconfig"; "-o"; grub_config |])
- with
- G.Error msg ->
- warning (f_"could not rebuild grub2 configuration file (%s). This may mean that grub output will not be sent to the serial port, but otherwise should be harmless. Original error message: %s")
- grub_config msg
- )
-
and supports_acpi () =
(* ACPI known to cause RHEL 3 to fail. *)
if family = `RHEL_family && inspect.i_major_version == 3 then
@@ -1303,19 +1046,9 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
let paths = [
(* /etc/fstab *)
"/files/etc/fstab/*/spec";
-
- (* grub-legacy config *)
- "/files" ^ grub_config ^ "/*/kernel/root";
- "/files" ^ grub_config ^ "/*/kernel/resume";
- "/files/boot/grub/device.map/*[label() != \"#comment\"]";
- "/files/etc/sysconfig/grub/boot";
-
- (* grub2 config *)
- "/files/etc/sysconfig/grub/GRUB_CMDLINE_LINUX";
- "/files/etc/default/grub/GRUB_CMDLINE_LINUX";
- "/files/etc/default/grub/GRUB_CMDLINE_LINUX_DEFAULT";
- "/files/boot/grub2/device.map/*[label() != \"#comment\"]";
] in
+ (* Bootloader config *)
+ let paths = paths @ bootloader#augeas_device_patterns in
(* Which of these paths actually exist? *)
let paths =
@@ -1393,9 +1126,8 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
if !changed then (
g#aug_save ();
- (* If it's grub2, we have to regenerate the config files. *)
- if grub = `Grub2 then
- ignore (g#command [| "grub2-mkconfig"; "-o"; grub_config |]);
+ (* Make sure the bootloader is up-to-date. *)
+ bootloader#update ();
Linux.augeas_reload g
);
@@ -1425,10 +1157,10 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
if keep_serial_console then (
configure_console ();
- grub_configure_console ();
+ bootloader#configure_console ();
) else (
remove_console ();
- grub_remove_console ();
+ bootloader#remove_console ();
);
let acpi = supports_acpi () in
diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml
new file mode 100644
index 0000000..f6cbd5a
--- /dev/null
+++ b/v2v/linux_bootloaders.ml
@@ -0,0 +1,325 @@
+(* virt-v2v
+ * Copyright (C) 2009-2016 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.
+ *)
+
+open Printf
+
+open Common_gettext.Gettext
+open Common_utils
+
+open Types
+open Utils
+
+module G = Guestfs
+
+class virtual bootloader = object
+ method virtual name : string
+ method virtual augeas_device_patterns : string list
+ method virtual list_kernels : unit -> string list
+ method virtual set_default_kernel : string -> unit
+ method set_augeas_configuration () = false
+ method virtual configure_console : unit -> unit
+ method virtual remove_console : unit -> unit
+ method update () = ()
+end
+
+(* Helper type used in detect_bootloader. *)
+type bootloader_type =
+ | Grub1
+ | Grub2
+
+(* Helper function for SUSE: remove (hdX,X) prefix from a path. *)
+let remove_hd_prefix path =
+ let rex = Str.regexp "^(hd.*)\\(.*\\)" in
+ Str.replace_first rex "\\1" path
+
+(* Grub1 (AKA grub-legacy) representation. *)
+class bootloader_grub1 (g : G.guestfs) inspect grub_config =
+ (* Grub prefix? Usually "/boot". *)
+ let grub_prefix =
+ let mounts = g#inspect_get_mountpoints inspect.i_root in
+ try
+ List.find (
+ fun path -> List.mem_assoc path mounts
+ ) [ "/boot/grub"; "/boot" ]
+ with Not_found -> "" in
+object
+ inherit bootloader
+
+ method name = "grub1"
+
+ method augeas_device_patterns = [
+ "/files" ^ grub_config ^ "/*/kernel/root";
+ "/files" ^ grub_config ^ "/*/kernel/resume";
+ "/files/boot/grub/device.map/*[label() != \"#comment\"]";
+ "/files/etc/sysconfig/grub/boot";
+ ]
+
+ method list_kernels () =
+ let paths =
+ let expr = sprintf "/files%s/title/kernel" grub_config in
+ let paths = g#aug_match expr in
+ let paths = Array.to_list paths in
+
+ (* Remove duplicates. *)
+ let paths = remove_duplicates paths in
+
+ (* Get the default kernel from grub if it's set. *)
+ let default =
+ let expr = sprintf "/files%s/default" grub_config in
+ try
+ let idx = g#aug_get expr in
+ let idx = int_of_string idx in
+ (* Grub indices are zero-based, augeas is 1-based. *)
+ let expr =
+ sprintf "/files%s/title[%d]/kernel" grub_config (idx+1) in
+ Some expr
+ with G.Error msg
+ when String.find msg "aug_get: no matching node" >= 0 ->
+ None in
+
+ (* If a default kernel was set, put it at the beginning of the paths
+ * list. If not set, assume the first kernel always boots (?)
+ *)
+ match default with
+ | None -> paths
+ | Some p -> p :: List.filter ((<>) p) paths in
+
+ (* Resolve the Augeas paths to kernel filenames. *)
+ let vmlinuzes = List.map g#aug_get paths in
+
+ (* Make sure kernel does not begin with (hdX,X). *)
+ let vmlinuzes = List.map remove_hd_prefix vmlinuzes in
+
+ (* Prepend grub filesystem. *)
+ List.map ((^) grub_prefix) vmlinuzes
+
+ method set_default_kernel vmlinuz =
+ if not (String.is_prefix vmlinuz grub_prefix) then
+ error (f_"kernel %s is not under grub tree %s")
+ vmlinuz grub_prefix;
+ let kernel_under_grub_prefix =
+ let prefix_len = String.length grub_prefix in
+ let kernel_len = String.length vmlinuz in
+ String.sub vmlinuz prefix_len (kernel_len - prefix_len) in
+
+ (* Find the grub entry for the given kernel. *)
+ let paths = g#aug_match (sprintf "/files%s/title/kernel[. = '%s']"
+ grub_config kernel_under_grub_prefix) in
+ let paths = Array.to_list paths in
+ if paths = [] then
+ error (f_"didn't find grub entry for kernel %s") vmlinuz;
+ let path = List.hd paths in
+ let rex = Str.regexp ".*/title\\[\\([1-9][0-9]*\\)\\]/kernel" in
+ if not (Str.string_match rex path 0) then
+ error (f_"internal error: regular expression did not match '%s'")
+ path;
+ let index = int_of_string (Str.matched_group 1 path) - 1 in
+ g#aug_set (sprintf "/files%s/default" grub_config) (string_of_int index);
+ g#aug_save ()
+
+ method set_augeas_configuration () =
+ let incls = g#aug_match "/augeas/load/Grub/incl" in
+ let incls = Array.to_list incls in
+ let incls_contains_conf =
+ List.exists (fun incl -> g#aug_get incl = grub_config) incls in
+ if not incls_contains_conf then (
+ g#aug_set "/augeas/load/Grub/incl[last()+1]" grub_config;
+ true;
+ ) else false
+
+ method configure_console () =
+ let rex = Str.regexp "\\(.*\\)\\b\\([xh]vc0\\)\\b\\(.*\\)" in
+ let expr = sprintf "/files%s/title/kernel/console" grub_config in
+
+ let paths = g#aug_match expr in
+ let paths = Array.to_list paths in
+ List.iter (
+ fun path ->
+ let console = g#aug_get path in
+ if Str.string_match rex console 0 then (
+ let console = Str.global_replace rex "\\1ttyS0\\3" console in
+ g#aug_set path console
+ )
+ ) paths;
+
+ g#aug_save ()
+
+ method remove_console () =
+ let rex = Str.regexp "\\(.*\\)\\b\\([xh]vc0\\)\\b\\(.*\\)" in
+ let expr = sprintf "/files%s/title/kernel/console" grub_config in
+
+ let rec loop = function
+ | [] -> ()
+ | path :: paths ->
+ let console = g#aug_get path in
+ if Str.string_match rex console 0 then (
+ ignore (g#aug_rm path);
+ (* All the paths are invalid, restart the loop. *)
+ let paths = g#aug_match expr in
+ let paths = Array.to_list paths in
+ loop paths
+ )
+ else
+ loop paths
+ in
+ let paths = g#aug_match expr in
+ let paths = Array.to_list paths in
+ loop paths;
+
+ g#aug_save ()
+end
+
+(* Grub2 representation. *)
+class bootloader_grub2 (g : G.guestfs) grub_config =
+ let grub2_update_console ~remove =
+ let rex = Str.regexp "\\(.*\\)\\bconsole=[xh]vc0\\b\\(.*\\)" in
+
+ let paths = [
+ "/files/etc/sysconfig/grub/GRUB_CMDLINE_LINUX";
+ "/files/etc/default/grub/GRUB_CMDLINE_LINUX";
+ "/files/etc/default/grub/GRUB_CMDLINE_LINUX_DEFAULT"
+ ] in
+ let paths = List.map g#aug_match paths in
+ let paths = List.map Array.to_list paths in
+ let paths = List.flatten paths in
+ match paths with
+ | [] ->
+ if not remove then
+ warning (f_"could not add grub2 serial console (ignored)")
+ else
+ warning (f_"could not remove grub2 serial console (ignored)")
+ | path :: _ ->
+ let grub_cmdline = g#aug_get path in
+ if Str.string_match rex grub_cmdline 0 then (
+ let new_grub_cmdline =
+ if not remove then
+ Str.global_replace rex "\\1console=ttyS0\\2" grub_cmdline
+ else
+ Str.global_replace rex "\\1\\2" grub_cmdline in
+ g#aug_set path new_grub_cmdline;
+ g#aug_save ();
+
+ try
+ ignore (g#command [| "grub2-mkconfig"; "-o"; grub_config |])
+ with
+ G.Error msg ->
+ warning (f_"could not rebuild grub2 configuration file (%s). This may mean that grub output will not be sent to the serial port, but otherwise should be harmless. Original error message: %s")
+ grub_config msg
+ ) in
+object
+ inherit bootloader
+
+ method name = "grub2"
+
+ method augeas_device_patterns = [
+ "/files/etc/sysconfig/grub/GRUB_CMDLINE_LINUX";
+ "/files/etc/default/grub/GRUB_CMDLINE_LINUX";
+ "/files/etc/default/grub/GRUB_CMDLINE_LINUX_DEFAULT";
+ "/files/boot/grub2/device.map/*[label() != \"#comment\"]";
+ ]
+
+ method list_kernels () =
+ let get_default_image () =
+ let cmd =
+ if g#exists "/sbin/grubby" then
+ [| "grubby"; "--default-kernel" |]
+ else
+ [| "/usr/bin/perl"; "-MBootloader::Tools"; "-e"; "
+ InitLibrary();
+ my $default = Bootloader::Tools::GetDefaultSection();
+ print $default->{image};
+ " |] in
+ match g#command cmd with
+ | "" -> None
+ | k ->
+ let len = String.length k in
+ let k =
+ if len > 0 && k.[len-1] = '\n' then
+ String.sub k 0 (len-1)
+ else k in
+ Some (remove_hd_prefix k)
+ in
+
+ let vmlinuzes =
+ (match get_default_image () with
+ | None -> []
+ | Some k -> [k]) @
+ (* This is how the grub2 config generator enumerates kernels. *)
+ Array.to_list (g#glob_expand "/boot/kernel-*") @
+ Array.to_list (g#glob_expand "/boot/vmlinuz-*") @
+ Array.to_list (g#glob_expand "/vmlinuz-*") in
+ let rex = Str.regexp ".*\\.\\(dpkg-.*|rpmsave|rpmnew\\)$" in
+ let vmlinuzes = List.filter (
+ fun file -> not (Str.string_match rex file 0)
+ ) vmlinuzes in
+ vmlinuzes
+
+ method set_default_kernel vmlinuz =
+ let cmd =
+ if g#exists "/sbin/grubby" then
+ [| "grubby"; "--set-default"; vmlinuz |]
+ else
+ [| "/usr/bin/perl"; "-MBootloader::Tools"; "-e"; sprintf "
+ InitLibrary();
+ my @sections = GetSectionList(type=>image, image=>\"%s\");
+ my $section = GetSection(@sections);
+ my $newdefault = $section->{name};
+ SetGlobals(default, \"$newdefault\");
+ " vmlinuz |] in
+ ignore (g#command cmd)
+
+ method configure_console () =
+ grub2_update_console ~remove:false
+
+ method remove_console () =
+ grub2_update_console ~remove:true
+
+ method update () =
+ ignore (g#command [| "grub2-mkconfig"; "-o"; grub_config |])
+end
+
+let detect_bootloader (g : G.guestfs) inspect =
+ let config_file, typ =
+ let locations = [
+ "/boot/grub2/grub.cfg", Grub2;
+ "/boot/grub/menu.lst", Grub1;
+ "/boot/grub/grub.conf", Grub1;
+ ] in
+ let locations =
+ match inspect.i_firmware with
+ | I_UEFI _ ->
+ [
+ "/boot/efi/EFI/redhat/grub.cfg", Grub2;
+ "/boot/efi/EFI/redhat/grub.conf", Grub1;
+ ] @ locations
+ | I_BIOS -> locations in
+ try
+ List.find (
+ fun (config_file, _) -> g#is_file ~followsymlinks:true config_file
+ ) locations
+ with
+ Not_found ->
+ error (f_"no bootloader detected") in
+
+ match typ with
+ | Grub1 ->
+ if config_file = "/boot/efi/EFI/redhat/grub.conf" then
+ g#aug_transform "grub" "/boot/efi/EFI/redhat/grub.conf";
+
+ new bootloader_grub1 g inspect config_file
+ | Grub2 -> new bootloader_grub2 g config_file
diff --git a/v2v/linux_bootloaders.mli b/v2v/linux_bootloaders.mli
new file mode 100644
index 0000000..cf115e3
--- /dev/null
+++ b/v2v/linux_bootloaders.mli
@@ -0,0 +1,44 @@
+(* virt-v2v
+ * Copyright (C) 2009-2016 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.
+ *)
+
+class virtual bootloader : object
+ method virtual name : string
+ (** The name of the bootloader. *)
+ method virtual augeas_device_patterns : string list
+ (** A list of Augeas patterns to search for device names. *)
+ method virtual list_kernels : unit -> string list
+ (** Lists all the kernels configured in the bootloader. *)
+ method virtual set_default_kernel : string -> unit
+ (** Sets the specified vmlinuz path as default bootloader entry. *)
+ method set_augeas_configuration : unit -> bool
+ (** Checks whether Augeas is reading the configuration file
+ of the bootloader, and if not then add it.
+
+ Returns whether Augeas needs to be reloaded. *)
+ method virtual configure_console : unit -> unit
+ (** Sets up the console for the available kernels. *)
+ method virtual remove_console : unit -> unit
+ (** Removes the console in all the available kernels. *)
+ method update : unit -> unit
+ (** Update the bootloader. *)
+end
+(** Encapsulates a Linux boot loader as object. *)
+
+val detect_bootloader : Guestfs.guestfs -> Types.inspect -> bootloader
+(** Detects the bootloader on the guest, and creates the object
+ representing it. *)
--
2.7.4
8 years, 4 months
[PATCH] mllib: Add String.map function for OCaml < 4.00.0.
by Richard W.M. Jones
String.map was added in OCaml 4.00.0. However we use this function
to implement String.lowercase_ascii etc.
Therefore include a definition of the function for older versions of
OCaml. (Debian Wheezy has OCaml 3.12.1.)
---
mllib/common_utils.ml | 8 ++++++++
mllib/common_utils.mli | 2 ++
2 files changed, 10 insertions(+)
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 9210cf8..4e36d50 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -38,6 +38,14 @@ end
module String = struct
include String
+ let map f s =
+ let len = String.length s in
+ let b = Bytes.create len in
+ for i = 0 to len-1 do
+ Bytes.unsafe_set b i (f (unsafe_get s i))
+ done;
+ Bytes.to_string b
+
let lowercase_ascii s = map Char.lowercase_ascii s
let uppercase_ascii s = map Char.uppercase_ascii s
diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli
index 4959de6..de95f9d 100644
--- a/mllib/common_utils.mli
+++ b/mllib/common_utils.mli
@@ -49,6 +49,8 @@ module String : sig
val sub : string -> int -> int -> string
val unsafe_get : string -> int -> char
+ val map : (char -> char) -> string -> string
+
val lowercase_ascii : string -> string
val uppercase_ascii : string -> string
--
2.7.4
8 years, 4 months
[PATCH] build: Add common CLEANFILES and DISTCLEANFILES to common-rules.mk.
by Richard W.M. Jones
By adding common CLEANFILES and DISTCLEANFILES variables to
common-rules.mk, we can remove these from most other Makefiles, and
also clean files more consistently.
Note that bin_PROGRAMS are already cleaned by 'make clean', so I
removed cases where these were unnecessarily added to CLEANFILES.
---
.gitignore | 1 +
Makefile.am | 6 +----
align/Makefile.am | 4 ----
appliance/Makefile.am | 8 +------
bash/Makefile.am | 2 +-
builder/Makefile.am | 20 +----------------
builder/website/Makefile.am | 2 --
cat/Makefile.am | 10 ---------
common-rules.mk | 42 +++++++++++++++++++++++++++++++++++
customize/Makefile.am | 7 ------
daemon/Makefile.am | 4 ----
df/Makefile.am | 4 ----
dib/Makefile.am | 8 -------
diff/Makefile.am | 4 ----
docs/Makefile.am | 22 ++----------------
edit/Makefile.am | 4 ----
erlang/Makefile.am | 6 ++---
erlang/examples/Makefile.am | 4 ----
examples/Makefile.am | 4 ----
fish/Makefile.am | 14 ------------
format/Makefile.am | 4 ----
fuse/Makefile.am | 6 -----
generator/Makefile.am | 4 ++--
get-kernel/Makefile.am | 8 -------
gobject/Makefile.am | 4 ++--
golang/Makefile.am | 2 +-
golang/examples/Makefile.am | 4 ----
haskell/Makefile.am | 2 +-
inspector/Makefile.am | 4 ----
java/Makefile.am | 3 +--
java/examples/Makefile.am | 6 ++---
lua/Makefile.am | 4 +---
lua/examples/Makefile.am | 4 ----
make-fs/Makefile.am | 4 ----
mllib/Makefile.am | 6 -----
ocaml/Makefile.am | 4 +---
ocaml/examples/Makefile.am | 7 ++----
p2v/Makefile.am | 12 ++--------
perl/Makefile.am | 6 ++---
perl/examples/Makefile.am | 4 ----
po-docs/Makefile.am | 2 +-
po-docs/language.mk | 2 --
podwrapper.pl.in | 2 --
python/Makefile.am | 5 ++---
python/examples/Makefile.am | 6 ++---
rescue/Makefile.am | 4 ----
resize/Makefile.am | 8 -------
ruby/Makefile.am | 2 +-
ruby/examples/Makefile.am | 4 ----
sparsify/Makefile.am | 8 -------
src/Makefile.am | 10 ++++++---
src/libguestfs.3 | 1 -
sysprep/Makefile.am | 8 -------
test-data/Makefile.am | 2 +-
test-data/blank-disks/Makefile.am | 2 +-
test-data/fake-virtio-win/Makefile.am | 2 +-
test-data/files/Makefile.am | 2 +-
test-data/phony-guests/Makefile.am | 4 ++--
test-tool/Makefile.am | 2 --
tests/c-api/Makefile.am | 2 +-
tests/syslinux/Makefile.am | 2 +-
tests/xml/Makefile.am | 2 --
tools/Makefile.am | 6 -----
v2v/Makefile.am | 12 ----------
v2v/test-harness/Makefile.am | 17 --------------
65 files changed, 89 insertions(+), 302 deletions(-)
delete mode 100644 src/libguestfs.3
diff --git a/.gitignore b/.gitignore
index 711782c..a97fe11 100644
--- a/.gitignore
+++ b/.gitignore
@@ -485,6 +485,7 @@ Makefile.in
/src/guestfs_protocol.h
/src/guestfs_protocol.x
/src/guestfs-structs.pod
+/src/libguestfs.3
/src/libguestfs.pc
/src/libguestfs.syms
/src/.libs/libguestfs.so
diff --git a/Makefile.am b/Makefile.am
index acc6bd4..b7a4fd7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -366,10 +366,8 @@ podwrapper.1: podwrapper.pl
# Make clean.
-CLEANFILES = \
- *~ \
+CLEANFILES += \
pod2htm?.tmp \
- podwrapper.1 \
qemu-wrapper.sh \
tmp/disk* \
tmp/run-* \
@@ -384,8 +382,6 @@ clean-local:
-rm -rf tmp/null.*
-find tmp -type s -delete
-find . -name '*~' -delete
- -find . -name '*.bak' -delete
- -find . -name '*.orig' -delete
# If you don't want to run all of the tests ('make check') then this
# will just run libguestfs-test-tool for a quick check. Note this
diff --git a/align/Makefile.am b/align/Makefile.am
index 2b4dee4..1eccf28 100644
--- a/align/Makefile.am
+++ b/align/Makefile.am
@@ -23,10 +23,6 @@ EXTRA_DIST = \
test-virt-alignment-scan-guests.sh \
virt-alignment-scan.pod
-CLEANFILES = \
- stamp-virt-alignment-scan.pod \
- virt-alignment-scan.1
-
bin_PROGRAMS = virt-alignment-scan
SHARED_SOURCE_FILES = \
diff --git a/appliance/Makefile.am b/appliance/Makefile.am
index e23778e..08a7f4c 100644
--- a/appliance/Makefile.am
+++ b/appliance/Makefile.am
@@ -155,13 +155,7 @@ stamp-libguestfs-make-fixed-appliance.pod: libguestfs-make-fixed-appliance.pod
# Make clean.
-CLEANFILES = \
- *~ \
- libguestfs-make-fixed-appliance.1 \
- stamp-libguestfs-make-fixed-appliance.pod
-
-DISTCLEANFILES = \
+DISTCLEANFILES += \
make.sh \
packagelist \
- stamp-supermin \
supermin.d/*
diff --git a/bash/Makefile.am b/bash/Makefile.am
index e07c865..4968679 100644
--- a/bash/Makefile.am
+++ b/bash/Makefile.am
@@ -56,7 +56,7 @@ EXTRA_DIST = \
README \
$(scripts)
-CLEANFILES = \
+CLEANFILES += \
$(symlinks)
# Any tool that has --short-options and --long-options is handled by
diff --git a/builder/Makefile.am b/builder/Makefile.am
index 328775c..7983223 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -40,18 +40,6 @@ EXTRA_DIST = \
virt-index-validate.pod \
yajl_tests.ml
-CLEANFILES = \
- *~ \
- *.annot \
- *.cache \
- *.cmi \
- *.cmo \
- *.cmx \
- *.cmxa \
- *.log \
- *.o \
- virt-builder
-
SOURCES_MLI = \
cache.mli \
cmdline.mli \
@@ -194,8 +182,6 @@ stamp-virt-builder.pod: virt-builder.pod $(top_srcdir)/customize/customize-synop
$<
touch $@
-CLEANFILES += stamp-virt-builder.pod virt-builder.1
-
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
@@ -290,8 +276,6 @@ depend: .depend
endif
-DISTCLEANFILES = .depend
-
.PHONY: depend docs
# virt-builder's default repository
@@ -343,9 +327,7 @@ stamp-virt-index-validate.pod: virt-index-validate.pod
CLEANFILES += \
index-parse.c \
index-parse.h \
- index-scan.c \
- stamp-virt-index-validate.pod \
- virt-index-validate.1
+ index-scan.c
if HAVE_OCAML
# Automake-generated makefile has a rule ".y.c" but lacks a rule ".y.h".
diff --git a/builder/website/Makefile.am b/builder/website/Makefile.am
index 7650ce5..df2f194 100644
--- a/builder/website/Makefile.am
+++ b/builder/website/Makefile.am
@@ -44,8 +44,6 @@ EXTRA_DIST = \
ubuntu.sh \
ubuntu-ppc64le.sh
-CLEANFILES = *~
-
# Validates the index file.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS = validate.sh
diff --git a/cat/Makefile.am b/cat/Makefile.am
index 266e1c5..38faa94 100644
--- a/cat/Makefile.am
+++ b/cat/Makefile.am
@@ -28,16 +28,6 @@ EXTRA_DIST = \
test-virt-ls.sh \
virt-ls.pod
-CLEANFILES = \
- stamp-virt-cat.pod \
- stamp-virt-filesystems.pod \
- stamp-virt-log.pod \
- stamp-virt-ls.pod \
- virt-cat.1 \
- virt-filesystems.1 \
- virt-log.1 \
- virt-ls.1
-
bin_PROGRAMS = virt-cat virt-filesystems virt-log virt-ls
SHARED_SOURCE_FILES = \
diff --git a/common-rules.mk b/common-rules.mk
index e6b40d1..fd136ed 100644
--- a/common-rules.mk
+++ b/common-rules.mk
@@ -19,3 +19,45 @@
# cf. 'subdir-rules.mk'
-include $(top_builddir)/localenv
+
+# Files that should universally be removed by 'make clean'. Note if
+# there is any case in any subdirectory where a file should not be
+# removed by 'make clean', it should not be listed here!
+
+# Emacs backup files
+CLEANFILES = *~
+
+# Other backup files.
+CLEANFILES += *.bak
+
+# Patch original and reject files.
+CLEANFILES += *.orig *.rej
+
+# C intermediate and generated files.
+# NB don't remove *.so files!
+CLEANFILES += *.o *.a
+
+# Libtool cruft.
+CLEANFILES += *.lo *.la
+
+# OCaml intermediate and generated files.
+CLEANFILES += *.cmi *.cmo *.cma *.cmx *.cmxa dll*.so
+
+# OCaml -annot files (used for displaying types in some IDEs).
+CLEANFILES += *.annot
+
+# OCaml oUnit generated files.
+CLEANFILES += oUnit-*.cache oUnit-*.log
+
+# Manual pages - these are all generated from *.pod, so the
+# pages themselves should all be removed by 'make clean'.
+CLEANFILES += *.1 *.3 *.5 *.8
+
+# Stamp files used when generating man pages.
+CLEANFILES += stamp-*.pod
+
+# Bindtests temporary files used in many language bindings.
+CLEANFILES += bindtests.tmp
+
+# Files that should be universally removed by 'make distclean'.
+DISTCLEANFILES = .depend stamp-*
diff --git a/customize/Makefile.am b/customize/Makefile.am
index a4d537f..a76b6c5 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -25,11 +25,6 @@ EXTRA_DIST = \
test-virt-customize-docs.sh \
virt-customize.pod
-CLEANFILES = \
- *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o dll*.so \
- stamp-virt-customize.pod \
- virt-customize virt-customize.1
-
generator_built = \
customize_cmdline.mli \
customize_cmdline.ml \
@@ -219,6 +214,4 @@ depend: .depend
endif
-DISTCLEANFILES = .depend
-
.PHONY: depend docs
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 7d82371..df93d7e 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -17,10 +17,6 @@
include $(top_srcdir)/subdir-rules.mk
-CLEANFILES = \
- stamp-guestfsd.pod \
- guestfsd.8
-
generator_built = \
actions.h \
stubs.c \
diff --git a/df/Makefile.am b/df/Makefile.am
index cbfb160..ce1686a 100644
--- a/df/Makefile.am
+++ b/df/Makefile.am
@@ -24,10 +24,6 @@ EXTRA_DIST = \
test-virt-df-guests.sh \
virt-df.pod
-CLEANFILES = \
- stamp-virt-df.pod \
- virt-df.1
-
bin_PROGRAMS = virt-df
SHARED_SOURCE_FILES = \
diff --git a/dib/Makefile.am b/dib/Makefile.am
index 7d39d89..2ac362f 100644
--- a/dib/Makefile.am
+++ b/dib/Makefile.am
@@ -22,8 +22,6 @@ EXTRA_DIST = \
test-virt-dib-docs.sh \
virt-dib.pod
-CLEANFILES = *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o virt-dib
-
SOURCES_MLI = \
cmdline.mli
@@ -120,10 +118,6 @@ stamp-virt-dib.pod: virt-dib.pod
$<
touch $@
-CLEANFILES += \
- stamp-virt-dib.pod \
- virt-dib.1
-
# Dependencies.
depend: .depend
@@ -140,6 +134,4 @@ depend: .depend
endif
-DISTCLEANFILES = .depend
-
.PHONY: depend docs
diff --git a/diff/Makefile.am b/diff/Makefile.am
index 87d18c5..cdbe05c 100644
--- a/diff/Makefile.am
+++ b/diff/Makefile.am
@@ -22,10 +22,6 @@ EXTRA_DIST = \
test-virt-diff-docs.sh \
virt-diff.pod
-CLEANFILES = \
- stamp-virt-diff.pod \
- virt-diff.1
-
bin_PROGRAMS = virt-diff
SHARED_SOURCE_FILES = \
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 40c6993..b67735b 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -31,26 +31,8 @@ EXTRA_DIST = \
make-internal-documentation.pl \
README
-CLEANFILES = \
- guestfs-building.1 \
- guestfs-faq.1 \
- guestfs-hacking.1 \
- guestfs-internals.1 \
- guestfs-performance.1 \
- guestfs-recipes.1 \
- guestfs-release-notes.1 \
- guestfs-security.1 \
- guestfs-testing.1 \
- internal-documentation.pod \
- stamp-guestfs-building.pod \
- stamp-guestfs-faq.pod \
- stamp-guestfs-hacking.pod \
- stamp-guestfs-internals.pod \
- stamp-guestfs-performance.pod \
- stamp-guestfs-recipes.pod \
- stamp-guestfs-release-notes.pod \
- stamp-guestfs-security.pod \
- stamp-guestfs-testing.pod
+CLEANFILES += \
+ internal-documentation.pod
man_MANS = \
guestfs-building.1 \
diff --git a/edit/Makefile.am b/edit/Makefile.am
index 709bfca..4ac4f08 100644
--- a/edit/Makefile.am
+++ b/edit/Makefile.am
@@ -22,10 +22,6 @@ EXTRA_DIST = \
test-virt-edit-docs.sh \
virt-edit.pod
-CLEANFILES = \
- stamp-virt-edit.pod \
- virt-edit.1
-
bin_PROGRAMS = virt-edit
SHARED_SOURCE_FILES = \
diff --git a/erlang/Makefile.am b/erlang/Makefile.am
index 7dc0906..fb1a3dc 100644
--- a/erlang/Makefile.am
+++ b/erlang/Makefile.am
@@ -28,10 +28,8 @@ EXTRA_DIST = \
tests/*.erl \
README
-CLEANFILES = \
- $(erlang_bin_DATA) \
- $(bin_PROGRAMS) \
- bindtests.tmp
+CLEANFILES += \
+ $(erlang_bin_DATA)
# Erlang makes a new libguestfs-<VERSION>/ebin subdirectory each time
# we build, so we have to remove that and any previous copies.
diff --git a/erlang/examples/Makefile.am b/erlang/examples/Makefile.am
index 0d2a3c9..da7fc43 100644
--- a/erlang/examples/Makefile.am
+++ b/erlang/examples/Makefile.am
@@ -23,10 +23,6 @@ EXTRA_DIST = \
inspect_vm.erl \
guestfs-erlang.pod
-CLEANFILES = \
- guestfs-erlang.3 \
- stamp-guestfs-erlang.pod
-
man_MANS = guestfs-erlang.3
noinst_DATA = $(top_builddir)/website/guestfs-erlang.3.html
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 26ed938..0abc039 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -29,10 +29,6 @@ EXTRA_DIST = \
mount-local.c \
virt-dhcp-address.c
-CLEANFILES = \
- guestfs-examples.3 \
- stamp-guestfs-examples.pod
-
noinst_PROGRAMS = create-disk debug-logging display-icon inspect-vm
if HAVE_LIBVIRT
noinst_PROGRAMS += copy-over libvirt-auth
diff --git a/fish/Makefile.am b/fish/Makefile.am
index 1e3c1d9..a6de568 100644
--- a/fish/Makefile.am
+++ b/fish/Makefile.am
@@ -17,20 +17,6 @@
include $(top_srcdir)/subdir-rules.mk
-CLEANFILES = \
- guestfish.1 \
- libguestfs-tools.conf.5 \
- stamp-guestfish.pod \
- stamp-libguestfs-tools.conf.pod \
- stamp-virt-copy-in.pod \
- stamp-virt-copy-out.pod \
- stamp-virt-tar-in.pod \
- stamp-virt-tar-out.pod \
- virt-copy-in.1 \
- virt-copy-out.1 \
- virt-tar-in.1 \
- virt-tar-out.1
-
bin_PROGRAMS = guestfish
generator_built = \
diff --git a/format/Makefile.am b/format/Makefile.am
index d955e35..d196910 100644
--- a/format/Makefile.am
+++ b/format/Makefile.am
@@ -22,10 +22,6 @@ EXTRA_DIST = \
test-virt-format.sh \
virt-format.pod
-CLEANFILES = \
- stamp-virt-format.pod \
- virt-format.1
-
bin_PROGRAMS = virt-format
SHARED_SOURCE_FILES = \
diff --git a/fuse/Makefile.am b/fuse/Makefile.am
index b22c785..d766479 100644
--- a/fuse/Makefile.am
+++ b/fuse/Makefile.am
@@ -24,12 +24,6 @@ EXTRA_DIST = \
test-fuse-umount-race.sh \
test-guestunmount-not-mounted.sh
-CLEANFILES = \
- guestmount.1 \
- guestunmount.1 \
- stamp-guestmount.pod \
- stamp-guestunmount.pod
-
if HAVE_FUSE
bin_PROGRAMS = \
diff --git a/generator/Makefile.am b/generator/Makefile.am
index a5ff516..31c33fa 100644
--- a/generator/Makefile.am
+++ b/generator/Makefile.am
@@ -174,8 +174,8 @@ stamp-generator: generator
cd $(top_srcdir) && $(abs_builddir)/generator
touch $@
-CLEANFILES = $(noinst_DATA) $(noinst_PROGRAM) *.cmi *.cmo *~
+CLEANFILES += $(noinst_DATA) $(noinst_PROGRAM)
-DISTCLEANFILES = .depend .pod2text.data.version.2
+DISTCLEANFILES += .pod2text.data.version.2
SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
diff --git a/get-kernel/Makefile.am b/get-kernel/Makefile.am
index d0077f1..55b3577 100644
--- a/get-kernel/Makefile.am
+++ b/get-kernel/Makefile.am
@@ -22,8 +22,6 @@ EXTRA_DIST = \
test-virt-get-kernel-docs.sh \
virt-get-kernel.pod
-CLEANFILES = *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o virt-get-kernel
-
SOURCES_ML = \
get_kernel.ml
@@ -116,10 +114,6 @@ stamp-virt-get-kernel.pod: virt-get-kernel.pod
$<
touch $@
-CLEANFILES += \
- stamp-virt-get-kernel.pod \
- virt-get-kernel.1
-
# Dependencies.
depend: .depend
@@ -136,6 +130,4 @@ depend: .depend
endif
-DISTCLEANFILES = .depend
-
.PHONY: depend
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index c46b6e2..c47d65a 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -41,8 +41,8 @@ EXTRA_DIST = \
# Remove the old generated files which were directly in the gobject/
# directory. These have now moved into gobject/src/
-CLEANFILES = \
- guestfs-gobject*.c *.o *.lo
+CLEANFILES += \
+ guestfs-gobject*.c
libname = libguestfs-gobject-1.0.la
diff --git a/golang/Makefile.am b/golang/Makefile.am
index 58cafc6..6afa97c 100644
--- a/golang/Makefile.am
+++ b/golang/Makefile.am
@@ -59,7 +59,7 @@ TESTS = run-bindtests run-tests
endif
-CLEANFILES = *~ src/$(pkg)/*~
+CLEANFILES += src/$(pkg)/*~
clean-local:
rm -rf pkg
diff --git a/golang/examples/Makefile.am b/golang/examples/Makefile.am
index 0b8286d..88bab10 100644
--- a/golang/examples/Makefile.am
+++ b/golang/examples/Makefile.am
@@ -23,10 +23,6 @@ EXTRA_DIST = \
inspect-vm.go \
guestfs-golang.pod
-CLEANFILES = \
- guestfs-golang.3 \
- stamp-guestfs-golang.pod
-
man_MANS = guestfs-golang.3
noinst_DATA = $(top_builddir)/website/guestfs-golang.3.html
diff --git a/haskell/Makefile.am b/haskell/Makefile.am
index 64f54bf..b09b06b 100644
--- a/haskell/Makefile.am
+++ b/haskell/Makefile.am
@@ -87,7 +87,7 @@ built_tests = Bindtests Guestfs010Load Guestfs030Config Guestfs050LVCreate
$(built_tests): %: %.hs Guestfs.hs
$(GHC) $(GHCFLAGS) --make -main-is $@ -odir .$@ -o $@ $< $(srcdir)/Guestfs.hs -lguestfs
-CLEANFILES = $(all_targets) *~ *.hi *.o test-lv-create.img
+CLEANFILES += $(all_targets) *.hi test-lv-create.img
clean-local:
-rm -rf $(built_tests:%=.%)
diff --git a/inspector/Makefile.am b/inspector/Makefile.am
index af596bf..00ca5d5 100644
--- a/inspector/Makefile.am
+++ b/inspector/Makefile.am
@@ -45,10 +45,6 @@ EXTRA_DIST = \
test-xmllint.sh.in \
virt-inspector.pod
-CLEANFILES = \
- stamp-virt-inspector.pod \
- virt-inspector.1
-
docdir = @docdir@
dist_doc_DATA = \
virt-inspector.rng \
diff --git a/java/Makefile.am b/java/Makefile.am
index c7db29d..83c4a30 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -56,8 +56,7 @@ EXTRA_DIST = \
run-java-tests \
Makefile.inc
-CLEANFILES = \
- bindtests.tmp \
+CLEANFILES += \
com/redhat/et/libguestfs/*.class \
com_redhat_et_libguestfs_GuestFS.h \
doc-stamp \
diff --git a/java/examples/Makefile.am b/java/examples/Makefile.am
index 9766d9b..c6767e6 100644
--- a/java/examples/Makefile.am
+++ b/java/examples/Makefile.am
@@ -23,10 +23,8 @@ EXTRA_DIST = \
InspectVM.java \
guestfs-java.pod
-CLEANFILES = \
- *.class \
- guestfs-java.3 \
- stamp-guestfs-java.pod
+CLEANFILES += \
+ *.class
man_MANS = guestfs-java.3
noinst_DATA = $(top_builddir)/website/guestfs-java.3.html
diff --git a/lua/Makefile.am b/lua/Makefile.am
index 264f170..5c2efca 100644
--- a/lua/Makefile.am
+++ b/lua/Makefile.am
@@ -27,9 +27,7 @@ EXTRA_DIST = \
$(generator_built) \
run-bindtests
-CLEANFILES = \
- *~ \
- bindtests.tmp \
+CLEANFILES += \
guestfs.so
if HAVE_LUA
diff --git a/lua/examples/Makefile.am b/lua/examples/Makefile.am
index dad5793..239f92c 100644
--- a/lua/examples/Makefile.am
+++ b/lua/examples/Makefile.am
@@ -23,10 +23,6 @@ EXTRA_DIST = \
inspect_vm.lua \
guestfs-lua.pod
-CLEANFILES = \
- guestfs-lua.3 \
- stamp-guestfs-lua.pod
-
man_MANS = guestfs-lua.3
noinst_DATA = $(top_builddir)/website/guestfs-lua.3.html
diff --git a/make-fs/Makefile.am b/make-fs/Makefile.am
index ea723af..f4cf0f1 100644
--- a/make-fs/Makefile.am
+++ b/make-fs/Makefile.am
@@ -22,10 +22,6 @@ EXTRA_DIST = \
test-virt-make-fs-docs.sh \
virt-make-fs.pod
-CLEANFILES = \
- stamp-virt-make-fs.pod \
- virt-make-fs.1
-
bin_PROGRAMS = virt-make-fs
SHARED_SOURCE_FILES = \
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index 69df1bc..e93771e 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -26,8 +26,6 @@ EXTRA_DIST = \
JSON_tests.ml \
test-getopt.sh
-CLEANFILES = *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o dll*.so
-
SOURCES_MLI = \
common_utils.mli \
curl.mli \
@@ -245,8 +243,6 @@ check_PROGRAMS += common_utils_tests JSON_tests
TESTS += common_utils_tests JSON_tests
endif
-CLEANFILES += oUnit-*
-
check-valgrind:
$(MAKE) VG="$(top_builddir)/run @VG@" check
@@ -266,6 +262,4 @@ depend: .depend
endif
-DISTCLEANFILES = .depend
-
.PHONY: depend docs
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 501ac69..100b046 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -33,7 +33,7 @@ EXTRA_DIST = \
run-bindtests \
t/*.ml
-CLEANFILES = *.annot *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so
+CLEANFILES += *.so
CLEANFILES += t/*.annot t/*.cmi t/*.cmo t/*.cmx t/*.o t/*.a t/*.so
if HAVE_OCAML
@@ -169,8 +169,6 @@ endif
check-valgrind:
$(MAKE) VG="@VG@" TESTS="$(test_progs_all)" check
-CLEANFILES += bindtests.tmp
-
# Dependencies.
%.cmi: %.mli
$(guestfs_am_v_ocamlc)$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -package unix -c $< -o $@
diff --git a/ocaml/examples/Makefile.am b/ocaml/examples/Makefile.am
index 5f4177c..29c9466 100644
--- a/ocaml/examples/Makefile.am
+++ b/ocaml/examples/Makefile.am
@@ -24,11 +24,8 @@ EXTRA_DIST = \
inspect_vm.ml \
guestfs-ocaml.pod
-CLEANFILES = \
- $(noinst_SCRIPTS) \
- *.cmi *.cmo *.cmx *.o \
- guestfs-ocaml.3 \
- stamp-guestfs-ocaml.pod
+CLEANFILES += \
+ $(noinst_SCRIPTS)
man_MANS = guestfs-ocaml.3
noinst_DATA = $(top_builddir)/website/guestfs-ocaml.3.html
diff --git a/p2v/Makefile.am b/p2v/Makefile.am
index d1dcc34..5cac334 100644
--- a/p2v/Makefile.am
+++ b/p2v/Makefile.am
@@ -40,24 +40,16 @@ EXTRA_DIST = \
# Don't clean ssh_host_rsa_key{,.pub} or id_rsa{,.pub} since those
# consume system entropy to regenerate.
-CLEANFILES = \
+CLEANFILES += \
$(dependencies_files) \
stamp-test-virt-p2v-pxe-data-files \
stamp-test-virt-p2v-pxe-kernel \
- stamp-virt-p2v.pod \
- stamp-virt-p2v-make-disk.pod \
- stamp-virt-p2v-make-kickstart.pod \
- stamp-virt-p2v-make-kiwi.pod \
test-virt-p2v-pxe.authorized_keys \
test-virt-p2v-pxe.img \
test-virt-p2v-pxe.vmlinuz \
test-virt-p2v-pxe.initramfs \
test-virt-p2v-pxe.sshd_config \
- virt-p2v.1 \
- virt-p2v.img \
- virt-p2v-make-disk.1 \
- virt-p2v-make-kickstart.1 \
- virt-p2v-make-kiwi.1
+ virt-p2v.img
# Although virt-p2v is a regular binary, it is not usually installed
# in /usr/bin since it only functions when contained in an ISO or PXE
diff --git a/perl/Makefile.am b/perl/Makefile.am
index ed35459..f76f3df 100644
--- a/perl/Makefile.am
+++ b/perl/Makefile.am
@@ -34,12 +34,10 @@ EXTRA_DIST = \
t/*.t \
typemap
-DISTCLEANFILES = Build
+DISTCLEANFILES += Build
# Some files are not removed by './Build clean' below.
-CLEANFILES = \
- *.o \
- bindtests.tmp \
+CLEANFILES += \
MYMETA.json \
MYMETA.yml \
pm_to_blib
diff --git a/perl/examples/Makefile.am b/perl/examples/Makefile.am
index c58ef16..7b4c29d 100644
--- a/perl/examples/Makefile.am
+++ b/perl/examples/Makefile.am
@@ -23,10 +23,6 @@ EXTRA_DIST = \
inspect_vm.pl \
guestfs-perl.pod
-CLEANFILES = \
- guestfs-perl.3 \
- stamp-guestfs-perl.pod
-
man_MANS = guestfs-perl.3
noinst_DATA = $(top_builddir)/website/guestfs-perl.3.html
diff --git a/po-docs/Makefile.am b/po-docs/Makefile.am
index 639ed69..ac87615 100644
--- a/po-docs/Makefile.am
+++ b/po-docs/Makefile.am
@@ -35,7 +35,7 @@ EXTRA_DIST = \
$(linguas_not_translated:%=%.po) \
podfiles
-CLEANFILES = po4a.conf
+CLEANFILES += po4a.conf
# Build the final man pages from the translated POD files. Each
# language directory contains a Makefile.am that we need to keep up to
diff --git a/po-docs/language.mk b/po-docs/language.mk
index f7a44f3..3eeb058 100644
--- a/po-docs/language.mk
+++ b/po-docs/language.mk
@@ -21,8 +21,6 @@ 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
diff --git a/podwrapper.pl.in b/podwrapper.pl.in
index e9cafed..8f278de 100755
--- a/podwrapper.pl.in
+++ b/podwrapper.pl.in
@@ -50,8 +50,6 @@ podwrapper.pl - Generate libguestfs documentation from POD input files
--warning general \
$<
touch $@
-
- CLEANFILES += stamp-virt-foo.pod
=head1 DESCRIPTION
diff --git a/python/Makefile.am b/python/Makefile.am
index f77dd17..718a123 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -114,11 +114,10 @@ endif ENABLE_APPLIANCE
endif HAVE_PYTHON
# Extra clean.
-CLEANFILES = \
- *~ *.pyc \
+CLEANFILES += \
+ *.pyc \
examples/*~ examples/*.pyc \
t/*~ t/*.pyc \
- bindtests.tmp \
config.h \
guestfs-internal-all.h \
guestfs-internal-frontend-cleanups.h \
diff --git a/python/examples/Makefile.am b/python/examples/Makefile.am
index fac8301..fc23b91 100644
--- a/python/examples/Makefile.am
+++ b/python/examples/Makefile.am
@@ -23,11 +23,9 @@ EXTRA_DIST = \
inspect_vm.py \
guestfs-python.pod
-CLEANFILES = \
+CLEANFILES += \
*.pyc \
- *.pyo \
- guestfs-python.3 \
- stamp-guestfs-python.pod
+ *.pyo
man_MANS = guestfs-python.3
noinst_DATA = $(top_builddir)/website/guestfs-python.3.html
diff --git a/rescue/Makefile.am b/rescue/Makefile.am
index 58564dc..c2545bd 100644
--- a/rescue/Makefile.am
+++ b/rescue/Makefile.am
@@ -23,10 +23,6 @@ EXTRA_DIST = \
test-virt-rescue-suggest.sh \
virt-rescue.pod
-CLEANFILES = \
- stamp-virt-rescue.pod \
- virt-rescue.1
-
bin_PROGRAMS = virt-rescue
SHARED_SOURCE_FILES = \
diff --git a/resize/Makefile.am b/resize/Makefile.am
index 9a725d3..678700b 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -23,8 +23,6 @@ EXTRA_DIST = \
test-virt-resize-docs.sh \
virt-resize.pod
-CLEANFILES = *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o virt-resize
-
SOURCES_MLI =
SOURCES_ML = \
@@ -108,10 +106,6 @@ stamp-virt-resize.pod: virt-resize.pod
$<
touch $@
-CLEANFILES += \
- stamp-virt-resize.pod \
- virt-resize.1
-
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
@@ -143,6 +137,4 @@ depend: .depend
endif
-DISTCLEANFILES = .depend
-
.PHONY: depend docs
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 65c0ff8..b78dbc2 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -34,7 +34,7 @@ EXTRA_DIST = \
t/tc_*.rb \
t/test_helper.rb
-CLEANFILES = \
+CLEANFILES += \
lib/*~ \
t/*~ \
ext/guestfs/*~ \
diff --git a/ruby/examples/Makefile.am b/ruby/examples/Makefile.am
index 6150b80..6ba2481 100644
--- a/ruby/examples/Makefile.am
+++ b/ruby/examples/Makefile.am
@@ -23,10 +23,6 @@ EXTRA_DIST = \
inspect_vm.rb \
guestfs-ruby.pod
-CLEANFILES = \
- guestfs-ruby.3 \
- stamp-guestfs-ruby.pod
-
man_MANS = guestfs-ruby.3
noinst_DATA = $(top_builddir)/website/guestfs-ruby.3.html
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index 5e42f0b..aadc881 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
@@ -25,8 +25,6 @@ EXTRA_DIST = \
test-virt-sparsify-in-place-fstrim-unsupported.sh \
virt-sparsify.pod
-CLEANFILES = *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o virt-sparsify
-
SOURCES_MLI = \
cmdline.mli
@@ -113,10 +111,6 @@ stamp-virt-sparsify.pod: virt-sparsify.pod
$<
touch $@
-CLEANFILES += \
- stamp-virt-sparsify.pod \
- virt-sparsify.1
-
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
@@ -150,6 +144,4 @@ depend: .depend
endif
-DISTCLEANFILES = .depend
-
.PHONY: depend docs
diff --git a/src/Makefile.am b/src/Makefile.am
index 29586f4..8150d99 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,8 +19,6 @@ include $(top_srcdir)/subdir-rules.mk
noinst_PROGRAMS =
-CLEANFILES = stamp-guestfs.pod
-
generator_built = \
guestfs_protocol.x \
guestfs.h \
@@ -59,7 +57,6 @@ BUILT_SOURCES = \
EXTRA_DIST = \
$(BUILT_SOURCES) \
MAX_PROC_NR \
- libguestfs.3 \
libguestfs.pc.in \
guestfs.pod
@@ -311,3 +308,10 @@ stamp-guestfs.pod: guestfs.pod \
--license LGPLv2+ \
$<
touch $@
+
+# The only reason we have to generate this from the Makefile is
+# because the global CLEANFILES rule deletes it.
+libguestfs.3: Makefile.am
+ rm -f $@ $@-t
+ echo '.so man3/guestfs.3' > $@-t
+ mv $@-t $@
diff --git a/src/libguestfs.3 b/src/libguestfs.3
deleted file mode 100644
index 548f8cd..0000000
--- a/src/libguestfs.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/guestfs.3
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index a000735..64b9377 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -26,12 +26,6 @@ EXTRA_DIST = \
test-virt-sysprep-script.sh \
virt-sysprep.pod
-CLEANFILES = \
- *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o \
- stamp-virt-sysprep.pod \
- virt-sysprep \
- virt-sysprep.1
-
# Filenames sysprep_operation_<name>.ml in alphabetical order.
operations = \
abrt_data \
@@ -217,6 +211,4 @@ depend: .depend
endif
-DISTCLEANFILES = .depend
-
.PHONY: depend docs
diff --git a/test-data/Makefile.am b/test-data/Makefile.am
index 0c37c97..93d094a 100644
--- a/test-data/Makefile.am
+++ b/test-data/Makefile.am
@@ -89,7 +89,7 @@ image_files = \
noinst_DATA = test.iso
-CLEANFILES = test.iso
+CLEANFILES += test.iso
test.iso: $(images_files)
rm -rf d
diff --git a/test-data/blank-disks/Makefile.am b/test-data/blank-disks/Makefile.am
index 2464869..aa20358 100644
--- a/test-data/blank-disks/Makefile.am
+++ b/test-data/blank-disks/Makefile.am
@@ -28,7 +28,7 @@ files = \
noinst_DATA = $(files)
-CLEANFILES = $(files)
+CLEANFILES += $(files)
# Blank disk images in various sizes and formats.
blank-disk-1s.raw:
diff --git a/test-data/fake-virtio-win/Makefile.am b/test-data/fake-virtio-win/Makefile.am
index 87cc45e..33470fb 100644
--- a/test-data/fake-virtio-win/Makefile.am
+++ b/test-data/fake-virtio-win/Makefile.am
@@ -595,7 +595,7 @@ EXTRA_DIST = $(drivers) $(cd_files)
check_DATA = fake-virtio-win.iso
-CLEANFILES = fake-virtio-win.iso
+CLEANFILES += fake-virtio-win.iso
fake-virtio-win.iso: $(cd_files)
$(GENISOIMAGE) -J -r -o $@ cd
diff --git a/test-data/files/Makefile.am b/test-data/files/Makefile.am
index bef21e6..b32eb0b 100644
--- a/test-data/files/Makefile.am
+++ b/test-data/files/Makefile.am
@@ -42,7 +42,7 @@ noinst_DATA = \
lib-i586.so.xz \
test-grep.txt.gz
-CLEANFILES = $(noinst_DATA)
+CLEANFILES += $(noinst_DATA)
100kallzeroes:
rm -f $@ $@-t
diff --git a/test-data/phony-guests/Makefile.am b/test-data/phony-guests/Makefile.am
index 5a56960..1439b3e 100644
--- a/test-data/phony-guests/Makefile.am
+++ b/test-data/phony-guests/Makefile.am
@@ -60,7 +60,7 @@ disk_images = \
# time and we need the tools we have built in order to make it.
check_DATA = $(disk_images) guests-all-good.xml
-CLEANFILES = \
+CLEANFILES += \
$(check_DATA) \
guests-all-good.xml \
stamp-fedora-md.img
@@ -150,7 +150,7 @@ windows-system: windows-system.reg
hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SYSTEM' $<
mv $@-t $@
-DISTCLEANFILES = \
+DISTCLEANFILES += \
fedora-name.db \
fedora-packages.db \
windows-software \
diff --git a/test-tool/Makefile.am b/test-tool/Makefile.am
index 5177942..b1a0325 100644
--- a/test-tool/Makefile.am
+++ b/test-tool/Makefile.am
@@ -19,8 +19,6 @@ include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = libguestfs-test-tool.pod
-CLEANFILES = libguestfs-test-tool.1 stamp-libguestfs-test-tool.pod
-
bin_PROGRAMS = libguestfs-test-tool
man_MANS = libguestfs-test-tool.1
diff --git a/tests/c-api/Makefile.am b/tests/c-api/Makefile.am
index 40fe33e..708c6eb 100644
--- a/tests/c-api/Makefile.am
+++ b/tests/c-api/Makefile.am
@@ -23,7 +23,7 @@ BUILT_SOURCES = $(generator_built)
EXTRA_DIST = $(BUILT_SOURCES)
-CLEANFILES = \
+CLEANFILES += \
test.log \
testdownload.tmp
diff --git a/tests/syslinux/Makefile.am b/tests/syslinux/Makefile.am
index bb9a024..7dce671 100644
--- a/tests/syslinux/Makefile.am
+++ b/tests/syslinux/Makefile.am
@@ -27,4 +27,4 @@ EXTRA_DIST = \
$(TESTS) \
test-syslinux.pl
-CLEANFILES = syslinux-guest.img extlinux-guest.img
+CLEANFILES += syslinux-guest.img extlinux-guest.img
diff --git a/tests/xml/Makefile.am b/tests/xml/Makefile.am
index aa57619..d6d2e23 100644
--- a/tests/xml/Makefile.am
+++ b/tests/xml/Makefile.am
@@ -42,5 +42,3 @@ EXTRA_DIST = \
rhbz701814.pl \
rhbz701814-faked.xml \
rhbz701814-node.xml
-
-CLEANFILES = *~
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 8296b37..9dc7c26 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -23,12 +23,6 @@ tools = \
tar \
win-reg
-CLEANFILES = \
- virt-list-filesystems.1 \
- virt-list-partitions.1 \
- virt-tar.1 \
- virt-win-reg.1
-
EXTRA_DIST = \
$(tools:%=virt-%) \
test-virt-*.sh
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index d53e6e6..c0d635a 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -24,8 +24,6 @@ EXTRA_DIST = \
virt-v2v.pod \
virt-v2v-copy-to-local.pod
-CLEANFILES = *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o virt-v2v
-
SOURCES_MLI = \
changeuid.mli \
cmdline.mli \
@@ -231,12 +229,6 @@ stamp-virt-v2v-copy-to-local.pod: virt-v2v-copy-to-local.pod
$<
touch $@
-CLEANFILES += \
- stamp-virt-v2v.pod \
- stamp-virt-v2v-copy-to-local.pod \
- virt-v2v.1 \
- virt-v2v-copy-to-local.1
-
# Tests.
# The virt-v2v tests here are not meant to be thorough tests of guest
@@ -421,8 +413,6 @@ v2v_unit_tests_LINK = \
$(OCAMLLINKFLAGS) \
$(v2v_unit_tests_THEOBJECTS) -o $@
-CLEANFILES += oUnit-*
-
# Dependencies.
depend: .depend
@@ -439,6 +429,4 @@ depend: .depend
endif
-DISTCLEANFILES = .depend
-
.PHONY: depend docs
diff --git a/v2v/test-harness/Makefile.am b/v2v/test-harness/Makefile.am
index 55cd108..a665d3a 100644
--- a/v2v/test-harness/Makefile.am
+++ b/v2v/test-harness/Makefile.am
@@ -24,17 +24,6 @@ EXTRA_DIST = \
$(SOURCES_MLI) $(SOURCES_ML) \
virt-v2v-test-harness.pod
-CLEANFILES = \
- *~ \
- *.a \
- *.annot \
- *.cmi \
- *.cmo \
- *.cmx \
- *.cmxa \
- *.o \
- *.so
-
SOURCES_MLI = \
v2v_test_harness.mli
@@ -133,10 +122,6 @@ stamp-virt-v2v-test-harness.pod: virt-v2v-test-harness.pod
$<
touch $@
-CLEANFILES += \
- stamp-virt-v2v-test-harness.pod \
- virt-v2v-test-harness.1
-
# Dependencies.
depend: .depend
@@ -154,6 +139,4 @@ depend: .depend
endif
endif
-DISTCLEANFILES = .depend
-
.PHONY: depend docs
--
2.7.4
8 years, 4 months
[PATCH] New API: aug_transform
by Pino Toscano
Expose the aug_transform API through the library, so it's possible to
add/remove Augeas transformations to handle files in custom places using
existing lenses.
---
daemon/augeas.c | 21 +++++++++++++++++++++
generator/actions.ml | 12 ++++++++++++
gobject/Makefile.inc | 2 ++
src/MAX_PROC_NR | 2 +-
4 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/daemon/augeas.c b/daemon/augeas.c
index 14cc0cf..5adc959 100644
--- a/daemon/augeas.c
+++ b/daemon/augeas.c
@@ -491,3 +491,24 @@ do_aug_label (const char *augpath)
return ret; /* caller frees */
}
+
+/* Takes optional arguments, consult optargs_bitmask. */
+int
+do_aug_transform (const char *lens, const char *file, int remove)
+{
+ int r;
+ int excl = 0; /* add by default */
+
+ NEED_AUG (-1);
+
+ if (optargs_bitmask & GUESTFS_AUG_TRANSFORM_REMOVE_BITMASK)
+ excl = remove;
+
+ r = aug_transform (aug, lens, file, excl);
+ if (r == -1) {
+ AUGEAS_ERROR ("aug_transform: %s: %s: %s", lens, file, excl ? "excl" : "incl");
+ return -1;
+ }
+
+ return r;
+}
diff --git a/generator/actions.ml b/generator/actions.ml
index eccef00..aa26649 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -13205,6 +13205,18 @@ only the unallocated blocks will be extracted.
This is useful to detect hidden data or to retrieve deleted files
which data units have not been overwritten yet." };
+ { defaults with
+ name = "aug_transform"; added = (1, 35, 2);
+ style = RErr, [String "lens"; String "file"], [ OBool "remove"];
+ proc_nr = Some 469;
+ shortdesc = "add/remove an Augeas lens transformation";
+ longdesc = "\
+Add an Augeas transformation for the specified C<lens> so it can
+handle C<file>.
+
+If C<remove> is true (C<false> by default), then the transformation
+is removed." };
+
]
(* Non-API meta-commands available only in guestfish.
diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc
index 7698c2a..149e4c6 100644
--- a/gobject/Makefile.inc
+++ b/gobject/Makefile.inc
@@ -53,6 +53,7 @@ guestfs_gobject_headers= \
include/guestfs-gobject/optargs-add_drive.h \
include/guestfs-gobject/optargs-add_drive_scratch.h \
include/guestfs-gobject/optargs-add_libvirt_dom.h \
+ include/guestfs-gobject/optargs-aug_transform.h \
include/guestfs-gobject/optargs-btrfs_filesystem_defragment.h \
include/guestfs-gobject/optargs-btrfs_filesystem_resize.h \
include/guestfs-gobject/optargs-btrfs_fsck.h \
@@ -143,6 +144,7 @@ guestfs_gobject_sources= \
src/optargs-add_drive.c \
src/optargs-add_drive_scratch.c \
src/optargs-add_libvirt_dom.c \
+ src/optargs-aug_transform.c \
src/optargs-btrfs_filesystem_defragment.c \
src/optargs-btrfs_filesystem_resize.c \
src/optargs-btrfs_fsck.c \
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 1023289..5ef9d24 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-468
+469
--
2.7.4
8 years, 4 months
[PATCH] virt-rescue rewrite in OCaml
by Maros Zatko
Hi, I tried to rewrite virt-rescue from C to OCaml.
Goals were feature parity with C implementation, smaller codebase and
hopefully better maintainability. I still don't know if I've covered
everything right. So, please check it out.
PS: my git send-email seems to be broken, so I'm sending it from thunderbird
Thanks!
maros
8 years, 4 months