---
src/dpkg.ml | 6 +++++-
src/package_handler.ml | 1 +
src/package_handler.mli | 4 ++++
src/pacman.ml | 2 +-
src/rpm.ml | 2 +-
5 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/dpkg.ml b/src/dpkg.ml
index c28354a..22c4f16 100644
--- a/src/dpkg.ml
+++ b/src/dpkg.ml
@@ -166,7 +166,11 @@ 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
+ let source_path =
+ try List.hd (run_command_get_lines cmd)
+ with Not_found -> path in
+ { ft_path = path; ft_source_path = source_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