Commit Graph

10 Commits

Author SHA1 Message Date
Ludovic Courtès 8ac0368e5b guix-register: Use C++11 range 'for' loop instead of 'foreach' macro.
* nix/guix-register/guix-register.cc (register_validity): Use C++11 range
  'for' loop instead of 'foreach'.
2015-06-10 13:55:23 +02:00
Ludovic Courtès 369755847b guix-register: Perform deduplication even when --prefix is passed.
Fixes <http://bugs.gnu.org/19044>.

* 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.
2015-06-10 13:47:58 +02:00
Ludovic Courtès 47e643db10 guix-register: Do not attempt to create NIX_STORE_DIR.
Fixes <http://bugs.gnu.org/18689>.
Reported by Philip Woods <elzairthesorcerer@gmail.com>.

* nix/guix-register/guix-register.cc (main): Move 'store' instantiation
  above 'settings.nixStore' assignment.
2014-11-02 21:38:23 +01:00
Ludovic Courtès c6df09941b 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.
2014-08-25 00:16:49 +02:00
Ludovic Courtès 689142cd75 guix-register: Add '--state-directory' parameter.
* nix/guix-register/guix-register.cc (GUIX_OPT_STATE_DIRECTORY): New
  macro.
  (parse_opt): Honor it.
* tests/guix-register.sh: Add test with '--state-directory'.
* guix/store.scm (register-path): Add #:state-directory parameter.
2014-07-18 20:40:51 +02:00
Ludovic Courtès 1ddbd9fd71 guix-register: Add explicit libgcrypt initialization.
* nix/guix-register/guix-register.cc (main): Add calls to
  'gcry_check_version' and 'gcry_control', to appease libgcrypt.
2014-06-29 23:53:18 +02:00
Ludovic Courtès 349fd3b11f 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.
2014-01-24 00:01:49 +01:00
Ludovic Courtès 923206f79b guix-register: Allow the initial directory creation to proceed.
This fixes a bug whereby 'guix-register' would bail out when trying to
create NIX_STORE_DIR/.links when NIX_STORE_DIR is read-only.

* nix/guix-register/guix-register.cc (parse_opt): Initialize
  'settings.nixStore' to PREFIX + NIX_STORE_DIR.
  (main): Change 'settings.nixStore' once the 'LocalStore' has been
  instantiated.
2013-09-24 23:40:49 +02:00
Ludovic Courtès caf96debc2 guix-register: Expect closures to refer to the original store.
* nix/guix-register/guix-register.cc (prefix): New variable.
  (parse_opt): Use it.
  (register_validity): Change 'info.path' to the final store name.
  Hash the final under its real path.
* tests/guix-register.sh: Adjust the contents of $closure accordingly.
  Rename 'NIX_LOCALSTATE_DIR' to 'NIX_STATE_DIR'.  Don't try to call
  'valid-path?'.  Add test using 'sqlite3'.
2013-09-23 23:56:35 +02:00
Ludovic Courtès a7a4e6a4f7 Add 'guix-register'.
* nix/guix-register/guix-register.cc, tests/guix-register.sh: New
  files.
* Makefile.am (SH_TESTS)[BUILD_DAEMON]: Add tests/guix-register.sh.
* daemon.am (sbin_PROGRAMS, guix_register_SOURCES,
  guix_register_CPPFLAGS, guix_register_LDADD): New variables.
* test-env.in: Export 'storedir', 'prefix', 'datarootdir', 'datadir',
  and 'localstatedir'.
2013-09-23 00:33:50 +02:00