From mboxrd@z Thu Jan 1 00:00:00 1970 From: ng0 Subject: Re: [PATCH 1/3] download: url-fetch/tarball: Make =?utf-8?B?4oCY?= =?utf-8?B?bmFtZeKAmQ==?= truly optional. Date: Sat, 28 Jan 2017 18:22:55 +0000 Message-ID: <87inozvybk.fsf@wasp.i-did-not-set--mail-host-address--so-tickle-me> References: <20170127195924.22959-1-me@tobias.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXXec-0005JO-5I for guix-devel@gnu.org; Sat, 28 Jan 2017 13:23:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXXeY-0004Vg-Tk for guix-devel@gnu.org; Sat, 28 Jan 2017 13:23:14 -0500 Received: from latitanza.investici.org ([82.94.249.234]:54116) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cXXeY-0004Sr-Iq for guix-devel@gnu.org; Sat, 28 Jan 2017 13:23:10 -0500 In-Reply-To: <20170127195924.22959-1-me@tobias.gr> 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: Tobias Geerinckx-Rice , guix-devel@gnu.org I have tested if the changed packages still build, that's all: Tobias Geerinckx-Rice writes: > * guix/download.scm (url-fetch/tarbomb): Fall back to =E2=80=98file-nam= e=E2=80=99 if > =E2=80=98name=E2=80=99 is #f, like the regular =E2=80=98url-fetch=E2=80= =99 does. > * gnu/packages/bioinformatics.scm (muscle)[source]: Remove =E2=80=98fil= e-name=E2=80=99. Builds=E2=80=A6 > * gnu/packages/engineering.scm (fastcap)[source]: Likewise. =E2=80=A6same here > * gnu/packages/scheme.scm (scmutils)[source]: Likewise. =E2=80=A6and here. > --- > > Guix, > > This copies some code from =E2=80=98url-fetch=E2=80=99 to =E2=80=98url-= fetch/tarbomb=E2=80=99, allowing > the latter to be used without a mandatory =E2=80=98file-name=E2=80=99. > > Unless, of course, that was by design. > > I've made the same change to =E2=80=98url-fetch/zipbomb=E2=80=99 in the= next patch. If > there's a more tightly factored way to do this nicely, please let me kn= ow. > > 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/bioinformat= ics.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.sc= m > 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/gj= s/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 =C2=A9 2015 Federico Beffa > ;;; Copyright =C2=A9 2016 Alex Griffin > ;;; Copyright =C2=A9 2016 David Craven > +;;; Copyright =C2=A9 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)) > =20 > (mlet %store-monad ((drv (url-fetch url hash-algo hash > - (string-append "tarbomb-" name) > + (string-append "tarbomb-" > + (or name file-nam= e)) > #: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")= ) > --=20 > 2.9.3 > > --=20 =E2=99=A5=E2=92=B6 ng0 -- https://www.inventati.org/patternsinthechaos/