[bug#34108] import: github: Use prereleases when package has no releases.

Message ID cu77ef4l5wu.fsf@systemreboot.net
State Accepted
Headers show
Series [bug#34108] import: github: Use prereleases when package has no releases. | expand

Checks

Context Check Description
cbaines/applying patch fail Apply failed

Commit Message

Arun Isaac Jan. 16, 2019, 8:10 p.m. UTC
For github packages with only prereleases (that is, no releases), `guix
refresh PACKAGE` prints out the no-updater warning. This is incorrect
behavior. It should instead fall back to using preleases. This patch
fixes that.

For an example, see the package quaternion in (gnu packages messaging).

Comments

Ludovic Courtès Jan. 18, 2019, 3:55 p.m. UTC | #1
Hello,

Arun Isaac <arunisaac@systemreboot.net> skribis:

> For github packages with only prereleases (that is, no releases), `guix
> refresh PACKAGE` prints out the no-updater warning. This is incorrect
> behavior. It should instead fall back to using preleases. This patch
> fixes that.
>
> For an example, see the package quaternion in (gnu packages messaging).

Makes sense.

> From df660be0d7756b792a8356c7b02855cc327a7494 Mon Sep 17 00:00:00 2001
> From: Arun Isaac <arunisaac@systemreboot.net>
> Date: Thu, 17 Jan 2019 01:34:07 +0530
> Subject: [PATCH] import: github: Use prereleases when package has no releases.
>
> * guix/import/github.scm (latest-released-version): Use preleases when package
> has no releases.
> ---
>  guix/import/github.scm | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/guix/import/github.scm b/guix/import/github.scm
> index b287313d98..624b8c5a66 100644
> --- a/guix/import/github.scm
> +++ b/guix/import/github.scm
> @@ -179,14 +179,16 @@ API. This may be fixed by using an access token and setting the environment
>  variable GUIX_GITHUB_TOKEN, for instance one procured from
>  https://github.com/settings/tokens"))
>          (let loop ((releases
> -                    (filter
> -                     (lambda (x)
> -                       ;; example pre-release:
> -                       ;; https://github.com/wwood/OrfM/releases/tag/v0.5.1
> -                       ;; or an all-prerelease set
> -                       ;; https://github.com/powertab/powertabeditor/releases
> -                       (not (hash-ref x "prerelease")))
> -                     json)))
> +                    (if (null?
> +                         (filter
> +                          (lambda (x)
> +                            ;; example pre-release:
> +                            ;; https://github.com/wwood/OrfM/releases/tag/v0.5.1
> +                            ;; or an all-prerelease set
> +                            ;; https://github.com/powertab/powertabeditor/releases
> +                            (not (hash-ref x "prerelease")))
> +                          json))
> +                        json)))

To improve readability, could you define a ‘pre-release?’ procedure so
we can write:

  let ((releases (match (remove pre-release? json)
                   (() json)  ;keep everything
                   (releases releases))))

OK with a change along these lines, thank you!

Ludo’.

Patch

From df660be0d7756b792a8356c7b02855cc327a7494 Mon Sep 17 00:00:00 2001
From: Arun Isaac <arunisaac@systemreboot.net>
Date: Thu, 17 Jan 2019 01:34:07 +0530
Subject: [PATCH] import: github: Use prereleases when package has no releases.

* guix/import/github.scm (latest-released-version): Use preleases when package
has no releases.
---
 guix/import/github.scm | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/guix/import/github.scm b/guix/import/github.scm
index b287313d98..624b8c5a66 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -179,14 +179,16 @@  API. This may be fixed by using an access token and setting the environment
 variable GUIX_GITHUB_TOKEN, for instance one procured from
 https://github.com/settings/tokens"))
         (let loop ((releases
-                    (filter
-                     (lambda (x)
-                       ;; example pre-release:
-                       ;; https://github.com/wwood/OrfM/releases/tag/v0.5.1
-                       ;; or an all-prerelease set
-                       ;; https://github.com/powertab/powertabeditor/releases
-                       (not (hash-ref x "prerelease")))
-                     json)))
+                    (if (null?
+                         (filter
+                          (lambda (x)
+                            ;; example pre-release:
+                            ;; https://github.com/wwood/OrfM/releases/tag/v0.5.1
+                            ;; or an all-prerelease set
+                            ;; https://github.com/powertab/powertabeditor/releases
+                            (not (hash-ref x "prerelease")))
+                          json))
+                        json)))
           (match releases
             (()                                   ;empty release list
              #f)
-- 
2.19.2