unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] guix: lint: Check for version-only origin file names.
@ 2015-08-23 23:05 ericbavier
  2015-08-24 23:02 ` Mark H Weaver
  0 siblings, 1 reply; 8+ messages in thread
From: ericbavier @ 2015-08-23 23:05 UTC (permalink / raw)
  To: guix-devel; +Cc: Eric Bavier

From: Eric Bavier <bavier@member.fsf.org>

* guix/scripts/lint.scm (check-source): Emit warning if source filename
  contains only the version of the package.
---
 guix/scripts/lint.scm | 64 +++++++++++++++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 25 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 14ac8cb..c0300bc 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
-;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -20,6 +20,7 @@
 
 (define-module (guix scripts lint)
   #:use-module (guix store)
+  #:use-module (guix derivations)
   #:use-module (guix base32)
   #:use-module (guix download)
   #:use-module (guix ftp-client)
@@ -466,31 +467,44 @@ descriptions maintained upstream."
                           uris))
       '()))
 
+  (define (origin-version-name? origin)
+    ;; Return #t if the source file name contains only a version; indicates
+    ;; that the origin needs a 'file-name' field.
+    (string-prefix? (package-version package)
+                    (store-path-package-name
+                     (with-store store
+                       (derivation->output-path
+                        (package-source-derivation store origin))))))
+
   (let ((origin (package-source package)))
-    (when (and origin
-               (eqv? (origin-method origin) url-fetch))
-      (let* ((strings (origin-uri origin))
-             (uris (if (list? strings)
-                       (map string->uri strings)
-                       (list (string->uri strings)))))
-
-        ;; Just make sure that at least one of the URIs is valid.
-        (call-with-values
-            (lambda () (try-uris uris))
-          (lambda (success? warnings)
-            ;; When everything fails, report all of WARNINGS, otherwise don't
-            ;; report anything.
-            ;;
-            ;; XXX: Ideally we'd still allow warnings to be raised if *some*
-            ;; URIs are unreachable, but distinguish that from the error case
-            ;; where *all* the URIs are unreachable.
-            (unless success?
-              (emit-warning package
-                            (_ "all the source URIs are unreachable:")
-                            'source)
-              (for-each (lambda (warning)
-                          (display warning (guix-warning-port)))
-                        (reverse warnings)))))))))
+    (when origin
+      (if (eqv? (origin-method origin) url-fetch)
+          (let* ((strings (origin-uri origin))
+                 (uris (if (list? strings)
+                           (map string->uri strings)
+                           (list (string->uri strings)))))
+
+            ;; Just make sure that at least one of the URIs is valid.
+            (call-with-values
+                (lambda () (try-uris uris))
+              (lambda (success? warnings)
+                ;; When everything fails, report all of WARNINGS, otherwise don't
+                ;; report anything.
+                ;;
+                ;; XXX: Ideally we'd still allow warnings to be raised if *some*
+                ;; URIs are unreachable, but distinguish that from the error case
+                ;; where *all* the URIs are unreachable.
+                (unless success?
+                  (emit-warning package
+                                (_ "all the source URIs are unreachable:")
+                                'source)
+                  (for-each (lambda (warning)
+                              (display warning (guix-warning-port)))
+                            (reverse warnings)))))))
+      (if (origin-version-name? origin)
+          (emit-warning package
+                        (_ "the source filename should contain the package name")
+                        'source)))))
 
 (define (check-derivation package)
   "Emit a warning if we fail to compile PACKAGE to a derivation."
-- 
2.4.3

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

* Re: [PATCH] guix: lint: Check for version-only origin file names.
  2015-08-23 23:05 [PATCH] guix: lint: Check for version-only origin file names ericbavier
@ 2015-08-24 23:02 ` Mark H Weaver
  2015-08-25  0:10   ` Eric Bavier
  0 siblings, 1 reply; 8+ messages in thread
From: Mark H Weaver @ 2015-08-24 23:02 UTC (permalink / raw)
  To: ericbavier; +Cc: guix-devel, Eric Bavier

ericbavier@openmailbox.org writes:

> From: Eric Bavier <bavier@member.fsf.org>
>
> * guix/scripts/lint.scm (check-source): Emit warning if source filename
>   contains only the version of the package.

This is not a proper review, but I just wanted to add that another
common case is for the filename to start with "v" followed by the
version number, e.g. "v3.2.0.tar.gz", so it would be good to check for
that too.  If you search for the string '/v"' in gnu/packages/*.scm
you'll find a great many examples.

Thank you for working on it!

       Mark

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

* Re: [PATCH] guix: lint: Check for version-only origin file names.
  2015-08-24 23:02 ` Mark H Weaver
@ 2015-08-25  0:10   ` Eric Bavier
  2015-08-28  7:48     ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Bavier @ 2015-08-25  0:10 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel, Eric Bavier

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

On Mon, 24 Aug 2015 19:02:11 -0400
Mark H Weaver <mhw@netris.org> wrote:

> ericbavier@openmailbox.org writes:
> 
> > From: Eric Bavier <bavier@member.fsf.org>
> >
> > * guix/scripts/lint.scm (check-source): Emit warning if source filename
> >   contains only the version of the package.
> 
> This is not a proper review, but I just wanted to add that another
> common case is for the filename to start with "v" followed by the
> version number, e.g. "v3.2.0.tar.gz", so it would be good to check for
> that too.

Indeed.  Attached is an updated patch, with tests and documentation
too! :)
 
> Thank you for working on it!

My pleasure.

`~Eric

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-guix-lint-Check-for-version-only-origin-file-names.patch --]
[-- Type: text/patch, Size: 11440 bytes --]

From 0311d5b383003600ac43d3a9bfdec0ad3c398db2 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Sun, 23 Aug 2015 18:00:45 -0500
Subject: [PATCH] guix: lint: Check for version-only origin file names.

* guix/scripts/lint.scm (check-source): Emit warning if source filename
  contains only the version of the package.
* tests/lint.scm ("source: filename", "source: filename v",
  "source: filename valid"): New tests.
* doc/guix.texi (Invoking guix lint): Mention file name check.
Offending packages updated.
---
 doc/guix.texi                   |  3 +-
 gnu/packages/algebra.scm        |  1 +
 gnu/packages/audio.scm          |  2 ++
 gnu/packages/bioinformatics.scm |  1 +
 gnu/packages/python.scm         |  1 +
 gnu/packages/telephony.scm      |  3 +-
 gnu/packages/textutils.scm      |  1 +
 guix/scripts/lint.scm           | 68 ++++++++++++++++++++++++++---------------
 tests/lint.scm                  | 43 ++++++++++++++++++++++++++
 9 files changed, 96 insertions(+), 27 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index f05376e..153af45 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4133,7 +4133,8 @@ Identify inputs that should most likely be native inputs.
 @item source
 @itemx home-page
 Probe @code{home-page} and @code{source} URLs and report those that are
-invalid.
+invalid.  Check that the source file name contains something other than
+just the version number.
 
 @item formatting
 Warn about obvious source code formatting issues: trailing white space,
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index 3f23ec9..03019f8 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -386,6 +386,7 @@ cosine/ sine transforms or DCT/DST).")
               (method url-fetch)
               (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
                                   version ".tar.bz2"))
+              (file-name (string-append name "-" version ".tar.bz2"))
               (sha256
                (base32
                 "1yf27mfq1x38wlsghkvpjgs8xd5rvbbikf1wyj2l3qw8h6w6qvjz"))
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 1537f33..d28fa09 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -1135,6 +1135,7 @@ aimed at audio/musical applications.")
                (string-append "https://bitbucket.org/breakfastquay/rubberband/get/v"
                               version
                               ".tar.bz2"))
+              (file-name (string-append name "-" version ".tar.bz2"))
               (sha256
                (base32
                 "05amrbrxx0da3w7m237q51799r8xgs4ffqabi2qv06hq8dpcj386"))))
@@ -1689,6 +1690,7 @@ synthesizer written in C++.")
        (method url-fetch)
        (uri (string-append "https://github.com/Themaister/RSound/archive/v"
                            version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32 "1wzs40c0k5zpkmm5ffl6c17xmr399sxli7ys0fbb9ib0fd334knx"))))
     (build-system gnu-build-system)
diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 7a50a85..e98e028 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -608,6 +608,7 @@ multiple sequence alignments.")
               (uri (string-append
                     "https://github.com/YeoLab/clipper/archive/"
                     version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
                 "1q7jpimsqln7ic44i8v2rx2haj5wvik8hc1s2syd31zcn0xk1iyq"))
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 940efec..0f7a482 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -2444,6 +2444,7 @@ and is very extensible.")
        (uri (string-append
              "https://github.com/scikit-learn/scikit-learn/archive/"
              version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
          "140skabifgc7lvvj873pnzlwx0ni6q8qkrsyad2ccjb3h8rxzkih"))))
diff --git a/gnu/packages/telephony.scm b/gnu/packages/telephony.scm
index f0d5dff..ee8b2cb 100644
--- a/gnu/packages/telephony.scm
+++ b/gnu/packages/telephony.scm
@@ -192,7 +192,8 @@ internet.")
     (source (origin
              (method url-fetch)
              (uri (string-append "https://github.com/cisco/libsrtp/archive/v"
-                                  version ".tar.gz"))
+                                 version ".tar.gz"))
+             (file-name (string-append name "-" version ".tar.gz"))
              (sha256
               (base32
                "1njf62f6sazz2q7qc4j495v1pga385whkmxxyr8hfz1ragiyzqc6"))))
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index 08b1b64..c7cb243 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -72,6 +72,7 @@ handy front-end to the library.")
        (method url-fetch)
        (uri (string-append
              "https://github.com/nijel/enca/archive/" version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32 "1xik00x0yvhswsw2isnclabhv536xk1s42cf5z54gfbpbhc7ni8l"))))
     (build-system gnu-build-system)
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 14ac8cb..443103f 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
-;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -20,6 +20,7 @@
 
 (define-module (guix scripts lint)
   #:use-module (guix store)
+  #:use-module (guix derivations)
   #:use-module (guix base32)
   #:use-module (guix download)
   #:use-module (guix ftp-client)
@@ -466,31 +467,48 @@ descriptions maintained upstream."
                           uris))
       '()))
 
+  (define (origin-version-name? origin)
+    ;; Return #t if the source file name contains only a version; indicates
+    ;; that the origin needs a 'file-name' field.
+    (let ((filename (store-path-package-name
+                     (with-store store
+                       (derivation->output-path
+                        (package-source-derivation store origin)))))
+          (version (package-version package)))
+      (or (string-prefix? version filename)
+          ;; Common in many projects is for the filename to start with a "v"
+          ;; followed by the version, e.g. "v3.2.0.tar.gz".
+          (string-prefix? (string-append "v" version) filename))))
+
   (let ((origin (package-source package)))
-    (when (and origin
-               (eqv? (origin-method origin) url-fetch))
-      (let* ((strings (origin-uri origin))
-             (uris (if (list? strings)
-                       (map string->uri strings)
-                       (list (string->uri strings)))))
-
-        ;; Just make sure that at least one of the URIs is valid.
-        (call-with-values
-            (lambda () (try-uris uris))
-          (lambda (success? warnings)
-            ;; When everything fails, report all of WARNINGS, otherwise don't
-            ;; report anything.
-            ;;
-            ;; XXX: Ideally we'd still allow warnings to be raised if *some*
-            ;; URIs are unreachable, but distinguish that from the error case
-            ;; where *all* the URIs are unreachable.
-            (unless success?
-              (emit-warning package
-                            (_ "all the source URIs are unreachable:")
-                            'source)
-              (for-each (lambda (warning)
-                          (display warning (guix-warning-port)))
-                        (reverse warnings)))))))))
+    (when origin
+      (if (eqv? (origin-method origin) url-fetch)
+          (let* ((strings (origin-uri origin))
+                 (uris (if (list? strings)
+                           (map string->uri strings)
+                           (list (string->uri strings)))))
+
+            ;; Just make sure that at least one of the URIs is valid.
+            (call-with-values
+                (lambda () (try-uris uris))
+              (lambda (success? warnings)
+                ;; When everything fails, report all of WARNINGS, otherwise don't
+                ;; report anything.
+                ;;
+                ;; XXX: Ideally we'd still allow warnings to be raised if *some*
+                ;; URIs are unreachable, but distinguish that from the error case
+                ;; where *all* the URIs are unreachable.
+                (unless success?
+                  (emit-warning package
+                                (_ "all the source URIs are unreachable:")
+                                'source)
+                  (for-each (lambda (warning)
+                              (display warning (guix-warning-port)))
+                            (reverse warnings)))))))
+      (if (origin-version-name? origin)
+          (emit-warning package
+                        (_ "the source filename should contain the package name")
+                        'source)))))
 
 (define (check-derivation package)
   "Emit a warning if we fail to compile PACKAGE to a derivation."
diff --git a/tests/lint.scm b/tests/lint.scm
index 5d56420..0973741 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -392,6 +392,49 @@ requests."
           (check-home-page pkg))))
     "not reachable: 404")))
 
+(test-assert "source: filename"
+  (->bool
+   (string-contains
+    (with-warnings
+      (let ((pkg (dummy-package "x"
+                   (version "3.2.1")
+                   (source
+                    (origin
+                      (method url-fetch)
+                      (uri "http://www.example.com/3.2.1.tar.gz")
+                      (sha256 %null-sha256))))))
+        (check-source pkg)))
+    "filename should contain the package name")))
+
+(test-assert "source: filename v"
+  (->bool
+   (string-contains
+    (with-warnings
+      (let ((pkg (dummy-package "x"
+                   (version "3.2.1")
+                   (source
+                    (origin
+                      (method url-fetch)
+                      (uri "http://www.example.com/v3.2.1.tar.gz")
+                      (sha256 %null-sha256))))))
+        (check-source pkg)))
+    "filename should contain the package name")))
+
+(test-assert "source: filename valid"
+  (not
+   (->bool
+    (string-contains
+     (with-warnings
+       (let ((pkg (dummy-package "x"
+                    (version "3.2.1")
+                    (source
+                     (origin
+                       (method url-fetch)
+                       (uri "http://www.example.com/x-3.2.1.tar.gz")
+                       (sha256 %null-sha256))))))
+         (check-source pkg)))
+     "filename should contain the package name"))))
+
 (test-skip (if %http-server-socket 0 1))
 (test-equal "source: 200"
   ""
-- 
2.4.3


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

* Re: [PATCH] guix: lint: Check for version-only origin file names.
  2015-08-25  0:10   ` Eric Bavier
@ 2015-08-28  7:48     ` Ludovic Courtès
  2015-09-10 20:50       ` Eric Bavier
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2015-08-28  7:48 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel, Eric Bavier

Eric Bavier <ericbavier@openmailbox.org> skribis:

> From 0311d5b383003600ac43d3a9bfdec0ad3c398db2 Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Sun, 23 Aug 2015 18:00:45 -0500
> Subject: [PATCH] guix: lint: Check for version-only origin file names.
>
> * guix/scripts/lint.scm (check-source): Emit warning if source filename
>   contains only the version of the package.
> * tests/lint.scm ("source: filename", "source: filename v",
>   "source: filename valid"): New tests.
> * doc/guix.texi (Invoking guix lint): Mention file name check.
> Offending packages updated.

This is useful, thanks for looking into it.

I would prefer it to make a separate linter, like ‘source-file-name’.
The reason is that ‘source’ is a relatively expensive check, since it
needs to probe URLs (so you might want to skip it in some cases),
whereas the linter your propose is lightweight.

WDYT?

> --- a/gnu/packages/algebra.scm
> +++ b/gnu/packages/algebra.scm
> @@ -386,6 +386,7 @@ cosine/ sine transforms or DCT/DST).")
>                (method url-fetch)
>                (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
>                                    version ".tar.bz2"))
> +              (file-name (string-append name "-" version ".tar.bz2"))

Could you make these package updates a separate patch?  Some may trigger
large rebuilds, so you may have to keep them for ‘core-updates’ or such.

> +  (define (origin-version-name? origin)
> +    ;; Return #t if the source file name contains only a version; indicates
> +    ;; that the origin needs a 'file-name' field.
> +    (let ((filename (store-path-package-name
> +                     (with-store store
> +                       (derivation->output-path
> +                        (package-source-derivation store origin)))))
> +          (version (package-version package)))
> +      (or (string-prefix? version filename)
> +          ;; Common in many projects is for the filename to start with a "v"
> +          ;; followed by the version, e.g. "v3.2.0.tar.gz".
> +          (string-prefix? (string-append "v" version) filename))))

Opening a connection to the store in the middle of the code
(‘with-store’) is Bad Practice.  ;-)

I think this can actually be made simpler, with something akin to what
‘node-full-name’ does in guix/scripts/graph.scm.  Maybe we could extract
an ‘origin-actual-file-name’ procedure from that and move it to (guix
packages).  WDYT?

> +(test-assert "source: filename"

“file name” (two words).

Could you send an updated patch?

Thanks,
Ludo’.

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

* Re: [PATCH] guix: lint: Check for version-only origin file names.
  2015-08-28  7:48     ` Ludovic Courtès
@ 2015-09-10 20:50       ` Eric Bavier
  2015-09-11  4:04         ` Eric Bavier
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Bavier @ 2015-09-10 20:50 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3273 bytes --]

On Fri, 28 Aug 2015 09:48:48 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

> Eric Bavier <ericbavier@openmailbox.org> skribis:
> 
> > From 0311d5b383003600ac43d3a9bfdec0ad3c398db2 Mon Sep 17 00:00:00 2001
> > From: Eric Bavier <bavier@member.fsf.org>
> > Date: Sun, 23 Aug 2015 18:00:45 -0500
> > Subject: [PATCH] guix: lint: Check for version-only origin file names.
> >
> > * guix/scripts/lint.scm (check-source): Emit warning if source filename
> >   contains only the version of the package.
> > * tests/lint.scm ("source: filename", "source: filename v",
> >   "source: filename valid"): New tests.
> > * doc/guix.texi (Invoking guix lint): Mention file name check.
> > Offending packages updated.
> 
> This is useful, thanks for looking into it.

Thanks for the review!
 
> I would prefer it to make a separate linter, like ‘source-file-name’.
> The reason is that ‘source’ is a relatively expensive check, since it
> needs to probe URLs (so you might want to skip it in some cases),
> whereas the linter your propose is lightweight.

Makes sense.

> 
> > --- a/gnu/packages/algebra.scm
> > +++ b/gnu/packages/algebra.scm
> > @@ -386,6 +386,7 @@ cosine/ sine transforms or DCT/DST).")
> >                (method url-fetch)
> >                (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
> >                                    version ".tar.bz2"))
> > +              (file-name (string-append name "-" version ".tar.bz2"))
> 
> Could you make these package updates a separate patch?  Some may trigger
> large rebuilds, so you may have to keep them for ‘core-updates’ or such.

I've left the package updates out of the attached patches.

> 
> > +  (define (origin-version-name? origin)
> > +    ;; Return #t if the source file name contains only a version; indicates
> > +    ;; that the origin needs a 'file-name' field.
> > +    (let ((filename (store-path-package-name
> > +                     (with-store store
> > +                       (derivation->output-path
> > +                        (package-source-derivation store origin)))))
> > +          (version (package-version package)))
> > +      (or (string-prefix? version filename)
> > +          ;; Common in many projects is for the filename to start with a "v"
> > +          ;; followed by the version, e.g. "v3.2.0.tar.gz".
> > +          (string-prefix? (string-append "v" version) filename))))
> 
> Opening a connection to the store in the middle of the code
> (‘with-store’) is Bad Practice.  ;-)
> 
> I think this can actually be made simpler, with something akin to what
> ‘node-full-name’ does in guix/scripts/graph.scm.  Maybe we could extract
> an ‘origin-actual-file-name’ procedure from that and move it to (guix
> packages).  WDYT?

The first attached patch does this.  Is using the basename of the
source URI always accurate?  I.e. are there cases where the store file
name might not match the URI's basename?  This uncertainty, I think, is
what caused me to use store-path-package-name initially.

This revised patch might actually be considered "more accurate" in that
the checker now flags origins from 'git-reference' et al where no
'file-name' field is declared.

`~Eric

[-- Attachment #2: Type: text/plain, Size: 4593 bytes --]

Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename=0001-guix-packages-Add-origin-actual-file-name.patch

RnJvbSA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3IgKGJhc2VuYW1lIHRoaW5n
KQogICAgICAgICAgICAgIChlcnJvciAiYmFzZW5hbWUiIHRoaW5nKSkpCi0tIAoyLjQuMwoK

[-- Attachment #3: Type: text/plain, Size: 13241 bytes --]

Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename=0002-guix-lint-Check-for-meaningful-origin-file-names.patch

RnJvbSAwM2MzZjJiMjFhMjQ2NzY3NTA5MjgzMGFlYTJkZGYxOTJlMTMzZmY1IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBFcmljIEJhdmllciA8YmF2aWVyQG1lbWJlci5mc2Yub3JnPgpE
YXRlOiBUaHUsIDEwIFNlcCAyMDE1IDE1OjM0OjU4IC0wNTAwClN1YmplY3Q6IFtQQVRDSCAyLzJd
IGd1aXg6IGxpbnQ6IENoZWNrIGZvciBtZWFuaW5nZnVsIG9yaWdpbiBmaWxlIG5hbWVzLgoKKiBn
dWl4L3NjcmlwdHMvbGludC5zY20gKGNoZWNrLXNvdXJjZS1maWxlLW5hbWUpOiBOZXcgcHJvY2Vk
dXJlLgogICglY2hlY2tlcnMpOiBBZGQgJ3NvdXJjZS1maWxlLW5hbWUnIGNoZWNrZXIuCiogdGVz
dHMvbGludC5zY20gKCJzb3VyY2U6IGZpbGUgbmFtZSIsICJzb3VyY2U6IGZpbGUgbmFtZSB2IikK
ICAoInNvdXJjZTogZmlsZSBuYW1lIHZhbGlkIiwgInNvdXJjZTogZmlsZSBuYW1lIGJhZCBjaGVj
a291dCIpCiAgKCJzb3VyY2U6IGZpbGUgbmFtZSBnb29kIGNoZWNrb3V0Iik6IE5ldyB0ZXN0cy4K
KiBkb2MvZ3VpeC50ZXhpIChJbnZva2luZyBndWl4IGxpbnQpOiBNZW50aW9uIGZpbGUgbmFtZSBj
aGVjay4KLS0tCiBkb2MvZ3VpeC50ZXhpICAgICAgICAgfCAgNSArKystCiBndWl4L3NjcmlwdHMv
bGludC5zY20gfCA3NSArKysrKysrKysrKysr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ICAoZW1pdC13YXJuaW5nIHBhY2thZ2UKLSAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAoXyAiYWxsIHRoZSBzb3VyY2UgVVJJcyBhcmUgdW5yZWFjaGFibGU6IikKLSAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAnc291cmNlKQotICAgICAgICAgICAgICAoZm9yLWVh
Y2ggKGxhbWJkYSAod2FybmluZykKLSAgICAgICAgICAgICAgICAgICAgICAgICAgKGRpc3BsYXkg
d2FybmluZyAoZ3VpeC13YXJuaW5nLXBvcnQpKSkKLSAgICAgICAgICAgICAgICAgICAgICAgIChy
ZXZlcnNlIHdhcm5pbmdzKSkpKSkpKSkpCisgICAgKHdoZW4gb3JpZ2luCisgICAgICAoaWYgKGVx
dj8gKG9yaWdpbi1tZXRob2Qgb3JpZ2luKSB1cmwtZmV0Y2gpCisgICAgICAgICAgKGxldCogKChz
dHJpbmdzIChvcmlnaW4tdXJpIG9yaWdpbikpCisgICAgICAgICAgICAgICAgICh1cmlzIChpZiAo
bGlzdD8gc3RyaW5ncykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIChtYXAgc3RyaW5nLT51
cmkgc3RyaW5ncykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIChsaXN0IChzdHJpbmctPnVy
aSBzdHJpbmdzKSkpKSkKKworICAgICAgICAgICAgOzsgSnVzdCBtYWtlIHN1cmUgdGhhdCBhdCBs
ZWFzdCBvbmUgb2YgdGhlIFVSSXMgaXMgdmFsaWQuCisgICAgICAgICAgICAoY2FsbC13aXRoLXZh
bHVlcworICAgICAgICAgICAgICAgIChsYW1iZGEgKCkgKHRyeS11cmlzIHVyaXMpKQorICAgICAg
ICAgICAgICAobGFtYmRhIChzdWNjZXNzPyB3YXJuaW5ncykKKyAgICAgICAgICAgICAgICA7OyBX
aGVuIGV2ZXJ5dGhpbmcgZmFpbHMsIHJlcG9ydCBhbGwgb2YgV0FSTklOR1MsIG90aGVyd2lzZSBk
b24ndAorICAgICAgICAgICAgICAgIDs7IHJlcG9ydCBhbnl0aGluZy4KKyAgICAgICAgICAgICAg
ICA7OworICAgICAgICAgICAgICAgIDs7IFhYWDogSWRlYWxseSB3ZSdkIHN0aWxsIGFsbG93IHdh
cm5pbmdzIHRvIGJlIHJhaXNlZCBpZiAqc29tZSoKKyAgICAgICAgICAgICAgICA7OyBVUklzIGFy
ZSB1bnJlYWNoYWJsZSwgYnV0IGRpc3Rpbmd1aXNoIHRoYXQgZnJvbSB0aGUgZXJyb3IgY2FzZQor
ICAgICAgICAgICAgICAgIDs7IHdoZXJlICphbGwqIHRoZSBVUklzIGFyZSB1bnJlYWNoYWJsZS4K
KyAgICAgICAgICAgICAgICAodW5sZXNzIHN1Y2Nlc3M/CisgICAgICAgICAgICAgICAgICAoZW1p
dC13YXJuaW5nIHBhY2thZ2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKF8gImFs
bCB0aGUgc291cmNlIFVSSXMgYXJlIHVucmVhY2hhYmxlOiIpCisgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICdzb3VyY2UpCisgICAgICAgICAgICAgICAgICAoZm9yLWVhY2ggKGxhbWJk
YSAod2FybmluZykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChkaXNwbGF5IHdhcm5p
bmcgKGd1aXgtd2FybmluZy1wb3J0KSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHJl
dmVyc2Ugd2FybmluZ3MpKSkpKSkpKSkpCisKKyhkZWZpbmUgKGNoZWNrLXNvdXJjZS1maWxlLW5h
bWUgcGFja2FnZSkKKyAgIkVtaXQgYSB3YXJuaW5nIGlmIFBBQ0tBR0UncyBvcmlnaW4gaGFzIGEg
dmVyc2lvbi1vbmx5IGZpbGUgbmFtZS4iCisgIChkZWZpbmUgKG9yaWdpbi1maWxlLW5hbWUtdmFs
aWQ/IG9yaWdpbikKKyAgICA7OyBSZXR1cm4gI3QgaWYgdGhlIHNvdXJjZSBmaWxlIG5hbWU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uMi4xLnRhci5neiIpCisgICAgICAgICAgICAgICAgICAgICAgKHNoYTI1NiAl
bnVsbC1zaGEyNTYpKSkpKSkKKyAgICAgICAgKGNoZWNrLXNvdXJjZS1maWxlLW5hbWUgcGtnKSkp
CisgICAgImZpbGUgbmFtZSBzaG91bGQgY29udGFpbiB0aGUgcGFja2FnZSBuYW1lIikpKQorCiso
dGVzdC1hc3NlcnQgInNvdXJjZTogZmlsZSBuYW1lIHYiCisgICgtPmJvb2wKKyAgIChzdHJpbmct
Y29udGFpbnMKKyAgICAod2l0aC13YXJuaW5ncworICAgICAgKGxldCAoKHBrZyAoZHVtbXktcGFj
a2FnZSAieCIKKyAgICAgICAgICAgICAgICAgICAodmVyc2lvbiAiMy4yLjEiKQorICAgICAgICAg
ICAgICAgICAgIChzb3VyY2UKKyAgICAgICAgICAgICAgICAgICAgKG9yaWdpbgorICAgICAgICAg
ICAgICAgICAgICAgIChtZXRob2QgdXJsLWZldGNoKQorICAgICAgICAgICAgICAgICAgICAgICh1
cmkgImh0dHA6Ly93d3cuZXhhbXBsZS5jb20vdjMuMi4xLnRhci5neiIpCisgICAgICAgICAgICAg
ICAgICAgICAgKHNoYTI1NiAlbnVsbC1zaGEyNTYpKSkpKSkKKyAgICAgICAgKGNoZWNrLXNvdXJj
ZS1maWxlLW5hbWUgcGtnKSkpCisgICAgImZpbGUgbmFtZSBzaG91bGQgY29udGFpbiB0aGUgcGFj
a2FnZSBuYW1lIikpKQorCisodGVzdC1hc3NlcnQgInNvdXJjZTogZmlsZSBuYW1lIGJhZCBjaGVj
a291dCIKKyAgKC0+Ym9vbAorICAgKHN0cmluZy1jb250YWlucworICAgICh3aXRoLXdhcm5pbmdz
CisgICAgICAobGV0ICgocGtnIChkdW1teS1wYWNrYWdlICJ4IgorICAgICAgICAgICAgICAgICAg
ICh2ZXJzaW9uICIzLjIuMSIpCisgICAgICAgICAgICAgICAgICAgKHNvdXJjZQorICAgICAgICAg
ICAgICAgICAgICAob3JpZ2luCisgICAgICAgICAgICAgICAgICAgICAgKG1ldGhvZCBnaXQtZmV0
Y2gpCisgICAgICAgICAgICAgICAgICAgICAgKHVyaSAoZ2l0LXJlZmVyZW5jZQorICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICh1cmwgImh0dHA6Ly93d3cuZXhhbXBsZS5jb20veC5naXQiKQor
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjb21taXQgIjAiKSkpCisgICAgICAgICAgICAg
ICAgICAgICAgKHNoYTI1NiAlbnVsbC1zaGEyNTYpKSkpKSkKKyAgICAgICAgKGNoZWNrLXNvdXJj
ZS1maWxlLW5hbWUgcGtnKSkpCisgICAgImZpbGUgbmFtZSBzaG91bGQgY29udGFpbiB0aGUgcGFj
a2FnZSBuYW1lIikpKQorCisodGVzdC1hc3NlcnQgInNvdXJjZTogZmlsZSBuYW1lIGdvb2QgY2hl
Y2tvdXQiCisgIChub3QKKyAgICgtPmJvb2wKKyAgICAoc3RyaW5nLWNvbnRhaW5zCisgICAgICh3
aXRoLXdhcm5pbmdzCisgICAgICAgKGxldCAoKHBrZyAoZHVtbXktcGFja2FnZSAieCIKKyAgICAg
ICAgICAgICAgICAgICAgKHZlcnNpb24gIjMuMi4xIikKKyAgICAgICAgICAgICAgICAgICAgKHNv
dXJjZQorICAgICAgICAgICAgICAgICAgICAgKG9yaWdpbgorICAgICAgICAgICAgICAgICAgICAg
ICAobWV0aG9kIGdpdC1mZXRjaCkKKyAgICAgICAgICAgICAgICAgICAgICAgKHVyaSAoZ2l0LXJl
ZmVyZW5jZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodXJsICJodHRwOi8vZ2l0LmV4
YW1wbGUuY29tL3guZ2l0IikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGNvbW1pdCAi
MCIpKSkKKyAgICAgICAgICAgICAgICAgICAgICAgKGZpbGUtbmFtZSAoc3RyaW5nLWFwcGVuZCAi
eC0iIHZlcnNpb24pKQorICAgICAgICAgICAgICAgICAgICAgICAoc2hhMjU2ICVudWxsLXNoYTI1
NikpKSkpKQorICAgICAgICAgKGNoZWNrLXNvdXJjZS1maWxlLW5hbWUgcGtnKSkpCisgICAgICJm
aWxlIG5hbWUgc2hvdWxkIGNvbnRhaW4gdGhlIHBhY2thZ2UgbmFtZSIpKSkpCisKKyh0ZXN0LWFz
c2VydCAic291cmNlOiBmaWxlIG5hbWUgdmFsaWQiCisgIChub3QKKyAgICgtPmJvb2wKKyAgICAo
c3RyaW5nLWNvbnRhaW5zCisgICAgICh3aXRoLXdhcm5pbmdzCisgICAgICAgKGxldCAoKHBrZyAo
ZHVtbXktcGFja2FnZSAieCIKKyAgICAgICAgICAgICAgICAgICAgKHZlcnNpb24gIjMuMi4xIikK
KyAgICAgICAgICAgICAgICAgICAgKHNvdXJjZQorICAgICAgICAgICAgICAgICAgICAgKG9yaWdp
bgorICAgICAgICAgICAgICAgICAgICAgICAobWV0aG9kIHVybC1mZXRjaCkKKyAgICAgICAgICAg
ICAgICAgICAgICAgKHVyaSAiaHR0cDovL3d3dy5leGFtcGxlLmNvbS94LTMuMi4xLnRhci5neiIp
CisgICAgICAgICAgICAgICAgICAgICAgIChzaGEyNTYgJW51bGwtc2hhMjU2KSkpKSkpCisgICAg
ICAgICAoY2hlY2stc291cmNlLWZpbGUtbmFtZSBwa2cpKSkKKyAgICAgImZpbGUgbmFtZSBzaG91
bGQgY29udGFpbiB0aGUgcGFja2FnZSBuYW1lIikpKSkKKwogKHRlc3Qtc2tpcCAoaWYgJWh0dHAt
c2VydmVyLXNvY2tldCAwIDEpKQogKHRlc3QtZXF1YWwgInNvdXJjZTogMjAwIgogICAiIgotLSAK
Mi40LjMKCg==

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

* Re: [PATCH] guix: lint: Check for version-only origin file names.
  2015-09-10 20:50       ` Eric Bavier
@ 2015-09-11  4:04         ` Eric Bavier
  2015-09-13 16:59           ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Bavier @ 2015-09-11  4:04 UTC (permalink / raw)
  To: ludo; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3521 bytes --]

Something happened to the attachments.  Let's try that again.  Sorry 
about that.

`~Eric

On 2015-09-10 15:50, Eric Bavier wrote:
> On Fri, 28 Aug 2015 09:48:48 +0200
> ludo@gnu.org (Ludovic Courtès) wrote:
> 
>> Eric Bavier <ericbavier@openmailbox.org> skribis:
>> 
>> > From 0311d5b383003600ac43d3a9bfdec0ad3c398db2 Mon Sep 17 00:00:00 2001
>> > From: Eric Bavier <bavier@member.fsf.org>
>> > Date: Sun, 23 Aug 2015 18:00:45 -0500
>> > Subject: [PATCH] guix: lint: Check for version-only origin file names.
>> >
>> > * guix/scripts/lint.scm (check-source): Emit warning if source filename
>> >   contains only the version of the package.
>> > * tests/lint.scm ("source: filename", "source: filename v",
>> >   "source: filename valid"): New tests.
>> > * doc/guix.texi (Invoking guix lint): Mention file name check.
>> > Offending packages updated.
>> 
>> This is useful, thanks for looking into it.
> 
> Thanks for the review!
> 
>> I would prefer it to make a separate linter, like ‘source-file-name’.
>> The reason is that ‘source’ is a relatively expensive check, since it
>> needs to probe URLs (so you might want to skip it in some cases),
>> whereas the linter your propose is lightweight.
> 
> Makes sense.
> 
>> 
>> > --- a/gnu/packages/algebra.scm
>> > +++ b/gnu/packages/algebra.scm
>> > @@ -386,6 +386,7 @@ cosine/ sine transforms or DCT/DST).")
>> >                (method url-fetch)
>> >                (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
>> >                                    version ".tar.bz2"))
>> > +              (file-name (string-append name "-" version ".tar.bz2"))
>> 
>> Could you make these package updates a separate patch?  Some may 
>> trigger
>> large rebuilds, so you may have to keep them for ‘core-updates’ or 
>> such.
> 
> I've left the package updates out of the attached patches.
> 
>> 
>> > +  (define (origin-version-name? origin)
>> > +    ;; Return #t if the source file name contains only a version; indicates
>> > +    ;; that the origin needs a 'file-name' field.
>> > +    (let ((filename (store-path-package-name
>> > +                     (with-store store
>> > +                       (derivation->output-path
>> > +                        (package-source-derivation store origin)))))
>> > +          (version (package-version package)))
>> > +      (or (string-prefix? version filename)
>> > +          ;; Common in many projects is for the filename to start with a "v"
>> > +          ;; followed by the version, e.g. "v3.2.0.tar.gz".
>> > +          (string-prefix? (string-append "v" version) filename))))
>> 
>> Opening a connection to the store in the middle of the code
>> (‘with-store’) is Bad Practice.  ;-)
>> 
>> I think this can actually be made simpler, with something akin to what
>> ‘node-full-name’ does in guix/scripts/graph.scm.  Maybe we could 
>> extract
>> an ‘origin-actual-file-name’ procedure from that and move it to (guix
>> packages).  WDYT?
> 
> The first attached patch does this.  Is using the basename of the
> source URI always accurate?  I.e. are there cases where the store file
> name might not match the URI's basename?  This uncertainty, I think, is
> what caused me to use store-path-package-name initially.
> 
> This revised patch might actually be considered "more accurate" in that
> the checker now flags origins from 'git-reference' et al where no
> 'file-name' field is declared.
> 
> `~Eric

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-guix-packages-Add-origin-actual-file-name.patch --]
[-- Type: text/x-diff; name=0001-guix-packages-Add-origin-actual-file-name.patch, Size: 3303 bytes --]

From 8db3e5978394b99ad14d69494b00343b70f918e1 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Thu, 10 Sep 2015 15:39:44 -0500
Subject: [PATCH 1/2] guix: packages: Add origin-actual-file-name.

* guix/scripts/graph.scm (uri->file-name, node-full-name): Move origin file
  name logic to...
* guix/packages.scm (origin-actual-file-name): ...here.
---
 guix/packages.scm      | 22 ++++++++++++++++++++++
 guix/scripts/graph.scm | 15 +--------------
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/guix/packages.scm b/guix/packages.scm
index e466ffe..edcb53e 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -37,6 +37,7 @@
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
+  #:use-module (web uri)
   #:re-export (%current-system
                %current-target-system
                search-path-specification)         ;for convenience
@@ -46,6 +47,7 @@
             origin-method
             origin-sha256
             origin-file-name
+            origin-actual-file-name
             origin-patches
             origin-patch-flags
             origin-patch-inputs
@@ -188,6 +190,26 @@ representation."
       ((_ str)
        #'(nix-base32-string->bytevector str)))))
 
+(define (origin-actual-file-name origin)
+  "Return the file name of ORIGIN, either its 'file-name' field or the file
+name of its URI."
+  (define (uri->file-name uri)
+    ;; Return the 'base name' of URI or URI itself, where URI is a string.
+    (let ((path (and=> (string->uri uri) uri-path)))
+      (if path
+          (basename path)
+          uri)))
+
+  (or (origin-file-name origin)
+      (match (origin-uri origin)
+        ((head . tail)
+         (uri->file-name head))
+        ((? string? uri)
+         (uri->file-name uri))
+        (else
+         ;; git, svn, cvs, etc. reference
+         #f))))
+
 (define %supported-systems
   ;; This is the list of system types that are supported.  By default, we
   ;; expect all packages to build successfully here.
diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm
index 2b671be..cddd63e 100644
--- a/guix/scripts/graph.scm
+++ b/guix/scripts/graph.scm
@@ -33,7 +33,6 @@
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-37)
   #:use-module (ice-9 match)
-  #:use-module (web uri)
   #:export (%package-node-type
             %bag-node-type
             %bag-emerged-node-type
@@ -78,25 +77,13 @@
 ;;; Package DAG.
 ;;;
 
-(define (uri->file-name uri)
-  "Return the 'base name' of URI or URI itself, where URI is a string."
-  (let ((path (and=> (string->uri uri) uri-path)))
-    (if path
-        (basename path)
-        uri)))
-
 (define (node-full-name thing)
   "Return a human-readable name to denote THING, a package, origin, or file
 name."
   (cond ((package? thing)
          (package-full-name thing))
         ((origin? thing)
-         (or (origin-file-name thing)
-             (match (origin-uri thing)
-               ((head . tail)
-                (uri->file-name head))
-               ((? string? uri)
-                (uri->file-name uri)))))
+         (origin-actual-file-name thing))
         ((string? thing)                          ;file name
          (or (basename thing)
              (error "basename" thing)))
-- 
2.4.3


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-guix-lint-Check-for-meaningful-origin-file-names.patch --]
[-- Type: text/x-diff; name=0002-guix-lint-Check-for-meaningful-origin-file-names.patch, Size: 9697 bytes --]

From 03c3f2b21a2467675092830aea2ddf192e133ff5 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Thu, 10 Sep 2015 15:34:58 -0500
Subject: [PATCH 2/2] guix: lint: Check for meaningful origin file names.

* guix/scripts/lint.scm (check-source-file-name): New procedure.
  (%checkers): Add 'source-file-name' checker.
* tests/lint.scm ("source: file name", "source: file name v")
  ("source: file name valid", "source: file name bad checkout")
  ("source: file name good checkout"): New tests.
* doc/guix.texi (Invoking guix lint): Mention file name check.
---
 doc/guix.texi         |  5 +++-
 guix/scripts/lint.scm | 75 +++++++++++++++++++++++++++++++----------------
 tests/lint.scm        | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 133 insertions(+), 27 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9ae91a8..6c563a9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4217,8 +4217,11 @@ Identify inputs that should most likely be native inputs.
 
 @item source
 @itemx home-page
+@itemx source-file-name
 Probe @code{home-page} and @code{source} URLs and report those that are
-invalid.
+invalid.  Check that the source file name is meaningful, e.g. is not
+just a version number or ``git-checkout'', and should not have a
+@code{file-name} declared (@pxref{origin Reference}).
 
 @item formatting
 Warn about obvious source code formatting issues: trailing white space,
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 2a618c9..6adea14 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
-;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -57,6 +57,7 @@
             check-derivation
             check-home-page
             check-source
+            check-source-file-name
             check-license
             check-formatting
 
@@ -476,30 +477,50 @@ descriptions maintained upstream."
       '()))
 
   (let ((origin (package-source package)))
-    (when (and origin
-               (eqv? (origin-method origin) url-fetch))
-      (let* ((strings (origin-uri origin))
-             (uris (if (list? strings)
-                       (map string->uri strings)
-                       (list (string->uri strings)))))
-
-        ;; Just make sure that at least one of the URIs is valid.
-        (call-with-values
-            (lambda () (try-uris uris))
-          (lambda (success? warnings)
-            ;; When everything fails, report all of WARNINGS, otherwise don't
-            ;; report anything.
-            ;;
-            ;; XXX: Ideally we'd still allow warnings to be raised if *some*
-            ;; URIs are unreachable, but distinguish that from the error case
-            ;; where *all* the URIs are unreachable.
-            (unless success?
-              (emit-warning package
-                            (_ "all the source URIs are unreachable:")
-                            'source)
-              (for-each (lambda (warning)
-                          (display warning (guix-warning-port)))
-                        (reverse warnings)))))))))
+    (when origin
+      (if (eqv? (origin-method origin) url-fetch)
+          (let* ((strings (origin-uri origin))
+                 (uris (if (list? strings)
+                           (map string->uri strings)
+                           (list (string->uri strings)))))
+
+            ;; Just make sure that at least one of the URIs is valid.
+            (call-with-values
+                (lambda () (try-uris uris))
+              (lambda (success? warnings)
+                ;; When everything fails, report all of WARNINGS, otherwise don't
+                ;; report anything.
+                ;;
+                ;; XXX: Ideally we'd still allow warnings to be raised if *some*
+                ;; URIs are unreachable, but distinguish that from the error case
+                ;; where *all* the URIs are unreachable.
+                (unless success?
+                  (emit-warning package
+                                (_ "all the source URIs are unreachable:")
+                                'source)
+                  (for-each (lambda (warning)
+                              (display warning (guix-warning-port)))
+                            (reverse warnings))))))))))
+
+(define (check-source-file-name package)
+  "Emit a warning if PACKAGE's origin has a version-only file name."
+  (define (origin-file-name-valid? origin)
+    ;; Return #t if the source file name contains only a version; indicates
+    ;; that the origin needs a 'file-name' field.
+    (let ((file-name (origin-actual-file-name origin))
+          (version (package-version package)))
+      (and file-name
+           (not (or (string-prefix? version file-name)
+                    ;; Common in many projects is for the filename to start
+                    ;; with a "v" followed by the version,
+                    ;; e.g. "v3.2.0.tar.gz".
+                    (string-prefix? (string-append "v" version) file-name))))))
+
+  (let ((origin (package-source package)))
+    (unless (or (not origin) (origin-file-name-valid? origin))
+      (emit-warning package
+                    (_ "the source file name should contain the package name")
+                    'source))))
 
 (define (check-derivation package)
   "Emit a warning if we fail to compile PACKAGE to a derivation."
@@ -643,6 +664,10 @@ or a list thereof")
      (description "Validate source URLs")
      (check       check-source))
    (lint-checker
+     (name        'source-file-name)
+     (description "Validate file names of sources")
+     (check       check-source-file-name))
+   (lint-checker
      (name        'derivation)
      (description "Report failure to compile a package to a derivation")
      (check       check-derivation))
diff --git a/tests/lint.scm b/tests/lint.scm
index ac47dbb..2fac284 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013 Cyril Roelandt <tipecaml@gmail.com>
-;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -21,6 +21,7 @@
 (define-module (test-lint)
   #:use-module (guix tests)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix packages)
   #:use-module (guix scripts lint)
@@ -398,6 +399,83 @@ requests."
           (check-home-page pkg))))
     "not reachable: 404")))
 
+(test-assert "source: file name"
+  (->bool
+   (string-contains
+    (with-warnings
+      (let ((pkg (dummy-package "x"
+                   (version "3.2.1")
+                   (source
+                    (origin
+                      (method url-fetch)
+                      (uri "http://www.example.com/3.2.1.tar.gz")
+                      (sha256 %null-sha256))))))
+        (check-source-file-name pkg)))
+    "file name should contain the package name")))
+
+(test-assert "source: file name v"
+  (->bool
+   (string-contains
+    (with-warnings
+      (let ((pkg (dummy-package "x"
+                   (version "3.2.1")
+                   (source
+                    (origin
+                      (method url-fetch)
+                      (uri "http://www.example.com/v3.2.1.tar.gz")
+                      (sha256 %null-sha256))))))
+        (check-source-file-name pkg)))
+    "file name should contain the package name")))
+
+(test-assert "source: file name bad checkout"
+  (->bool
+   (string-contains
+    (with-warnings
+      (let ((pkg (dummy-package "x"
+                   (version "3.2.1")
+                   (source
+                    (origin
+                      (method git-fetch)
+                      (uri (git-reference
+                            (url "http://www.example.com/x.git")
+                            (commit "0")))
+                      (sha256 %null-sha256))))))
+        (check-source-file-name pkg)))
+    "file name should contain the package name")))
+
+(test-assert "source: file name good checkout"
+  (not
+   (->bool
+    (string-contains
+     (with-warnings
+       (let ((pkg (dummy-package "x"
+                    (version "3.2.1")
+                    (source
+                     (origin
+                       (method git-fetch)
+                       (uri (git-reference
+                             (url "http://git.example.com/x.git")
+                             (commit "0")))
+                       (file-name (string-append "x-" version))
+                       (sha256 %null-sha256))))))
+         (check-source-file-name pkg)))
+     "file name should contain the package name"))))
+
+(test-assert "source: file name valid"
+  (not
+   (->bool
+    (string-contains
+     (with-warnings
+       (let ((pkg (dummy-package "x"
+                    (version "3.2.1")
+                    (source
+                     (origin
+                       (method url-fetch)
+                       (uri "http://www.example.com/x-3.2.1.tar.gz")
+                       (sha256 %null-sha256))))))
+         (check-source-file-name pkg)))
+     "file name should contain the package name"))))
+
 (test-skip (if %http-server-socket 0 1))
 (test-equal "source: 200"
   ""
-- 
2.4.3


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

* Re: [PATCH] guix: lint: Check for version-only origin file names.
  2015-09-11  4:04         ` Eric Bavier
@ 2015-09-13 16:59           ` Ludovic Courtès
  2015-09-14 23:11             ` Eric Bavier
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2015-09-13 16:59 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

Eric Bavier <ericbavier@openmailbox.org> skribis:

> From 8db3e5978394b99ad14d69494b00343b70f918e1 Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Thu, 10 Sep 2015 15:39:44 -0500
> Subject: [PATCH 1/2] guix: packages: Add origin-actual-file-name.
>
> * guix/scripts/graph.scm (uri->file-name, node-full-name): Move origin file
>   name logic to...
> * guix/packages.scm (origin-actual-file-name): ...here.

LGTM, but could you add a couple of tests (say one with a ‘file-name’
field and one without) in tests/packages.scm?

> From 03c3f2b21a2467675092830aea2ddf192e133ff5 Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Thu, 10 Sep 2015 15:34:58 -0500
> Subject: [PATCH 2/2] guix: lint: Check for meaningful origin file names.
>
> * guix/scripts/lint.scm (check-source-file-name): New procedure.
>   (%checkers): Add 'source-file-name' checker.
> * tests/lint.scm ("source: file name", "source: file name v")
>   ("source: file name valid", "source: file name bad checkout")
>   ("source: file name good checkout"): New tests.
> * doc/guix.texi (Invoking guix lint): Mention file name check.

[...]

> -    (when (and origin
> -               (eqv? (origin-method origin) url-fetch))
> -      (let* ((strings (origin-uri origin))
> -             (uris (if (list? strings)
> -                       (map string->uri strings)
> -                       (list (string->uri strings)))))
> -
> -        ;; Just make sure that at least one of the URIs is valid.
> -        (call-with-values
> -            (lambda () (try-uris uris))
> -          (lambda (success? warnings)
> -            ;; When everything fails, report all of WARNINGS, otherwise don't
> -            ;; report anything.
> -            ;;
> -            ;; XXX: Ideally we'd still allow warnings to be raised if *some*
> -            ;; URIs are unreachable, but distinguish that from the error case
> -            ;; where *all* the URIs are unreachable.
> -            (unless success?
> -              (emit-warning package
> -                            (_ "all the source URIs are unreachable:")
> -                            'source)
> -              (for-each (lambda (warning)
> -                          (display warning (guix-warning-port)))
> -                        (reverse warnings)))))))))
> +    (when origin
> +      (if (eqv? (origin-method origin) url-fetch)
> +          (let* ((strings (origin-uri origin))
> +                 (uris (if (list? strings)

I think this hunk should be omitted, no?

> +(test-assert "source: file name"

s/source:/source-file-name:/ for consistency.

OK with these changes.

Thank you!

Ludo’.

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

* Re: [PATCH] guix: lint: Check for version-only origin file names.
  2015-09-13 16:59           ` Ludovic Courtès
@ 2015-09-14 23:11             ` Eric Bavier
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Bavier @ 2015-09-14 23:11 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Sun, 13 Sep 2015 18:59:53 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

> Eric Bavier <ericbavier@openmailbox.org> skribis:
> 
> > From 8db3e5978394b99ad14d69494b00343b70f918e1 Mon Sep 17 00:00:00 2001
> > From: Eric Bavier <bavier@member.fsf.org>
> > Date: Thu, 10 Sep 2015 15:39:44 -0500
> > Subject: [PATCH 1/2] guix: packages: Add origin-actual-file-name.
> >
> > * guix/scripts/graph.scm (uri->file-name, node-full-name): Move origin file
> >   name logic to...
> > * guix/packages.scm (origin-actual-file-name): ...here.
> 
> LGTM, but could you add a couple of tests (say one with a ‘file-name’
> field and one without) in tests/packages.scm?

Done.

> 
> > From 03c3f2b21a2467675092830aea2ddf192e133ff5 Mon Sep 17 00:00:00 2001
> > From: Eric Bavier <bavier@member.fsf.org>
> > Date: Thu, 10 Sep 2015 15:34:58 -0500
> > Subject: [PATCH 2/2] guix: lint: Check for meaningful origin file names.
> >
> > * guix/scripts/lint.scm (check-source-file-name): New procedure.
> >   (%checkers): Add 'source-file-name' checker.
> > * tests/lint.scm ("source: file name", "source: file name v")
> >   ("source: file name valid", "source: file name bad checkout")
> >   ("source: file name good checkout"): New tests.
> > * doc/guix.texi (Invoking guix lint): Mention file name check.
> 
> [...]
> 
> > -    (when (and origin
> > -               (eqv? (origin-method origin) url-fetch))
> > -      (let* ((strings (origin-uri origin))
> > -             (uris (if (list? strings)
> > -                       (map string->uri strings)
> > -                       (list (string->uri strings)))))
> > -
> > -        ;; Just make sure that at least one of the URIs is valid.
> > -        (call-with-values
> > -            (lambda () (try-uris uris))
> > -          (lambda (success? warnings)
> > -            ;; When everything fails, report all of WARNINGS, otherwise don't
> > -            ;; report anything.
> > -            ;;
> > -            ;; XXX: Ideally we'd still allow warnings to be raised if *some*
> > -            ;; URIs are unreachable, but distinguish that from the error case
> > -            ;; where *all* the URIs are unreachable.
> > -            (unless success?
> > -              (emit-warning package
> > -                            (_ "all the source URIs are unreachable:")
> > -                            'source)
> > -              (for-each (lambda (warning)
> > -                          (display warning (guix-warning-port)))
> > -                        (reverse warnings)))))))))
> > +    (when origin
> > +      (if (eqv? (origin-method origin) url-fetch)
> > +          (let* ((strings (origin-uri origin))
> > +                 (uris (if (list? strings)
> 
> I think this hunk should be omitted, no?

Correct.  Thanks for catching it.

> 
> > +(test-assert "source: file name"
> 
> s/source:/source-file-name:/ for consistency.
> 
> OK with these changes.

Pushed as 50f5c46 and 3b4d010.

`~Eric

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

end of thread, other threads:[~2015-09-15  4:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-23 23:05 [PATCH] guix: lint: Check for version-only origin file names ericbavier
2015-08-24 23:02 ` Mark H Weaver
2015-08-25  0:10   ` Eric Bavier
2015-08-28  7:48     ` Ludovic Courtès
2015-09-10 20:50       ` Eric Bavier
2015-09-11  4:04         ` Eric Bavier
2015-09-13 16:59           ` Ludovic Courtès
2015-09-14 23:11             ` Eric Bavier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).