From 369755847b942806efe710b88146311849046017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 10 Jun 2015 13:47:58 +0200 Subject: guix-register: Perform deduplication even when --prefix is passed. Fixes . * nix/guix-register/guix-register.cc (register_validity): Change the (optimize && prefix.empty ()) condition to just (optimize). Change settings.nixStore around the loop. Prepend PREFIX to the argument passed to 'optimisePath'. * tests/guix-register.sh: Use 'guix-register -p' with duplicate files, and make sure they are deduplicated on the target. Adjust existing tests. --- tests/guix-register.sh | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/guix-register.sh b/tests/guix-register.sh index 30bc59a314..360cf55979 100644 --- a/tests/guix-register.sh +++ b/tests/guix-register.sh @@ -56,15 +56,14 @@ guile -c " (exit (= (stat:ino (stat \"$new_file\")) (stat:ino (stat \"$new_file2\"))))" -# Make sure both are valid, and delete them. +# Make sure both are valid. guile -c " (use-modules (guix store)) (define s (open-connection)) (exit (and (valid-path? s \"$new_file\") (valid-path? s \"$new_file2\") (null? (references s \"$new_file\")) - (null? (references s \"$new_file2\")) - (pair? (delete-paths s (list \"$new_file\" \"$new_file2\")))))" + (null? (references s \"$new_file2\"))))" # @@ -98,6 +97,33 @@ guix-register --prefix "$new_store" "$closure" guix-register -p "$new_store" \ --state-directory "$new_store/chbouib" "$closure" +# Register duplicate files. +cp "$new_file" "$new_file2" "$new_store_dir" +guix-register -p "$new_store" <