GNU bug report logs - #26772
[PATCH 0/3] Fix guix refresh errors.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <m.othacehe <at> gmail.com>

Date: Thu, 4 May 2017 10:06:01 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <m.othacehe <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26772 in the body.
You can then email your comments to 26772 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#26772; Package guix-patches. (Thu, 04 May 2017 10:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mathieu Othacehe <m.othacehe <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 04 May 2017 10:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: [PATCH 0/3] Fix guix refresh errors.
Date: Thu,  4 May 2017 12:04:41 +0200
Hi Guix,

This serie fixes problems I ran into when running
guix refresh.

Thanks,

Mathieu

Mathieu Othacehe (3):
  gnu: python-termcolor: Fix uri.
  import: cran: Robustify cran-package?.
  import: pypi: Robustify latest-release.

 gnu/packages/python.scm     |  2 +-
 gnu/packages/statistics.scm |  1 +
 guix/import/cran.scm        |  7 ++++++-
 guix/import/pypi.scm        | 21 ++++++++++++---------
 4 files changed, 20 insertions(+), 11 deletions(-)

-- 
2.12.2





Information forwarded to guix-patches <at> gnu.org:
bug#26772; Package guix-patches. (Thu, 04 May 2017 10:07:02 GMT) Full text and rfc822 format available.

Message #8 received at 26772 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: 26772 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: [PATCH 1/3] gnu: python-termcolor: Fix uri.
Date: Thu,  4 May 2017 12:06:25 +0200
* gnu/packages/python.scm (python-termcolor): Remove "python-" from
  pypi uri.

This was causing guix refresh to fail on this package.
---
 gnu/packages/python.scm     | 2 +-
 gnu/packages/statistics.scm | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4c7aee20c..f88828ac1 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -7489,7 +7489,7 @@ a hash value.")
     (source
      (origin
        (method url-fetch)
-       (uri (pypi-uri "python-termcolor" version))
+       (uri (pypi-uri "termcolor" version))
        (sha256
         (base32
          "0fv1vq14rpqwgazxg4981904lfyp84mnammw7y046491cv76jv8x"))))
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index b81bb4207..9c646e15f 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2016 Roel Janssen <roel <at> gnu.org>
 ;;; Copyright © 2016 Ben Woodcroft <donttrustben <at> gmail.com>
 ;;; Copyright © 2016, 2017 Raoul Bonnal <ilpuccio.febo <at> gmail.com>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
-- 
2.12.2





Information forwarded to guix-patches <at> gnu.org:
bug#26772; Package guix-patches. (Thu, 04 May 2017 10:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 26772 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: 26772 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: [PATCH 2/3] import: cran: Robustify cran-package?.
Date: Thu,  4 May 2017 12:06:26 +0200
* guix/import/cran.scm (package->upstream-name): Return #f if url
  start and end index could not be determined.
  (cran-package?): Check if the upstream-name can be extracted from
  given package.

This fixes a failure of guix refresh on r-minimal because no
upsteam-name can be determined from ".../R-version.tar.gz" uri.
---
 guix/import/cran.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index be34a75c8..20009e2af 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -374,7 +375,8 @@ dependencies."
                     (start (string-rindex url #\/)))
                 ;; The URL ends on
                 ;; (string-append "/" name "_" version ".tar.gz")
-                (substring url (+ start 1) end)))
+                (if (and start end)
+                    (substring url (+ start 1) end) #f)))
              (_ #f)))
           (_ #f)))))
 
@@ -415,6 +417,9 @@ dependencies."
 (define (cran-package? package)
   "Return true if PACKAGE is an R package from CRAN."
   (and (string-prefix? "r-" (package-name package))
+       ;; Check if the upstream name can be extracted from package uri.
+       (package->upstream-name package)
+       ;; Check if package uri(s) are prefixed by "mirror://cran".
        (match (and=> (package-source package) origin-uri)
          ((? string? uri)
           (string-prefix? "mirror://cran" uri))
-- 
2.12.2





Information forwarded to guix-patches <at> gnu.org:
bug#26772; Package guix-patches. (Thu, 04 May 2017 10:07:03 GMT) Full text and rfc822 format available.

Message #14 received at 26772 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: 26772 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: [PATCH 3/3] import: pypi: Robustify latest-release.
Date: Thu,  4 May 2017 12:06:27 +0200
* guix/import/pypi.scm (latest-release): Check if pypi-fetch has
  failed. If so return #f, else construct the <upstream-source>.
---
 guix/import/pypi.scm | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 4f9518f2e..9c72e7331 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2014 David Thompson <davet <at> gnu.org>
 ;;; Copyright © 2015 Cyril Roelandt <tipecaml <at> gmail.com>
 ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -322,15 +323,17 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
 
 (define (latest-release package)
   "Return an <upstream-source> for the latest release of PACKAGE."
-  (guard (c ((missing-source-error? c) #f))
-    (let* ((pypi-name (guix-package->pypi-name package))
-           (metadata (pypi-fetch pypi-name))
-           (version (assoc-ref* metadata "info" "version"))
-           (url (assoc-ref (latest-source-release metadata) "url")))
-      (upstream-source
-       (package (package-name package))
-       (version version)
-       (urls (list url))))))
+  (let* ((pypi-name    (guix-package->pypi-name package))
+         (pypi-package (pypi-fetch pypi-name)))
+    (and pypi-package
+         (guard (c ((missing-source-error? c) #f))
+           (let* ((metadata pypi-package)
+                  (version (assoc-ref* metadata "info" "version"))
+                  (url (assoc-ref (latest-source-release metadata) "url")))
+             (upstream-source
+              (package (package-name package))
+              (version version)
+              (urls (list url))))))))
 
 (define %pypi-updater
   (upstream-updater
-- 
2.12.2





Information forwarded to guix-patches <at> gnu.org:
bug#26772; Package guix-patches. (Thu, 04 May 2017 10:10:01 GMT) Full text and rfc822 format available.

Message #17 received at 26772 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 26772 <at> debbugs.gnu.org
Subject: Re: [PATCH 1/3] gnu: python-termcolor: Fix uri.
Date: Thu, 04 May 2017 12:09:26 +0200
Oops, wrong file for copyright, I would fix it when commiting.

> +++ b/gnu/packages/statistics.scm
> @@ -7,6 +7,7 @@
>  ;;; Copyright © 2016 Roel Janssen <roel <at> gnu.org>
>  ;;; Copyright © 2016 Ben Woodcroft <donttrustben <at> gmail.com>
>  ;;; Copyright © 2016, 2017 Raoul Bonnal <ilpuccio.febo <at> gmail.com>
> +;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;





Information forwarded to guix-patches <at> gnu.org:
bug#26772; Package guix-patches. (Fri, 12 May 2017 22:09:02 GMT) Full text and rfc822 format available.

Message #20 received at 26772 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 26772 <at> debbugs.gnu.org
Subject: Re: bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri.
Date: Sat, 13 May 2017 00:07:52 +0200
Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:

> * gnu/packages/python.scm (python-termcolor): Remove "python-" from
>   pypi uri.
>
> This was causing guix refresh to fail on this package.

OK!




Information forwarded to guix-patches <at> gnu.org:
bug#26772; Package guix-patches. (Fri, 12 May 2017 22:12:01 GMT) Full text and rfc822 format available.

Message #23 received at 26772 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 26772 <at> debbugs.gnu.org
Subject: Re: bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?.
Date: Sat, 13 May 2017 00:11:04 +0200
Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:

> * guix/import/cran.scm (package->upstream-name): Return #f if url
>   start and end index could not be determined.
>   (cran-package?): Check if the upstream-name can be extracted from
>   given package.

[...]

> @@ -374,7 +375,8 @@ dependencies."
>                      (start (string-rindex url #\/)))
>                  ;; The URL ends on
>                  ;; (string-append "/" name "_" version ".tar.gz")
> -                (substring url (+ start 1) end)))
> +                (if (and start end)
> +                    (substring url (+ start 1) end) #f)))

This can be written as:

  (and start end (substring url …))

> @@ -415,6 +417,9 @@ dependencies."
>  (define (cran-package? package)
>    "Return true if PACKAGE is an R package from CRAN."
>    (and (string-prefix? "r-" (package-name package))
> +       ;; Check if the upstream name can be extracted from package uri.
> +       (package->upstream-name package)
> +       ;; Check if package uri(s) are prefixed by "mirror://cran".
>         (match (and=> (package-source package) origin-uri)
>           ((? string? uri)
>            (string-prefix? "mirror://cran" uri))

OK!

Do you think you could add this specific case (r-minimal) as a test case
for ‘cran-package?’ in tests/cran.scm?  That would be awesome.

Otherwise LGTM, thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#26772; Package guix-patches. (Fri, 12 May 2017 22:12:02 GMT) Full text and rfc822 format available.

Message #26 received at 26772 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 26772 <at> debbugs.gnu.org
Subject: Re: bug#26772: [PATCH 3/3] import: pypi: Robustify latest-release.
Date: Sat, 13 May 2017 00:11:47 +0200
Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:

> * guix/import/pypi.scm (latest-release): Check if pypi-fetch has
>   failed. If so return #f, else construct the <upstream-source>.

OK!

Thanks for fixing all these things!

Ludo’.




Reply sent to Mathieu Othacehe <m.othacehe <at> gmail.com>:
You have taken responsibility. (Sat, 13 May 2017 10:46:02 GMT) Full text and rfc822 format available.

Notification sent to Mathieu Othacehe <m.othacehe <at> gmail.com>:
bug acknowledged by developer. (Sat, 13 May 2017 10:46:02 GMT) Full text and rfc822 format available.

Message #31 received at 26772-done <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 26772-done <at> debbugs.gnu.org
Subject: Re: bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?.
Date: Sat, 13 May 2017 12:44:57 +0200
Hi Ludo !

Thanks for the review.

> This can be written as:
>
>   (and start end (substring url …))

Done.

>
>> @@ -415,6 +417,9 @@ dependencies."
>>  (define (cran-package? package)
>>    "Return true if PACKAGE is an R package from CRAN."
>>    (and (string-prefix? "r-" (package-name package))
>> +       ;; Check if the upstream name can be extracted from package uri.
>> +       (package->upstream-name package)
>> +       ;; Check if package uri(s) are prefixed by "mirror://cran".
>>         (match (and=> (package-source package) origin-uri)
>>           ((? string? uri)
>>            (string-prefix? "mirror://cran" uri))
>
> OK!
>
> Do you think you could add this specific case (r-minimal) as a test case
> for ‘cran-package?’ in tests/cran.scm?  That would be awesome.
>
> Otherwise LGTM, thanks!

Sure I pushed this patch with the change above and a new test in
tests/cran.scm :

--8<---------------cut here---------------start------------->8---
(test-equal "r-mininal is not a cran package"
  #f
  ((@@ (guix import cran) cran-package?) r-minimal))
--8<---------------cut here---------------end--------------->8---

I also pushed the two other patches of the serie.

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#26772; Package guix-patches. (Sat, 13 May 2017 13:13:02 GMT) Full text and rfc822 format available.

Message #34 received at 26772-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 26772-done <at> debbugs.gnu.org
Subject: Re: bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?.
Date: Sat, 13 May 2017 15:12:38 +0200
Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:

>> Do you think you could add this specific case (r-minimal) as a test case
>> for ‘cran-package?’ in tests/cran.scm?  That would be awesome.
>>
>> Otherwise LGTM, thanks!
>
> Sure I pushed this patch with the change above and a new test in
> tests/cran.scm :
>
> (test-equal "r-mininal is not a cran package"
>   #f
>   ((@@ (guix import cran) cran-package?) r-minimal))
>
> I also pushed the two other patches of the serie.

Perfect, thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 11 Jun 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 103 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.