From bcac69f674ce1525c263632ba796297b850b5147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 24 Aug 2014 14:02:21 +0200 Subject: [PATCH 1/4] gnu: libgcrypt: Update to 1.6.2. * gnu/packages/gnupg.scm (libgcrypt): Update to 1.6.2. --- gnu/packages/gnupg.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm index 3207c74b0b..326a321ca5 100644 --- a/gnu/packages/gnupg.scm +++ b/gnu/packages/gnupg.scm @@ -63,14 +63,14 @@ Daemon and possibly more in the future.") (define-public libgcrypt (package (name "libgcrypt") - (version "1.6.1") + (version "1.6.2") (source (origin (method url-fetch) (uri (string-append "mirror://gnupg/libgcrypt/libgcrypt-" version ".tar.bz2")) (sha256 (base32 - "0w10vhpj1r5nq7qm6jp21p1v1vhf37701cw8yilygzzqd7mfzhx1")))) + "0k2wi34qhp5hq71w1ab3kw1gfsx7xff79bvynqkxp35kls94826y")))) (build-system gnu-build-system) (propagated-inputs `(("libgpg-error" ,libgpg-error))) From c6df09941b9fb225788e9efa276b7aa92e19d3c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 25 Aug 2014 00:16:49 +0200 Subject: [PATCH 2/4] guix-register: By default, attempt to deduplicate registered items. * nix/guix-register/guix-register.cc (GUIX_OPT_DEDUPLICATE): New macro. (options): Add --no-deduplication. (deduplication): New variable. (parse_opt): Handle GUIX_OPT_DEDUPLICATE. (register_validity): Add 'optimize' parameter and honor it. (main): Move 'store' instanatiation after 'settings.nixStore' assignment. * tests/guix-register.sh: Add test for deduplication. * guix/nar.scm (finalize-store-file): Update comment above 'register-path' call. --- guix/nar.scm | 3 +-- nix/guix-register/guix-register.cc | 34 +++++++++++++++++++++++++----- tests/guix-register.sh | 19 +++++++++++++++-- 3 files changed, 47 insertions(+), 9 deletions(-) diff --git a/guix/nar.scm b/guix/nar.scm index 0a7187c2dd..b95cbd648d 100644 --- a/guix/nar.scm +++ b/guix/nar.scm @@ -324,8 +324,7 @@ held." (rename-file source target) ;; Register TARGET. As a side effect, it resets the timestamps of all - ;; its files, recursively. However, it doesn't attempt to deduplicate - ;; its files like 'importPaths' does (FIXME). + ;; its files, recursively, and runs a deduplication pass. (register-path target #:references references #:deriver deriver)) diff --git a/nix/guix-register/guix-register.cc b/nix/guix-register/guix-register.cc index ed5ab23e41..92eedab9f5 100644 --- a/nix/guix-register/guix-register.cc +++ b/nix/guix-register/guix-register.cc @@ -57,6 +57,7 @@ information about which store files are valid, and what their \ references are."; #define GUIX_OPT_STATE_DIRECTORY 1 +#define GUIX_OPT_DEDUPLICATE 2 static const struct argp_option options[] = { @@ -64,6 +65,8 @@ static const struct argp_option options[] = "Open the store that lies under DIRECTORY" }, { "state-directory", GUIX_OPT_STATE_DIRECTORY, "DIRECTORY", 0, "Use DIRECTORY as the state directory of the target store" }, + { "no-deduplication", GUIX_OPT_DEDUPLICATE, 0, 0, + "Disable automatic deduplication of registered store items" }, { 0, 0, 0, 0, 0 } }; @@ -71,6 +74,9 @@ static const struct argp_option options[] = /* Prefix of the store being populated. */ static std::string prefix; +/* Whether to deduplicate the registered store items. */ +static bool deduplication = true; + /* Parse a single option. */ static error_t parse_opt (int key, char *arg, struct argp_state *state) @@ -97,6 +103,10 @@ parse_opt (int key, char *arg, struct argp_state *state) break; } + case GUIX_OPT_DEDUPLICATE: + deduplication = false; + break; + case ARGP_KEY_ARG: { std::ifstream *file; @@ -136,6 +146,7 @@ static struct argp argp = { options, parse_opt, 0, doc }; This is really meant as an internal format. */ static void register_validity (LocalStore *store, std::istream &input, + bool optimize = true, bool reregister = true, bool hashGiven = false, bool canonicalise = true) { @@ -176,6 +187,19 @@ register_validity (LocalStore *store, std::istream &input, } store->registerValidPaths (infos); + + /* XXX: When PREFIX is non-empty, store->linksDir points to the original + store's '.links' directory, which means 'optimisePath' would try to link + to that instead of linking to the target store. Thus, disable + deduplication in this case. */ + if (optimize && prefix.empty ()) + { + /* Make sure deduplication is enabled. */ + settings.autoOptimiseStore = true; + + foreach (ValidPathInfos::const_iterator, i, infos) + store->optimisePath (i->path); + } } @@ -200,17 +224,17 @@ main (int argc, char *argv[]) { argp_parse (&argp, argc, argv, 0, 0, 0); - /* Instantiate the store. This creates any missing directories among - 'settings.nixStore', 'settings.nixDBPath', etc. */ - LocalStore store; - if (!prefix.empty ()) /* Under the --prefix tree, the final name of the store will be NIX_STORE_DIR. Set it here so that the database uses file names prefixed by NIX_STORE_DIR and not PREFIX + NIX_STORE_DIR. */ settings.nixStore = NIX_STORE_DIR; - register_validity (&store, *input); + /* Instantiate the store. This creates any missing directories among + 'settings.nixStore', 'settings.nixDBPath', etc. */ + LocalStore store; + + register_validity (&store, *input, deduplication); } catch (std::exception &e) { diff --git a/tests/guix-register.sh b/tests/guix-register.sh index 3f261d7bef..e99f5c6075 100644 --- a/tests/guix-register.sh +++ b/tests/guix-register.sh @@ -43,13 +43,28 @@ $new_file 0 EOF -# Make sure it's valid, and delete it. +# Register an idendical file, and make sure it gets deduplicated. +new_file2="$new_file-duplicate" +cat "$new_file" > "$new_file2" +guix-register < Date: Sat, 23 Aug 2014 13:40:27 +0400 Subject: [PATCH 3/4] build: Fix typo. * pre-inst-env.in: Fix typo in commentary. --- pre-inst-env.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre-inst-env.in b/pre-inst-env.in index 233dfcc876..92e48c07a1 100644 --- a/pre-inst-env.in +++ b/pre-inst-env.in @@ -21,7 +21,7 @@ # Usage: ./pre-inst-env COMMAND ARG... # # Run COMMAND in a pre-installation environment. Typical use is -# "./pre-inst-env guix-build hello". +# "./pre-inst-env guix build hello". # By default we may end up with absolute directory names that contain '..', # which get into $GUILE_LOAD_PATH, leading to '..' in the module file names From c2815c0f46d16b98559d0498ae683b0e36e25e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 25 Aug 2014 10:27:20 +0200 Subject: [PATCH 4/4] profiles: Handle packages without a 'share/info' directory. Reported by Mark H. Weaver. * guix/profiles.scm (info-dir-file): Handle the case where 'scandir' returns #f. --- guix/profiles.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index bf86624e43..a2c73fd4cd 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -393,7 +393,7 @@ MANIFEST." (define (info-files top) (let ((infodir (string-append top "/share/info"))) (map (cut string-append infodir "/" <>) - (scandir infodir info-file?)))) + (or (scandir infodir info-file?) '())))) (define (install-info info) (zero?