From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tobias Geerinckx-Rice Subject: [PATCH 1/3] =?UTF-8?q?download:=20url-fetch/tarball:=20Make=20?= =?UTF-8?q?=E2=80=98name=E2=80=99=20truly=20optional.?= Date: Fri, 27 Jan 2017 20:59:22 +0100 Message-ID: <20170127195924.22959-1-me@tobias.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXCfm-0001Ii-If for guix-devel@gnu.org; Fri, 27 Jan 2017 14:59:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXCfl-00044v-FN for guix-devel@gnu.org; Fri, 27 Jan 2017 14:59:02 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:50523) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cXCfl-00041W-6p for guix-devel@gnu.org; Fri, 27 Jan 2017 14:59:01 -0500 Received: from v5.telenet.be (ptr-1poeq1h8akcsqvdfjmz.18120a2.ip6.access.telenet.be [IPv6:2a02:1810:3919:8200:25e5:54df:1e44:ba2b]) (Authenticated sender: me@tobias.gr) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id AA0CB172095 for ; Fri, 27 Jan 2017 20:58:58 +0100 (CET) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * guix/download.scm (url-fetch/tarbomb): Fall back to ‘file-name’ if ‘name’ is #f, like the regular ‘url-fetch’ does. * gnu/packages/bioinformatics.scm (muscle)[source]: Remove ‘file-name’. * gnu/packages/engineering.scm (fastcap)[source]: Likewise. * gnu/packages/scheme.scm (scmutils)[source]: Likewise. --- Guix, This copies some code from ‘url-fetch’ to ‘url-fetch/tarbomb’, allowing the latter to be used without a mandatory ‘file-name’. Unless, of course, that was by design. I've made the same change to ‘url-fetch/zipbomb’ in the next patch. If there's a more tightly factored way to do this nicely, please let me know. Kind regards, T G-R gnu/packages/bioinformatics.scm | 1 - gnu/packages/engineering.scm | 1 - gnu/packages/scheme.scm | 1 - guix/download.scm | 12 ++++++++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index 3bf3521..2d6cef2 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm @@ -3501,7 +3501,6 @@ that a read originated from a particular isoform.") (version "3.8.1551") (source (origin (method url-fetch/tarbomb) - (file-name (string-append name "-" version)) (uri (string-append "http://www.drive5.com/muscle/muscle_src_" version ".tar.gz")) diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm index b147764..734efcd 100644 --- a/gnu/packages/engineering.scm +++ b/gnu/packages/engineering.scm @@ -259,7 +259,6 @@ featuring various improvements and bug fixes."))) (version "2.0-18Sep92") (source (origin (method url-fetch/tarbomb) - (file-name (string-append name "-" version ".tar.gz")) (uri (string-append "http://www.rle.mit.edu/cpg/codes/" name "-" version ".tgz")) (sha256 diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm index 2756805..1210ab5 100644 --- a/gnu/packages/scheme.scm +++ b/gnu/packages/scheme.scm @@ -604,7 +604,6 @@ threads.") (snippet ;; Remove binary code '(delete-file-recursively "scmutils/mit-scheme")) - (file-name (string-append name "-" version ".tar.gz")) (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946" "/scmutils-tarballs/" name "-" version "-x86-64-gnu-linux.tar.gz")) diff --git a/guix/download.scm b/guix/download.scm index e2e5cee..e218c2e 100644 --- a/guix/download.scm +++ b/guix/download.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2015 Federico Beffa ;;; Copyright © 2016 Alex Griffin ;;; Copyright © 2016 David Craven +;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -485,17 +486,24 @@ in the store." (guile (default-guile))) "Similar to 'url-fetch' but unpack the file from URL in a directory of its own. This helper makes it easier to deal with \"tar bombs\"." + (define file-name + (match url + ((head _ ...) + (basename head)) + (_ + (basename url)))) (define gzip (module-ref (resolve-interface '(gnu packages compression)) 'gzip)) (define tar (module-ref (resolve-interface '(gnu packages base)) 'tar)) (mlet %store-monad ((drv (url-fetch url hash-algo hash - (string-append "tarbomb-" name) + (string-append "tarbomb-" + (or name file-name)) #:system system #:guile guile))) ;; Take the tar bomb, and simply unpack it as a directory. - (gexp->derivation name + (gexp->derivation (or name file-name) #~(begin (mkdir #$output) (setenv "PATH" (string-append #$gzip "/bin")) -- 2.9.3