Hilko Bengen
2014-Mar-10 10:33 UTC
[Libguestfs] [supermin 2/3] Add file.source_path, no functional changes
--- src/dpkg.ml | 3 ++- src/package_handler.ml | 1 + src/package_handler.mli | 4 ++++ src/pacman.ml | 2 +- src/rpm.ml | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dpkg.ml b/src/dpkg.ml index c28354a..5a650b8 100644 --- a/src/dpkg.ml +++ b/src/dpkg.ml @@ -166,7 +166,8 @@ let dpkg_get_all_files pkgs let config try string_prefix "/etc/" path && (lstat path).st_kind = S_REG with Unix_error _ -> false in - { ft_path = path; ft_config = config } + let cmd = sprintf "%s --truename %s" Config.dpkg_divert path in + { ft_path = path; ft_source_path = path; ft_config = config } ) lines let dpkg_download_all_packages pkgs dir diff --git a/src/package_handler.ml b/src/package_handler.ml index 10a9e3d..5aa27ba 100644 --- a/src/package_handler.ml +++ b/src/package_handler.ml @@ -43,6 +43,7 @@ let no_settings type file = { ft_path : string; + ft_source_path : string; ft_config : bool; } diff --git a/src/package_handler.mli b/src/package_handler.mli index 3dcf97e..fa7b396 100644 --- a/src/package_handler.mli +++ b/src/package_handler.mli @@ -74,6 +74,10 @@ type file = { ft_path : string; (** File path. *) + ft_source_path : string; + (** File's source path. dpkg has a mechanism called "dpkg-divert" + can be used to override a package's version of a file. *) + ft_config : bool; (** Flag to indicate this is a configuration file. In some package managers (RPM) this is stored in package metadata. In others diff --git a/src/pacman.ml b/src/pacman.ml index dbaf4c8..6393cfa 100644 --- a/src/pacman.ml +++ b/src/pacman.ml @@ -155,7 +155,7 @@ let pacman_get_all_files pkgs let config try string_prefix "/etc/" path && (lstat path).st_kind = S_REG with Unix_error _ -> false in - { ft_path = path; ft_config = config } + { ft_path = path; ft_source_path = path; ft_config = config } ) lines let pacman_download_all_packages pkgs dir diff --git a/src/rpm.ml b/src/rpm.ml index e022fa5..6e7afdb 100644 --- a/src/rpm.ml +++ b/src/rpm.ml @@ -174,7 +174,7 @@ let rpm_get_all_files pkgs function | [ path; flags ] -> let config = String.contains flags 'c' in - { ft_path = path; ft_config = config } + { ft_path = path; ft_source_path = path; ft_config = config } | _ -> assert false ) lines -- 1.9.0
Richard W.M. Jones
2014-Mar-13 21:35 UTC
Re: [Libguestfs] [supermin 2/3] Add file.source_path, no functional changes
On Mon, Mar 10, 2014 at 11:33:50AM +0100, Hilko Bengen wrote:> diff --git a/src/dpkg.ml b/src/dpkg.ml > index c28354a..5a650b8 100644 > --- a/src/dpkg.ml > +++ b/src/dpkg.ml > @@ -166,7 +166,8 @@ let dpkg_get_all_files pkgs > let config > try string_prefix "/etc/" path && (lstat path).st_kind = S_REG > with Unix_error _ -> false in > - { ft_path = path; ft_config = config } > + let cmd = sprintf "%s --truename %s" Config.dpkg_divert path in > + { ft_path = path; ft_source_path = path; ft_config = config }There must be a mistake here because this always sets ft_source_path ft_path = path. Not sure why the compiler didn't warn that cmd is unused. Is there a new version of the complete patch series? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW