GNU bug report logs -
#34108
[PATCH] import: github: Use prereleases when package has no releases.
Previous Next
Reported by: Arun Isaac <arunisaac <at> systemreboot.net>
Date: Wed, 16 Jan 2019 20:12:01 UTC
Severity: normal
Tags: patch
Done: Arun Isaac <arunisaac <at> systemreboot.net>
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 34108 in the body.
You can then email your comments to 34108 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#34108
; Package
guix-patches
.
(Wed, 16 Jan 2019 20:12:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Arun Isaac <arunisaac <at> systemreboot.net>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Wed, 16 Jan 2019 20:12:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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).
[0001-import-github-Use-prereleases-when-package-has-no-re.patch (text/x-patch, inline)]
From df660be0d7756b792a8356c7b02855cc327a7494 Mon Sep 17 00:00:00 2001
From: Arun Isaac <arunisaac <at> 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
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#34108
; Package
guix-patches
.
(Fri, 18 Jan 2019 15:56:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 34108 <at> debbugs.gnu.org (full text, mbox):
Hello,
Arun Isaac <arunisaac <at> 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 <at> 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’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#34108
; Package
guix-patches
.
(Sun, 20 Jan 2019 20:18:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 34108 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> 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))))
I have made this change. In addition, I have also made another patch
improving the readability of the function by using any and cond. Please
find both patches attached.
[0001-import-github-Use-prereleases-when-package-has-no-re.patch (text/x-patch, inline)]
From f4347eaf3f4516a40bba563a3ec56a7d6b16b7fb Mon Sep 17 00:00:00 2001
From: Arun Isaac <arunisaac <at> systemreboot.net>
Date: Thu, 17 Jan 2019 01:34:07 +0530
Subject: [PATCH 1/2] 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 | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/guix/import/github.scm b/guix/import/github.scm
index e17ef0b840..c78469dac5 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -171,6 +171,9 @@ empty list."
"Return a string of the newest released version name given a string URL like
'https://github.com/arq5x/bedtools2/archive/v2.24.0.tar.gz' and the name of
the package e.g. 'bedtools2'. Return #f if there is no releases"
+ (define (pre-release? x)
+ (hash-ref x "prerelease"))
+
(let* ((json (fetch-releases-or-tags url)))
(if (eq? json #f)
(if (%github-token)
@@ -181,14 +184,9 @@ 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)))
+ (match (remove pre-release? json)
+ (() json) ; keep everything
+ (releases releases))))
(match releases
(() ;empty release list
#f)
--
2.19.2
[0002-import-github-Improve-readability.patch (text/x-patch, inline)]
From 10dd67dd2980f532cfffc98a4d8042be5ac34f1e Mon Sep 17 00:00:00 2001
From: Arun Isaac <arunisaac <at> systemreboot.net>
Date: Mon, 21 Jan 2019 01:43:09 +0530
Subject: [PATCH 2/2] import: github: Improve readability.
* guix/import/github.scm (latest-released-version): Use any and cond instead
of a recursive loop and an if-else ladder respectively.
---
guix/import/github.scm | 55 ++++++++++++++++++++----------------------
1 file changed, 26 insertions(+), 29 deletions(-)
diff --git a/guix/import/github.scm b/guix/import/github.scm
index c78469dac5..4d12339204 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -183,35 +183,32 @@ API when using a GitHub token")
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
- (match (remove pre-release? json)
- (() json) ; keep everything
- (releases releases))))
- (match releases
- (() ;empty release list
- #f)
- ((release . rest) ;one or more releases
- (let ((tag (or (hash-ref release "tag_name") ;a "release"
- (hash-ref release "name"))) ;a tag
- (name-length (string-length package-name)))
- ;; some tags include the name of the package e.g. "fdupes-1.51"
- ;; so remove these
- (if (and (< name-length (string-length tag))
- (string=? (string-append package-name "-")
- (substring tag 0 (+ name-length 1))))
- (substring tag (+ name-length 1))
- ;; some tags start with a "v" e.g. "v0.25.0"
- ;; where some are just the version number
- (if (string-prefix? "v" tag)
- (substring tag 1)
-
- ;; Finally, reject tags that don't start with a digit:
- ;; they may not represent a release.
- (if (and (not (string-null? tag))
- (char-set-contains? char-set:digit
- (string-ref tag 0)))
- tag
- (loop rest)))))))))))
+ (any
+ (lambda (release)
+ (let ((tag (or (hash-ref release "tag_name") ;a "release"
+ (hash-ref release "name"))) ;a tag
+ (name-length (string-length package-name)))
+ (cond
+ ;; some tags include the name of the package e.g. "fdupes-1.51"
+ ;; so remove these
+ ((and (< name-length (string-length tag))
+ (string=? (string-append package-name "-")
+ (substring tag 0 (+ name-length 1))))
+ (substring tag (+ name-length 1)))
+ ;; some tags start with a "v" e.g. "v0.25.0"
+ ;; where some are just the version number
+ ((string-prefix? "v" tag)
+ (substring tag 1))
+ ;; Finally, reject tags that don't start with a digit:
+ ;; they may not represent a release.
+ ((and (not (string-null? tag))
+ (char-set-contains? char-set:digit
+ (string-ref tag 0)))
+ tag)
+ (else #f))))
+ (match (remove pre-release? json)
+ (() json) ; keep everything
+ (releases releases))))))
(define (latest-release pkg)
"Return an <upstream-source> for the latest release of PKG."
--
2.19.2
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#34108
; Package
guix-patches
.
(Mon, 21 Jan 2019 09:45:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 34108 <at> debbugs.gnu.org (full text, mbox):
Hello!
Arun Isaac <arunisaac <at> systemreboot.net> skribis:
>> 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))))
>
> I have made this change. In addition, I have also made another patch
> improving the readability of the function by using any and cond. Please
> find both patches attached.
Both LGTM, thanks for the cleanups!
Ludo’.
Reply sent
to
Arun Isaac <arunisaac <at> systemreboot.net>
:
You have taken responsibility.
(Mon, 21 Jan 2019 12:37:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Arun Isaac <arunisaac <at> systemreboot.net>
:
bug acknowledged by developer.
(Mon, 21 Jan 2019 12:37:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 34108-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> Both LGTM, thanks for the cleanups!
Pushed, thanks for the review!
[signature.asc (application/pgp-signature, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 19 Feb 2019 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 66 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.