From 689142cd759457f375230a00dc719ddc00dc2fe4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 18 Jul 2014 11:03:50 +0200 Subject: 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. --- nix/guix-register/guix-register.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'nix') diff --git a/nix/guix-register/guix-register.cc b/nix/guix-register/guix-register.cc index 4aee4fde34..ed5ab23e41 100644 --- a/nix/guix-register/guix-register.cc +++ b/nix/guix-register/guix-register.cc @@ -56,10 +56,14 @@ from an existing store. It updates the new store's database with \ information about which store files are valid, and what their \ references are."; +#define GUIX_OPT_STATE_DIRECTORY 1 + static const struct argp_option options[] = { { "prefix", 'p', "DIRECTORY", 0, "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" }, { 0, 0, 0, 0, 0 } }; @@ -84,6 +88,15 @@ parse_opt (int key, char *arg, struct argp_state *state) break; } + case GUIX_OPT_STATE_DIRECTORY: + { + string state_dir = canonPath (arg); + + settings.nixStateDir = state_dir; + settings.nixDBPath = state_dir + "/db"; + break; + } + case ARGP_KEY_ARG: { std::ifstream *file; -- cgit 1.4.1