summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-01-11 16:55:04 +0100
committerLudovic Courtès <ludo@gnu.org>2014-01-24 00:01:49 +0100
commit349fd3b11f320453ad8eeb3031621d0ffcaf078d (patch)
tree31cabce1d4fc986e2b43cb0af94844a3b6db90f7 /tests
parent5674a3fdb6b4b0f744e2339167d415d8a7a265a0 (diff)
downloadguix-349fd3b11f320453ad8eeb3031621d0ffcaf078d.tar.gz
guix-register: Support registration in the current store, without '--prefix'.
* nix/guix-register/guix-register.cc (register_validity): Leave
  'info.path' unmodified when PREFIX is empty.
  (main): Call 'settings.processEnvironment' early on.
  Leave 'settings.nixStore' unmodified when PREFIX is empty.
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-register.sh29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/guix-register.sh b/tests/guix-register.sh
index ca28fb0d95..ee633af4f9 100644
--- a/tests/guix-register.sh
+++ b/tests/guix-register.sh
@@ -1,5 +1,5 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
 #
 # This file is part of GNU Guix.
 #
@@ -29,6 +29,33 @@ rm -rf "$new_store"
 exit_hook=":"
 trap "chmod -R +w $new_store ; rm -rf $new_store $closure ; \$exit_hook" EXIT
 
+#
+# Registering items in the current store---i.e., without '--prefix'.
+#
+
+new_file="$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-guix-register-$$"
+echo "Fake store file to test registration." > "$new_file"
+
+# Register the file with zero references and no deriver.
+guix-register <<EOF
+$new_file
+
+0
+EOF
+
+# Make sure it's valid, and delete it.
+guile -c "
+   (use-modules (guix store))
+   (define s (open-connection))
+   (exit (and (valid-path? s \"$new_file\")
+              (null? (references s \"$new_file\"))
+              (pair? (delete-paths s (list \"$new_file\")))))"
+
+
+#
+# Registering items in a new store, with '--prefix'.
+#
+
 mkdir -p "$new_store/$storedir"
 new_store_dir="`cd "$new_store/$storedir" ; pwd`"
 new_store="`cd "$new_store" ; pwd`"