summaryrefslogtreecommitdiff
path: root/guix/scripts/archive.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-10-19 10:09:28 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-19 10:10:47 +0200
commitc6f8e9dd64feb1ad174201277cf2ad0784f7d001 (patch)
tree2046cef1ef26ec458c0831fd6ee6156921528350 /guix/scripts/archive.scm
parent1d19bc11620dd0421569712748262f5c411342f8 (diff)
downloadguix-patches-c6f8e9dd64feb1ad174201277cf2ad0784f7d001.tar
guix-patches-c6f8e9dd64feb1ad174201277cf2ad0784f7d001.tar.gz
guix archive: Add '--extract'.
* guix/scripts/archive.scm (show-help, %options): Add --extract. (guix-archive): Honor it. * tests/guix-archive.sh: Test it. * doc/guix.texi (Invoking guix archive): Document it.
Diffstat (limited to 'guix/scripts/archive.scm')
-rw-r--r--guix/scripts/archive.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm
index b120c555e3..1a941d1a73 100644
--- a/guix/scripts/archive.scm
+++ b/guix/scripts/archive.scm
@@ -20,6 +20,7 @@
#:use-module (guix config)
#:use-module (guix utils)
#:use-module ((guix build utils) #:select (mkdir-p))
+ #:use-module ((guix serialization) #:select (restore-file))
#:use-module (guix store)
#:use-module (guix packages)
#:use-module (guix derivations)
@@ -63,6 +64,8 @@ Export/import one or more packages from/to the store.\n"))
--import import from the archive passed on stdin"))
(display (_ "
--missing print the files from stdin that are missing"))
+ (display (_ "
+ -x, --extract=DIR extract the archive on stdin to DIR"))
(newline)
(display (_ "
--generate-key[=PARAMETERS]
@@ -119,6 +122,9 @@ Export/import one or more packages from/to the store.\n"))
(option '("missing") #f #f
(lambda (opt name arg result)
(alist-cons 'missing #t result)))
+ (option '("extract" #\x) #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'extract arg result)))
(option '("generate-key") #f #t
(lambda (opt name arg result)
(catch 'gcry-error
@@ -328,6 +334,10 @@ the input port."
(missing (remove (cut valid-path? store <>)
files)))
(format #t "~{~a~%~}" missing)))
+ ((assoc-ref opts 'extract)
+ =>
+ (lambda (target)
+ (restore-file (current-input-port) target)))
(else
(leave
(_ "either '--export' or '--import' \