---
src/dpkg.ml | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/dpkg.ml b/src/dpkg.ml
index 2e3a198..8f92f7f 100644
--- a/src/dpkg.ml
+++ b/src/dpkg.ml
@@ -131,18 +131,20 @@ let dpkg_get_all_requires pkgs =
in
loop pkgs
+let dpkg_diversions = Hashtbl.create 13
let dpkg_get_all_files pkgs =
- let cmd = sprintf "%s --list" Config.dpkg_divert in
- let lines = run_command_get_lines cmd in
- let diversions = Hashtbl.create (List.length lines) in
- List.iter (
- fun line ->
- let items = string_split " " line in
- match items with
- | ["diversion"; "of"; path; "to"; real_path;
"by"; pkg] ->
- Hashtbl.add diversions path real_path
- | _ -> ()
- ) lines;
+ if Hashtbl.length dpkg_diversions = 0 then (
+ let cmd = sprintf "%s --list" Config.dpkg_divert in
+ let lines = run_command_get_lines cmd in
+ List.iter (
+ fun line ->
+ let items = string_split " " line in
+ match items with
+ | ["diversion"; "of"; path; "to"; real_path;
"by"; pkg] ->
+ Hashtbl.add dpkg_diversions path real_path
+ | _ -> ()
+ ) lines
+ );
let cmd =
sprintf "%s --listfiles %s | grep '^/' | grep -v '^/.$' | sort
-u"
Config.dpkg_query
@@ -155,7 +157,7 @@ let dpkg_get_all_files pkgs =
try string_prefix "/etc/" path && (lstat path).st_kind = S_REG
with Unix_error _ -> false in
let source_path =
- try Hashtbl.find diversions path
+ try Hashtbl.find dpkg_diversions path
with Not_found -> path in
{ ft_path = path; ft_source_path = source_path; ft_config = config }
) lines
--
1.9.0