unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26772: [PATCH 0/3] Fix guix refresh errors.
@ 2017-05-04 10:04 Mathieu Othacehe
  2017-05-04 10:06 ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
  0 siblings, 1 reply; 10+ messages in thread
From: Mathieu Othacehe @ 2017-05-04 10:04 UTC (permalink / raw)
  To: 26772

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

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

* bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri.
  2017-05-04 10:04 bug#26772: [PATCH 0/3] Fix guix refresh errors Mathieu Othacehe
@ 2017-05-04 10:06 ` Mathieu Othacehe
  2017-05-04 10:06   ` bug#26772: [PATCH 2/3] import: cran: Robustify cran-package? Mathieu Othacehe
                     ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Mathieu Othacehe @ 2017-05-04 10:06 UTC (permalink / raw)
  To: 26772

* 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@gnu.org>
 ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
 ;;; Copyright © 2016, 2017 Raoul Bonnal <ilpuccio.febo@gmail.com>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
-- 
2.12.2

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

* bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?.
  2017-05-04 10:06 ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
@ 2017-05-04 10:06   ` Mathieu Othacehe
  2017-05-12 22:11     ` Ludovic Courtès
  2017-05-04 10:06   ` bug#26772: [PATCH 3/3] import: pypi: Robustify latest-release Mathieu Othacehe
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Mathieu Othacehe @ 2017-05-04 10:06 UTC (permalink / raw)
  To: 26772

* 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@elephly.net>
 ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@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

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

* bug#26772: [PATCH 3/3] import: pypi: Robustify latest-release.
  2017-05-04 10:06 ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
  2017-05-04 10:06   ` bug#26772: [PATCH 2/3] import: cran: Robustify cran-package? Mathieu Othacehe
@ 2017-05-04 10:06   ` Mathieu Othacehe
  2017-05-12 22:11     ` Ludovic Courtès
  2017-05-04 10:09   ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
  2017-05-12 22:07   ` Ludovic Courtès
  3 siblings, 1 reply; 10+ messages in thread
From: Mathieu Othacehe @ 2017-05-04 10:06 UTC (permalink / raw)
  To: 26772

* 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@gnu.org>
 ;;; Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
 ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@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

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

* bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri.
  2017-05-04 10:06 ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
  2017-05-04 10:06   ` bug#26772: [PATCH 2/3] import: cran: Robustify cran-package? Mathieu Othacehe
  2017-05-04 10:06   ` bug#26772: [PATCH 3/3] import: pypi: Robustify latest-release Mathieu Othacehe
@ 2017-05-04 10:09   ` Mathieu Othacehe
  2017-05-12 22:07   ` Ludovic Courtès
  3 siblings, 0 replies; 10+ messages in thread
From: Mathieu Othacehe @ 2017-05-04 10:09 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 26772


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@gnu.org>
>  ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
>  ;;; Copyright © 2016, 2017 Raoul Bonnal <ilpuccio.febo@gmail.com>
> +;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;

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

* bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri.
  2017-05-04 10:06 ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
                     ` (2 preceding siblings ...)
  2017-05-04 10:09   ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
@ 2017-05-12 22:07   ` Ludovic Courtès
  3 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2017-05-12 22:07 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 26772

Mathieu Othacehe <m.othacehe@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!

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

* bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?.
  2017-05-04 10:06   ` bug#26772: [PATCH 2/3] import: cran: Robustify cran-package? Mathieu Othacehe
@ 2017-05-12 22:11     ` Ludovic Courtès
  2017-05-13 10:44       ` Mathieu Othacehe
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2017-05-12 22:11 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 26772

Mathieu Othacehe <m.othacehe@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’.

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

* bug#26772: [PATCH 3/3] import: pypi: Robustify latest-release.
  2017-05-04 10:06   ` bug#26772: [PATCH 3/3] import: pypi: Robustify latest-release Mathieu Othacehe
@ 2017-05-12 22:11     ` Ludovic Courtès
  0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2017-05-12 22:11 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 26772

Mathieu Othacehe <m.othacehe@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’.

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

* bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?.
  2017-05-12 22:11     ` Ludovic Courtès
@ 2017-05-13 10:44       ` Mathieu Othacehe
  2017-05-13 13:12         ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Mathieu Othacehe @ 2017-05-13 10:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 26772-done


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

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

* bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?.
  2017-05-13 10:44       ` Mathieu Othacehe
@ 2017-05-13 13:12         ` Ludovic Courtès
  0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2017-05-13 13:12 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 26772-done

Mathieu Othacehe <m.othacehe@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’.

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

end of thread, other threads:[~2017-05-13 13:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04 10:04 bug#26772: [PATCH 0/3] Fix guix refresh errors Mathieu Othacehe
2017-05-04 10:06 ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
2017-05-04 10:06   ` bug#26772: [PATCH 2/3] import: cran: Robustify cran-package? Mathieu Othacehe
2017-05-12 22:11     ` Ludovic Courtès
2017-05-13 10:44       ` Mathieu Othacehe
2017-05-13 13:12         ` Ludovic Courtès
2017-05-04 10:06   ` bug#26772: [PATCH 3/3] import: pypi: Robustify latest-release Mathieu Othacehe
2017-05-12 22:11     ` Ludovic Courtès
2017-05-04 10:09   ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
2017-05-12 22:07   ` Ludovic Courtès

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