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.
This commit is contained in:
Eric Bavier 2015-03-24 10:52:05 -05:00
parent a158484db4
commit 17287d7d47
1 changed files with 6 additions and 2 deletions

View File

@ -335,6 +335,7 @@ corresponds to the arguments expected by `set-path-environment-variable'."
("bzip2" ,(ref '(gnu packages compression) 'bzip2)) ("bzip2" ,(ref '(gnu packages compression) 'bzip2))
("gzip" ,(ref '(gnu packages compression) 'gzip)) ("gzip" ,(ref '(gnu packages compression) 'gzip))
("lzip" ,(ref '(gnu packages compression) 'lzip)) ("lzip" ,(ref '(gnu packages compression) 'lzip))
("unzip" ,(ref '(gnu packages zip) 'unzip))
("patch" ,(ref '(gnu packages base) 'patch)) ("patch" ,(ref '(gnu packages base) 'patch))
("locales" ,(ref '(gnu packages commencement) ("locales" ,(ref '(gnu packages commencement)
'glibc-utf8-locales-final))))) '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") (cond ((string-suffix? "gz" source-file-name) "gzip")
((string-suffix? "bz2" source-file-name) "bzip2") ((string-suffix? "bz2" source-file-name) "bzip2")
((string-suffix? "lz" source-file-name) "lzip") ((string-suffix? "lz" source-file-name) "lzip")
((string-suffix? "zip" source-file-name) "unzip")
(else "xz"))) (else "xz")))
(define original-file-name (define original-file-name
@ -464,8 +466,10 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
(mkdir directory) (mkdir directory)
(copy-recursively #$source directory) (copy-recursively #$source directory)
#t) #t)
(zero? (system* (string-append #$tar "/bin/tar") #$(if (string=? decompression-type "unzip")
"xvf" #$source))) #~(zero? (system* "unzip" #$source))
#~(zero? (system* (string-append #$tar "/bin/tar")
"xvf" #$source))))
(let ((directory (first-file "."))) (let ((directory (first-file ".")))
(format (current-error-port) (format (current-error-port)
"source is under '~a'~%" directory) "source is under '~a'~%" directory)