summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Bavier <bavier@member.fsf.org>2015-03-24 10:52:05 -0500
committerEric Bavier <bavier@member.fsf.org>2015-03-24 15:59:30 -0500
commit17287d7d47567aa1649250182e0f7ab11d5d55d1 (patch)
tree4a3e5a633d45904917568059518bce2941515158
parenta158484db41f1662032609da61cd3ae9f292607b (diff)
downloadguix-17287d7d47567aa1649250182e0f7ab11d5d55d1.tar.gz
packages: Add zip archive support to 'patch-and-repack'.
Fixes <http://bugs.gnu.org/19830>.

* guix/packages.scm (%standard-patch-inputs): Add "unzip".
  (patch-and-repack)[decompression-type]: Detect zip archive.
  [build]: Invoke "unzip" when appropriate.
-rw-r--r--guix/packages.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index ca9d3a9fb1..99fbd24cb6 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -335,6 +335,7 @@ corresponds to the arguments expected by `set-path-environment-variable'."
       ("bzip2" ,(ref '(gnu packages compression) 'bzip2))
       ("gzip"  ,(ref '(gnu packages compression) 'gzip))
       ("lzip"  ,(ref '(gnu packages compression) 'lzip))
+      ("unzip" ,(ref '(gnu packages zip) 'unzip))
       ("patch" ,(ref '(gnu packages base) 'patch))
       ("locales" ,(ref '(gnu packages commencement)
                        'glibc-utf8-locales-final)))))
@@ -384,6 +385,7 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
     (cond ((string-suffix? "gz" source-file-name)  "gzip")
           ((string-suffix? "bz2" source-file-name) "bzip2")
           ((string-suffix? "lz" source-file-name)  "lzip")
+          ((string-suffix? "zip" source-file-name) "unzip")
           (else "xz")))
 
   (define original-file-name
@@ -464,8 +466,10 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
                      (mkdir directory)
                      (copy-recursively #$source directory)
                      #t)
-                   (zero? (system* (string-append #$tar "/bin/tar")
-                                   "xvf" #$source)))
+                   #$(if (string=? decompression-type "unzip")
+                         #~(zero? (system* "unzip" #$source))
+                         #~(zero? (system* (string-append #$tar "/bin/tar")
+                                           "xvf" #$source))))
                (let ((directory (first-file ".")))
                  (format (current-error-port)
                          "source is under '~a'~%" directory)