all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional.
@ 2017-01-27 19:59 Tobias Geerinckx-Rice
  2017-01-27 19:59 ` [PATCH 2/3] download: Add ‘url-fetch/zipbomb’ Tobias Geerinckx-Rice
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Tobias Geerinckx-Rice @ 2017-01-27 19:59 UTC (permalink / raw)
  To: guix-devel

* 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 <beffa@fbengineering.ch>
 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
+;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; 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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] download: Add ‘url-fetch/zipbomb’.
  2017-01-27 19:59 [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional Tobias Geerinckx-Rice
@ 2017-01-27 19:59 ` Tobias Geerinckx-Rice
  2017-01-28 17:55   ` ng0
  2017-01-30 22:52   ` Ludovic Courtès
  2017-01-27 19:59 ` [PATCH 3/3] gnu: Add zpaq Tobias Geerinckx-Rice
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 11+ messages in thread
From: Tobias Geerinckx-Rice @ 2017-01-27 19:59 UTC (permalink / raw)
  To: guix-devel

From this suggestion by Ludovic Courtès:
<http://lists.gnu.org/archive/html/guix-devel/2016-09/msg01983.html>

* guix/download.scm (url-fetch/zipbomb): New procedure.
---
 guix/download.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/guix/download.scm b/guix/download.scm
index e218c2e..80efb9d 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -36,6 +36,7 @@
   #:export (%mirrors
             url-fetch
             url-fetch/tarbomb
+            url-fetch/zipbomb
             download-to-store))
 
 ;;; Commentary:
@@ -512,6 +513,35 @@ own.  This helper makes it easier to deal with \"tar bombs\"."
                                           "xf" #$drv)))
                       #:local-build? #t)))
 
+(define* (url-fetch/zipbomb url hash-algo hash
+                            #:optional name
+                            #:key (system (%current-system))
+                            (guile (default-guile)))
+  "Similar to 'url-fetch' but unpack the zip file at URL in a directory of its
+own.  This helper makes it easier to deal with \"zip bombs\"."
+  (define file-name
+    (match url
+      ((head _ ...)
+       (basename head))
+      (_
+       (basename url))))
+  (define unzip
+    (module-ref (resolve-interface '(gnu packages zip)) 'unzip))
+
+  (mlet %store-monad ((drv (url-fetch url hash-algo hash
+                                      (string-append "zipbomb-"
+                                                     (or name file-name))
+                                      #:system system
+                                      #:guile guile)))
+    ;; Take the zip bomb, and simply unpack it as a directory.
+    (gexp->derivation (or name file-name)
+                      #~(begin
+                          (mkdir #$output)
+                          (chdir #$output)
+                          (zero? (system* (string-append #$unzip "/bin/unzip")
+                                          #$drv)))
+                      #:local-build? #t)))
+
 (define* (download-to-store store url #:optional (name (basename url))
                             #:key (log (current-error-port)) recursive?
                             (verify-certificate? #t))
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] gnu: Add zpaq.
  2017-01-27 19:59 [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional Tobias Geerinckx-Rice
  2017-01-27 19:59 ` [PATCH 2/3] download: Add ‘url-fetch/zipbomb’ Tobias Geerinckx-Rice
@ 2017-01-27 19:59 ` Tobias Geerinckx-Rice
  2017-01-28 17:51   ` ng0
  2017-01-30 22:54   ` Ludovic Courtès
  2017-01-28 18:22 ` [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional ng0
  2017-01-30 22:51 ` Ludovic Courtès
  3 siblings, 2 replies; 11+ messages in thread
From: Tobias Geerinckx-Rice @ 2017-01-27 19:59 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/compression.scm (zpaq): New variable.
---
 gnu/packages/compression.scm | 60 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 59 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index 2e4de81..ca5509c 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -10,7 +10,7 @@
 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
 ;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
-;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016, 2017 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
 ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
@@ -46,6 +46,8 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages valgrind)
+  #:use-module (gnu packages zip)
+  #:use-module (ice-9 match)
   #:use-module ((srfi srfi-1) #:select (last)))
 
 (define-public zlib
@@ -1001,3 +1003,59 @@ handles the 7z format which features very high compression ratios.")
     (description "gzstream is a small library for providing zlib
 functionality in a C++ iostream.")
     (license license:lgpl2.1+)))
+
+(define-public zpaq
+  (package
+    (name "zpaq")
+    (version "7.15")
+    (source
+     (origin
+       (method url-fetch/zipbomb)
+       (uri (string-append "http://mattmahoney.net/dc/zpaq"
+                           (string-delete #\. version) ".zip"))
+       (sha256
+        (base32
+         "066l94yyladlfzri877nh2dhkvspagjn3m5bmv725fmhkr9c4pp8"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; Delete irrelevant pre-compiled binaries.
+        '(for-each delete-file (find-files "." "\\.exe$")))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure))           ; no ‘configure’ script
+       #:make-flags
+       (list
+        (string-append "CPPFLAGS=-Dunix"
+                       ,(match (or (%current-target-system)
+                                   (%current-system))
+                               ("x86_64-linux"	"")
+                               ("i686-linux"    "")
+                               (_               " -DNOJIT")))
+        (string-append "CXXFLAGS=-O3 -mtune=generic -DNDEBUG"
+                       ,(match (or (%current-target-system)
+                                   (%current-system))
+                               ("x86_64-linux"  " -march=nocona")
+                               ("i686-linux"    " -march=i686")
+                               (_               "")))
+        (string-append "PREFIX="
+                       (assoc-ref %outputs "out")))))
+    (native-inputs
+     `(("perl" ,perl)))                 ; for pod2man
+    (home-page "http://mattmahoney.net/dc/zpaq.html")
+    (synopsis "Incremental journaling archiver")
+    (description "ZPAQ is a command-line archiver that backs up faster and
+compresses better than most other popular archivers in realistic situations
+with many duplicate and already compressed files.  It backs up only those files
+modified since the last update.  All previous versions remain untouched and can
+be independently recovered.  Identical files are only stored once (known as
+@dfn{de-duplication}).  Archives can also be encrypted.
+ZPAQ is intended to back up user data, not entire operating systems. It ignores
+owner and group IDs, ACLs, extended attributes, or special file types like
+devices, sockets, or named pipes.  It does not follow or restore symbolic links
+or junctions, and always follows hard links.")
+    (license (list license:public-domain
+                   ;; libzpaq.cpp contains a mix of public-domain and
+                   ;; expat-licenced (or ‘MIT’) code.
+                   license:expat))))
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] gnu: Add zpaq.
  2017-01-27 19:59 ` [PATCH 3/3] gnu: Add zpaq Tobias Geerinckx-Rice
@ 2017-01-28 17:51   ` ng0
  2017-01-28 18:02     ` Tobias Geerinckx-Rice
  2017-01-30 22:54   ` Ludovic Courtès
  1 sibling, 1 reply; 11+ messages in thread
From: ng0 @ 2017-01-28 17:51 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice, guix-devel

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> * gnu/packages/compression.scm (zpaq): New variable.
> ---

Cool! Thanks for working on it.

Functionality seems okay:
  ...Creating an archive:

ng0@wasp /g/s/q/bin> ./zpaq a /home/ng0/test.zpaq /home/ng0/News
Creating /home/ng0/test.zpaq at offset 0 + 0
Adding 0.000000 MB in 0 files -method 14 -threads 2 at 2017-01-28
17:45:52.
+ /home/ng0/News/
+ /home/ng0/News/drafts/
+ /home/ng0/News/drafts/drafts/
+ /home/ng0/News/drafts/queue/
4 +added, 0 -removed.

0.000000 + (0.000000 -> 0.000000 -> 0.000584) = 0.000584 MB
0.014 seconds (all OK)

  ...and listing its content:

ng0@wasp /g/s/q/bin> ./zpaq l /home/ng0/test.zpaq
zpaq v7.15 journaling archiver, compiled Jan 28 2017
/home/ng0/test.zpaq: 1 versions, 4 files, 0 fragments, 0.000584
MB

- 2016-10-27 14:27:19            0 d0755 /home/ng0/News/
- 2016-10-27 14:27:19            0 d0755 /home/ng0/News/drafts/
- 2016-11-21 11:19:39            0 d0755
- /home/ng0/News/drafts/drafts/
- 2016-10-27 14:27:19            0 d0755
- /home/ng0/News/drafts/queue/

0.000000 MB of 0.000000 MB (4 files) shown
  -> 0.000000 MB (0 refs to 0 of 0 frags) after dedupe
  -> 0.000584 MB compressed.
0.001 seconds (all OK)
    

>  gnu/packages/compression.scm | 60 +++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 59 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
> index 2e4de81..ca5509c 100644
> --- a/gnu/packages/compression.scm
> +++ b/gnu/packages/compression.scm
> @@ -10,7 +10,7 @@
>  ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
>  ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
>  ;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
> -;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
> +;;; Copyright © 2016, 2017 Tobias Geerinckx-Rice <me@tobias.gr>
>  ;;; Copyright © 2016 David Craven <david@craven.ch>
>  ;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
>  ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
> @@ -46,6 +46,8 @@
>    #:use-module (gnu packages perl)
>    #:use-module (gnu packages pkg-config)
>    #:use-module (gnu packages valgrind)
> +  #:use-module (gnu packages zip)
> +  #:use-module (ice-9 match)
>    #:use-module ((srfi srfi-1) #:select (last)))
>  
>  (define-public zlib
> @@ -1001,3 +1003,59 @@ handles the 7z format which features very high compression ratios.")
>      (description "gzstream is a small library for providing zlib
>  functionality in a C++ iostream.")
>      (license license:lgpl2.1+)))
> +
> +(define-public zpaq
> +  (package
> +    (name "zpaq")
> +    (version "7.15")
> +    (source
> +     (origin
> +       (method url-fetch/zipbomb)
> +       (uri (string-append "http://mattmahoney.net/dc/zpaq"
> +                           (string-delete #\. version) ".zip"))
> +       (sha256
> +        (base32
> +         "066l94yyladlfzri877nh2dhkvspagjn3m5bmv725fmhkr9c4pp8"))
> +       (modules '((guix build utils)))
> +       (snippet
> +        ;; Delete irrelevant pre-compiled binaries.
> +        '(for-each delete-file (find-files "." "\\.exe$")))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure))           ; no ‘configure’ script
> +       #:make-flags
> +       (list
> +        (string-append "CPPFLAGS=-Dunix"
> +                       ,(match (or (%current-target-system)
> +                                   (%current-system))
> +                               ("x86_64-linux"	"")
> +                               ("i686-linux"    "")
> +                               (_               " -DNOJIT")))
> +        (string-append "CXXFLAGS=-O3 -mtune=generic -DNDEBUG"
> +                       ,(match (or (%current-target-system)
> +                                   (%current-system))
> +                               ("x86_64-linux"  " -march=nocona")
> +                               ("i686-linux"    " -march=i686")
> +                               (_               "")))

Can you add a comment on the CPPFLAGS?
Otherwise, LGTM!

> +        (string-append "PREFIX="
> +                       (assoc-ref %outputs "out")))))
> +    (native-inputs
> +     `(("perl" ,perl)))                 ; for pod2man
> +    (home-page "http://mattmahoney.net/dc/zpaq.html")
> +    (synopsis "Incremental journaling archiver")
> +    (description "ZPAQ is a command-line archiver that backs up faster and
> +compresses better than most other popular archivers in realistic situations
> +with many duplicate and already compressed files.  It backs up only those files
> +modified since the last update.  All previous versions remain untouched and can
> +be independently recovered.  Identical files are only stored once (known as
> +@dfn{de-duplication}).  Archives can also be encrypted.
> +ZPAQ is intended to back up user data, not entire operating systems. It ignores
> +owner and group IDs, ACLs, extended attributes, or special file types like
> +devices, sockets, or named pipes.  It does not follow or restore symbolic links
> +or junctions, and always follows hard links.")
> +    (license (list license:public-domain
> +                   ;; libzpaq.cpp contains a mix of public-domain and
> +                   ;; expat-licenced (or ‘MIT’) code.
> +                   license:expat))))
> -- 
> 2.9.3
>
>

-- 
♥Ⓐ  ng0 -- https://www.inventati.org/patternsinthechaos/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] download: Add ‘url-fetch/zipbomb’.
  2017-01-27 19:59 ` [PATCH 2/3] download: Add ‘url-fetch/zipbomb’ Tobias Geerinckx-Rice
@ 2017-01-28 17:55   ` ng0
  2017-01-30 22:52   ` Ludovic Courtès
  1 sibling, 0 replies; 11+ messages in thread
From: ng0 @ 2017-01-28 17:55 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice, guix-devel

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> From this suggestion by Ludovic Courtès:
> <http://lists.gnu.org/archive/html/guix-devel/2016-09/msg01983.html>
>
> * guix/download.scm (url-fetch/zipbomb): New procedure.
> ---
>  guix/download.scm | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/guix/download.scm b/guix/download.scm
> index e218c2e..80efb9d 100644
> --- a/guix/download.scm
> +++ b/guix/download.scm
> @@ -36,6 +36,7 @@
>    #:export (%mirrors
>              url-fetch
>              url-fetch/tarbomb
> +            url-fetch/zipbomb
>              download-to-store))
>  
>  ;;; Commentary:
> @@ -512,6 +513,35 @@ own.  This helper makes it easier to deal with \"tar bombs\"."
>                                            "xf" #$drv)))
>                        #:local-build? #t)))
>  
> +(define* (url-fetch/zipbomb url hash-algo hash
> +                            #:optional name
> +                            #:key (system (%current-system))
> +                            (guile (default-guile)))
> +  "Similar to 'url-fetch' but unpack the zip file at URL in a directory of its
> +own.  This helper makes it easier to deal with \"zip bombs\"."
> +  (define file-name
> +    (match url
> +      ((head _ ...)
> +       (basename head))
> +      (_
> +       (basename url))))
> +  (define unzip
> +    (module-ref (resolve-interface '(gnu packages zip)) 'unzip))
> +
> +  (mlet %store-monad ((drv (url-fetch url hash-algo hash
> +                                      (string-append "zipbomb-"
> +                                                     (or name file-name))
> +                                      #:system system
> +                                      #:guile guile)))
> +    ;; Take the zip bomb, and simply unpack it as a directory.
> +    (gexp->derivation (or name file-name)
> +                      #~(begin
> +                          (mkdir #$output)
> +                          (chdir #$output)
> +                          (zero? (system* (string-append #$unzip "/bin/unzip")
> +                                          #$drv)))
> +                      #:local-build? #t)))
> +
>  (define* (download-to-store store url #:optional (name (basename url))
>                              #:key (log (current-error-port)) recursive?
>                              (verify-certificate? #t))
> -- 
> 2.9.3
>
>

Looks good to me at first, on functionality side I can atest that
the zpaq build succeeds with this.
-- 
♥Ⓐ  ng0 -- https://www.inventati.org/patternsinthechaos/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] gnu: Add zpaq.
  2017-01-28 17:51   ` ng0
@ 2017-01-28 18:02     ` Tobias Geerinckx-Rice
  0 siblings, 0 replies; 11+ messages in thread
From: Tobias Geerinckx-Rice @ 2017-01-28 18:02 UTC (permalink / raw)
  To: contact.ng0, guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 1351 bytes --]

ng0,

On 28/01/17 18:51, ng0 wrote:
> Functionality seems okay:

I've been using (more or less) this package for a month or so, and have
yet to experience catastrophic data loss.

>> +        (string-append "CPPFLAGS=-Dunix"
>> +                       ,(match (or (%current-target-system)
>> +                                   (%current-system))
>> +                               ("x86_64-linux"	"")
>> +                               ("i686-linux"    "")
>> +                               (_               " -DNOJIT")))
>> +        (string-append "CXXFLAGS=-O3 -mtune=generic -DNDEBUG"
>> +                       ,(match (or (%current-target-system)
>> +                                   (%current-system))
>> +                               ("x86_64-linux"  " -march=nocona")
>> +                               ("i686-linux"    " -march=i686")
>> +                               (_               "")))
> 
> Can you add a comment on the CPPFLAGS?

Hmm? The code looks self-documenting to me. I can't really think of a
comment that wouldn't verge on the tautological. What's unclear to you?

I think CXXFLAGS could use one, though. I tried to choose a safe ‘lowest
common denominator’ CPU model for both to keep the package reproducible,
while allowing for some optimisation on x86_64.

Kind regards,

T G-R


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 476 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional.
  2017-01-27 19:59 [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional Tobias Geerinckx-Rice
  2017-01-27 19:59 ` [PATCH 2/3] download: Add ‘url-fetch/zipbomb’ Tobias Geerinckx-Rice
  2017-01-27 19:59 ` [PATCH 3/3] gnu: Add zpaq Tobias Geerinckx-Rice
@ 2017-01-28 18:22 ` ng0
  2017-01-30 22:51 ` Ludovic Courtès
  3 siblings, 0 replies; 11+ messages in thread
From: ng0 @ 2017-01-28 18:22 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice, guix-devel

I have tested if the changed packages still build, that's all:

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> * 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’.

Builds…

> * gnu/packages/engineering.scm (fastcap)[source]: Likewise.

…same here

> * gnu/packages/scheme.scm (scmutils)[source]: Likewise.

…and here.

> ---
>
> 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 <beffa@fbengineering.ch>
>  ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
>  ;;; Copyright © 2016 David Craven <david@craven.ch>
> +;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
>  ;;;
>  ;;; 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
>
>

-- 
♥Ⓐ  ng0 -- https://www.inventati.org/patternsinthechaos/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional.
  2017-01-27 19:59 [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional Tobias Geerinckx-Rice
                   ` (2 preceding siblings ...)
  2017-01-28 18:22 ` [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional ng0
@ 2017-01-30 22:51 ` Ludovic Courtès
  3 siblings, 0 replies; 11+ messages in thread
From: Ludovic Courtès @ 2017-01-30 22:51 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: guix-devel

Tobias Geerinckx-Rice <me@tobias.gr> skribis:

> * 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.

LGTM, thanks!

Ludo'.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] download: Add ‘url-fetch/zipbomb’.
  2017-01-27 19:59 ` [PATCH 2/3] download: Add ‘url-fetch/zipbomb’ Tobias Geerinckx-Rice
  2017-01-28 17:55   ` ng0
@ 2017-01-30 22:52   ` Ludovic Courtès
  1 sibling, 0 replies; 11+ messages in thread
From: Ludovic Courtès @ 2017-01-30 22:52 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: guix-devel

Tobias Geerinckx-Rice <me@tobias.gr> skribis:

> From this suggestion by Ludovic Courtès:
> <http://lists.gnu.org/archive/html/guix-devel/2016-09/msg01983.html>
>
> * guix/download.scm (url-fetch/zipbomb): New procedure.

OK, thanks!

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] gnu: Add zpaq.
  2017-01-27 19:59 ` [PATCH 3/3] gnu: Add zpaq Tobias Geerinckx-Rice
  2017-01-28 17:51   ` ng0
@ 2017-01-30 22:54   ` Ludovic Courtès
  2017-01-30 23:12     ` Tobias Geerinckx-Rice
  1 sibling, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2017-01-30 22:54 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: guix-devel

Tobias Geerinckx-Rice <me@tobias.gr> skribis:

> * gnu/packages/compression.scm (zpaq): New variable.

[...]

> +        (string-append "CXXFLAGS=-O3 -mtune=generic -DNDEBUG"
> +                       ,(match (or (%current-target-system)
> +                                   (%current-system))
> +                               ("x86_64-linux"  " -march=nocona")
> +                               ("i686-linux"    " -march=i686")
> +                               (_               "")))

Maybe add a note as to why these are needed.

> +    (home-page "http://mattmahoney.net/dc/zpaq.html")
> +    (synopsis "Incremental journaling archiver")
> +    (description "ZPAQ is a command-line archiver that backs up faster and
> +compresses better than most other popular archivers in realistic situations
> +with many duplicate and already compressed files.  It backs up only those files

I’d tone down the first sentence.  :-)

Otherwise LGTM, thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] gnu: Add zpaq.
  2017-01-30 22:54   ` Ludovic Courtès
@ 2017-01-30 23:12     ` Tobias Geerinckx-Rice
  0 siblings, 0 replies; 11+ messages in thread
From: Tobias Geerinckx-Rice @ 2017-01-30 23:12 UTC (permalink / raw)
  To: ludo; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 1036 bytes --]

Ludo',

On 30/01/17 23:54, Ludovic Courtès wrote:
>> +        (string-append "CXXFLAGS=-O3 -mtune=generic -DNDEBUG"
>> +                       ,(match (or (%current-target-system)
>> +                                   (%current-system))
>> +                               ("x86_64-linux"  " -march=nocona")
>> +                               ("i686-linux"    " -march=i686")
>> +                               (_               "")))
> 
> Maybe add a note as to why these are needed.

I've added something akin to the explanation in my previous mail.

>> +    (description "ZPAQ is a command-line archiver that backs up faster and
>> +compresses better than most other popular archivers in realistic situations
>> +with many duplicate and already compressed files.  It backs up only those files
> 
> I’d tone down the first sentence.  :-)

Sure. That's just how they describe themselves, I'm afraid :-)

I'll use the wretched phrase ‘optimised for’ if I can think of nothing
better.

Thanks,

T G-R


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 476 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-01-30 23:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-27 19:59 [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional Tobias Geerinckx-Rice
2017-01-27 19:59 ` [PATCH 2/3] download: Add ‘url-fetch/zipbomb’ Tobias Geerinckx-Rice
2017-01-28 17:55   ` ng0
2017-01-30 22:52   ` Ludovic Courtès
2017-01-27 19:59 ` [PATCH 3/3] gnu: Add zpaq Tobias Geerinckx-Rice
2017-01-28 17:51   ` ng0
2017-01-28 18:02     ` Tobias Geerinckx-Rice
2017-01-30 22:54   ` Ludovic Courtès
2017-01-30 23:12     ` Tobias Geerinckx-Rice
2017-01-28 18:22 ` [PATCH 1/3] download: url-fetch/tarball: Make ‘name’ truly optional ng0
2017-01-30 22:51 ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.