GNU bug report logs - #52774
[PATCH] import: elpa: Also check NonGNU ELPA for updates.

Previous Next

Package: guix-patches;

Reported by: Xinglu Chen <public <at> yoctocell.xyz>

Date: Fri, 24 Dec 2021 11:26:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

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 52774 in the body.
You can then email your comments to 52774 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#52774; Package guix-patches. (Fri, 24 Dec 2021 11:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xinglu Chen <public <at> yoctocell.xyz>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 24 Dec 2021 11:26:02 GMT) Full text and rfc822 format available.

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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: guix-patches <at> gnu.org
Subject: [PATCH] import: elpa: Also check NonGNU ELPA for updates.
Date: Fri, 24 Dec 2021 12:25:21 +0100
* elpa.scm (latest-release): Determine the repository based on the URL of the
source.
(package-from-gnu.org?): Rename to ...
(package-from-gnu.org-or-nongnu.org?): ...this.
(%elpa-updater): Adjust accordingly.
---
 guix/import/elpa.scm | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index edabb88b7a..038379e01b 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -424,7 +424,11 @@ (define (guix-package->elpa-name package)
 (define (latest-release package)
   "Return an <upstream-release> for the latest release of PACKAGE."
   (define name (guix-package->elpa-name package))
-  (define repo 'gnu)
+  (define repo
+    (let ((url (origin-uri (package-source package))))
+      (if (string-prefix? "https://elpa.nongnu.org" url)
+          'nongnu
+          'gnu)))
 
   (match (elpa-package-info name repo)
     (#f
@@ -443,11 +447,12 @@ (define repo 'gnu)
         (urls (list url))
         (signature-urls (list (string-append url ".sig"))))))))
 
-(define package-from-gnu.org?
+(define package-from-gnu.org-or-nongnu.org?
   (url-predicate (lambda (url)
                    (let ((uri (string->uri url)))
                      (and uri
-                          (string=? (uri-host uri) "elpa.gnu.org"))))))
+                          (or (string=? (uri-host uri) "elpa.gnu.org")
+                              (string=? (uri-host uri) "elpa.nongnu.org")))))))
 
 (define %elpa-updater
   ;; The ELPA updater.  We restrict it to packages hosted on elpa.gnu.org
@@ -455,7 +460,7 @@ (define %elpa-updater
   (upstream-updater
    (name 'elpa)
    (description "Updater for ELPA packages")
-   (pred package-from-gnu.org?)
+   (pred package-from-gnu.org-or-nongnu.org?)
    (latest latest-release)))
 
 (define elpa-guix-name (cut guix-name "emacs-" <>))

base-commit: e8c1562599c7ebee8b7b228237fb0d75d4472a61
-- 
2.33.1







Information forwarded to guix-patches <at> gnu.org:
bug#52774; Package guix-patches. (Fri, 24 Dec 2021 12:18:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Xinglu Chen <public <at> yoctocell.xyz>, 52774 <at> debbugs.gnu.org
Subject: Re: [PATCH] import: elpa: Also check NonGNU ELPA for updates.
Date: Fri, 24 Dec 2021 13:17:05 +0100
Am Freitag, dem 24.12.2021 um 12:25 +0100 schrieb Xinglu Chen:
> * elpa.scm (latest-release): Determine the repository based on the
> URL of the
> source.
> (package-from-gnu.org?): Rename to ...
> (package-from-gnu.org-or-nongnu.org?): ...this.
> (%elpa-updater): Adjust accordingly.
> ---
>  guix/import/elpa.scm | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
> index edabb88b7a..038379e01b 100644
> --- a/guix/import/elpa.scm
> +++ b/guix/import/elpa.scm
> @@ -424,7 +424,11 @@ (define (guix-package->elpa-name package)
>  (define (latest-release package)
>    "Return an <upstream-release> for the latest release of PACKAGE."
>    (define name (guix-package->elpa-name package))
> -  (define repo 'gnu)
> +  (define repo
> +    (let ((url (origin-uri (package-source package))))
> +      (if (string-prefix? "https://elpa.nongnu.org" url)
> +          'nongnu
> +          'gnu)))
>  
>    (match (elpa-package-info name repo)
>      (#f
> @@ -443,11 +447,12 @@ (define repo 'gnu)
>          (urls (list url))
>          (signature-urls (list (string-append url ".sig"))))))))
>  
> -(define package-from-gnu.org?
> +(define package-from-gnu.org-or-nongnu.org?
>    (url-predicate (lambda (url)
>                     (let ((uri (string->uri url)))
>                       (and uri
> -                          (string=? (uri-host uri)
> "elpa.gnu.org"))))))
> +                          (or (string=? (uri-host uri)
> "elpa.gnu.org")
> +                              (string=? (uri-host uri)
> "elpa.nongnu.org")))))))
>  
>  (define %elpa-updater
>    ;; The ELPA updater.  We restrict it to packages hosted on
> elpa.gnu.org
> @@ -455,7 +460,7 @@ (define %elpa-updater
>    (upstream-updater
>     (name 'elpa)
>     (description "Updater for ELPA packages")
> -   (pred package-from-gnu.org?)
> +   (pred package-from-gnu.org-or-nongnu.org?)
>     (latest latest-release)))
>  
>  (define elpa-guix-name (cut guix-name "emacs-" <>))
> 
> base-commit: e8c1562599c7ebee8b7b228237fb0d75d4472a61
Could we make it so that package-from-gnu.org? becomes elpa-package?
s.t. (member (elpa-package? pkg) '(gnu nongnu #f)) and its evaluation
can be reused?  If not, I'd still use a cond or match in the definition
of repo.

Otherwise LGTM, cheers! 





Information forwarded to guix-patches <at> gnu.org:
bug#52774; Package guix-patches. (Sat, 25 Dec 2021 09:46:02 GMT) Full text and rfc822 format available.

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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 52774 <at> debbugs.gnu.org
Subject: Re: [PATCH] import: elpa: Also check NonGNU ELPA for updates.
Date: Sat, 25 Dec 2021 10:44:43 +0100
[Message part 1 (text/plain, inline)]
Liliana schrieb am Freitag der 24. Dezember 2021 um 13:17 +01:

> Am Freitag, dem 24.12.2021 um 12:25 +0100 schrieb Xinglu Chen:
>> * elpa.scm (latest-release): Determine the repository based on the
>> URL of the
>> source.
>> (package-from-gnu.org?): Rename to ...
>> (package-from-gnu.org-or-nongnu.org?): ...this.
>> (%elpa-updater): Adjust accordingly.
>> ---
>>  guix/import/elpa.scm | 13 +++++++++----
>>  1 file changed, 9 insertions(+), 4 deletions(-)
>> 
>> diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
>> index edabb88b7a..038379e01b 100644
>> --- a/guix/import/elpa.scm
>> +++ b/guix/import/elpa.scm
>> @@ -424,7 +424,11 @@ (define (guix-package->elpa-name package)
>>  (define (latest-release package)
>>    "Return an <upstream-release> for the latest release of PACKAGE."
>>    (define name (guix-package->elpa-name package))
>> -  (define repo 'gnu)
>> +  (define repo
>> +    (let ((url (origin-uri (package-source package))))
>> +      (if (string-prefix? "https://elpa.nongnu.org" url)
>> +          'nongnu
>> +          'gnu)))
>>  
>>    (match (elpa-package-info name repo)
>>      (#f
>> @@ -443,11 +447,12 @@ (define repo 'gnu)
>>          (urls (list url))
>>          (signature-urls (list (string-append url ".sig"))))))))
>>  
>> -(define package-from-gnu.org?
>> +(define package-from-gnu.org-or-nongnu.org?
>>    (url-predicate (lambda (url)
>>                     (let ((uri (string->uri url)))
>>                       (and uri
>> -                          (string=? (uri-host uri)
>> "elpa.gnu.org"))))))
>> +                          (or (string=? (uri-host uri)
>> "elpa.gnu.org")
>> +                              (string=? (uri-host uri)
>> "elpa.nongnu.org")))))))
>>  
>>  (define %elpa-updater
>>    ;; The ELPA updater.  We restrict it to packages hosted on
>> elpa.gnu.org
>> @@ -455,7 +460,7 @@ (define %elpa-updater
>>    (upstream-updater
>>     (name 'elpa)
>>     (description "Updater for ELPA packages")
>> -   (pred package-from-gnu.org?)
>> +   (pred package-from-gnu.org-or-nongnu.org?)
>>     (latest latest-release)))
>>  
>>  (define elpa-guix-name (cut guix-name "emacs-" <>))
>> 
>> base-commit: e8c1562599c7ebee8b7b228237fb0d75d4472a61
> Could we make it so that package-from-gnu.org? becomes elpa-package?
> s.t. (member (elpa-package? pkg) '(gnu nongnu #f)) and its evaluation
> can be reused?

Wouldn’t it be enough with just '(gnu nongnu)?

We could make the ‘elpa-package?’ procedure memoized to avoid evaluating
the same thing twice.

> Otherwise LGTM, cheers!

Cool, thanks for taking a look!
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#52774; Package guix-patches. (Sat, 25 Dec 2021 10:16:01 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Xinglu Chen <public <at> yoctocell.xyz>, 52774 <at> debbugs.gnu.org
Subject: Re: [PATCH] import: elpa: Also check NonGNU ELPA for updates.
Date: Sat, 25 Dec 2021 11:15:10 +0100
Am Samstag, dem 25.12.2021 um 10:44 +0100 schrieb Xinglu Chen:
> Liliana schrieb am Freitag der 24. Dezember 2021 um 13:17 +01:
> 
> > Am Freitag, dem 24.12.2021 um 12:25 +0100 schrieb Xinglu Chen:
> > > * elpa.scm (latest-release): Determine the repository based on
> > > the URL of the source.
> > > (package-from-gnu.org?): Rename to ...
> > > (package-from-gnu.org-or-nongnu.org?): ...this.
> > > (%elpa-updater): Adjust accordingly.
> > > ---
> > >  guix/import/elpa.scm | 13 +++++++++----
> > >  1 file changed, 9 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
> > > index edabb88b7a..038379e01b 100644
> > > --- a/guix/import/elpa.scm
> > > +++ b/guix/import/elpa.scm
> > > @@ -424,7 +424,11 @@ (define (guix-package->elpa-name package)
> > >  (define (latest-release package)
> > >    "Return an <upstream-release> for the latest release of
> > > PACKAGE."
> > >    (define name (guix-package->elpa-name package))
> > > -  (define repo 'gnu)
> > > +  (define repo
> > > +    (let ((url (origin-uri (package-source package))))
> > > +      (if (string-prefix? "https://elpa.nongnu.org" url)
> > > +          'nongnu
> > > +          'gnu)))
> > >  
> > >    (match (elpa-package-info name repo)
> > >      (#f
> > > @@ -443,11 +447,12 @@ (define repo 'gnu)
> > >          (urls (list url))
> > >          (signature-urls (list (string-append url ".sig"))))))))
> > >  
> > > -(define package-from-gnu.org?
> > > +(define package-from-gnu.org-or-nongnu.org?
> > >    (url-predicate (lambda (url)
> > >                     (let ((uri (string->uri url)))
> > >                       (and uri
> > > -                          (string=? (uri-host uri)
> > > "elpa.gnu.org"))))))
> > > +                          (or (string=? (uri-host uri)
> > > "elpa.gnu.org")
> > > +                              (string=? (uri-host uri)
> > > "elpa.nongnu.org")))))))
> > >  
> > >  (define %elpa-updater
> > >    ;; The ELPA updater.  We restrict it to packages hosted on
> > > elpa.gnu.org
> > > @@ -455,7 +460,7 @@ (define %elpa-updater
> > >    (upstream-updater
> > >     (name 'elpa)
> > >     (description "Updater for ELPA packages")
> > > -   (pred package-from-gnu.org?)
> > > +   (pred package-from-gnu.org-or-nongnu.org?)
> > >     (latest latest-release)))
> > >  
> > >  (define elpa-guix-name (cut guix-name "emacs-" <>))
> > > 
> > > base-commit: e8c1562599c7ebee8b7b228237fb0d75d4472a61
> > Could we make it so that package-from-gnu.org? becomes elpa-
> > package? s.t. (member (elpa-package? pkg) '(gnu nongnu #f)) and its
> > evaluation can be reused?
> 
> Wouldn’t it be enough with just '(gnu nongnu)?
> 
> We could make the ‘elpa-package?’ procedure memoized to avoid
> evaluating the same thing twice.
The reason for #f is so that packages that are neither from GNU nor
NonGNU ELPA are still excluded from the updater.

Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#52774; Package guix-patches. (Sat, 25 Dec 2021 14:32:02 GMT) Full text and rfc822 format available.

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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 52774 <at> debbugs.gnu.org
Subject: Re: [PATCH] import: elpa: Also check NonGNU ELPA for updates.
Date: Sat, 25 Dec 2021 15:31:37 +0100
[Message part 1 (text/plain, inline)]
Liliana schrieb am Samstag der 25. Dezember 2021 um 11:15 +01:

> Am Samstag, dem 25.12.2021 um 10:44 +0100 schrieb Xinglu Chen:
>> Liliana schrieb am Freitag der 24. Dezember 2021 um 13:17 +01:
>> 
>> > Am Freitag, dem 24.12.2021 um 12:25 +0100 schrieb Xinglu Chen:
>> > > * elpa.scm (latest-release): Determine the repository based on
>> > > the URL of the source.
>> > > (package-from-gnu.org?): Rename to ...
>> > > (package-from-gnu.org-or-nongnu.org?): ...this.
>> > > (%elpa-updater): Adjust accordingly.
>> > > ---
>> > >  guix/import/elpa.scm | 13 +++++++++----
>> > >  1 file changed, 9 insertions(+), 4 deletions(-)
>> > > 
>> > > diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
>> > > index edabb88b7a..038379e01b 100644
>> > > --- a/guix/import/elpa.scm
>> > > +++ b/guix/import/elpa.scm
>> > > @@ -424,7 +424,11 @@ (define (guix-package->elpa-name package)
>> > >  (define (latest-release package)
>> > >    "Return an <upstream-release> for the latest release of
>> > > PACKAGE."
>> > >    (define name (guix-package->elpa-name package))
>> > > -  (define repo 'gnu)
>> > > +  (define repo
>> > > +    (let ((url (origin-uri (package-source package))))
>> > > +      (if (string-prefix? "https://elpa.nongnu.org" url)
>> > > +          'nongnu
>> > > +          'gnu)))
>> > >  
>> > >    (match (elpa-package-info name repo)
>> > >      (#f
>> > > @@ -443,11 +447,12 @@ (define repo 'gnu)
>> > >          (urls (list url))
>> > >          (signature-urls (list (string-append url ".sig"))))))))
>> > >  
>> > > -(define package-from-gnu.org?
>> > > +(define package-from-gnu.org-or-nongnu.org?
>> > >    (url-predicate (lambda (url)
>> > >                     (let ((uri (string->uri url)))
>> > >                       (and uri
>> > > -                          (string=? (uri-host uri)
>> > > "elpa.gnu.org"))))))
>> > > +                          (or (string=? (uri-host uri)
>> > > "elpa.gnu.org")
>> > > +                              (string=? (uri-host uri)
>> > > "elpa.nongnu.org")))))))
>> > >  
>> > >  (define %elpa-updater
>> > >    ;; The ELPA updater.  We restrict it to packages hosted on
>> > > elpa.gnu.org
>> > > @@ -455,7 +460,7 @@ (define %elpa-updater
>> > >    (upstream-updater
>> > >     (name 'elpa)
>> > >     (description "Updater for ELPA packages")
>> > > -   (pred package-from-gnu.org?)
>> > > +   (pred package-from-gnu.org-or-nongnu.org?)
>> > >     (latest latest-release)))
>> > >  
>> > >  (define elpa-guix-name (cut guix-name "emacs-" <>))
>> > > 
>> > > base-commit: e8c1562599c7ebee8b7b228237fb0d75d4472a61
>> > Could we make it so that package-from-gnu.org? becomes elpa-
>> > package? s.t. (member (elpa-package? pkg) '(gnu nongnu #f)) and its
>> > evaluation can be reused?
>> 
>> Wouldn’t it be enough with just '(gnu nongnu)?
>> 
>> We could make the ‘elpa-package?’ procedure memoized to avoid
>> evaluating the same thing twice.
> The reason for #f is so that packages that are neither from GNU nor
> NonGNU ELPA are still excluded from the updater.

I am not sure I follow.  If ‘elpa-package?’ returned #f, the following
would return #f.

  (member (elpa-package? pkg) '(gnu nongnu))

Meaning that PKG is not hosted on GNU or NonGNU ELPA, and thus, should
not be checked for updates.

When including #f in the list, the value returned by the ‘member’
expression would be '(#f), which means that PKG would be checked for
updates, even though it shouldn’t.

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#52774; Package guix-patches. (Sat, 25 Dec 2021 15:24:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Xinglu Chen <public <at> yoctocell.xyz>, 52774 <at> debbugs.gnu.org
Subject: Re: [PATCH] import: elpa: Also check NonGNU ELPA for updates.
Date: Sat, 25 Dec 2021 16:23:17 +0100
Am Samstag, dem 25.12.2021 um 15:31 +0100 schrieb Xinglu Chen:
> Liliana schrieb am Samstag der 25. Dezember 2021 um 11:15 +01:
> 
> > Am Samstag, dem 25.12.2021 um 10:44 +0100 schrieb Xinglu Chen:
> > > Liliana schrieb am Freitag der 24. Dezember 2021 um 13:17 +01:
> > > 
> > > > Am Freitag, dem 24.12.2021 um 12:25 +0100 schrieb Xinglu Chen:
> > > > > * elpa.scm (latest-release): Determine the repository based
> > > > > on
> > > > > the URL of the source.
> > > > > (package-from-gnu.org?): Rename to ...
> > > > > (package-from-gnu.org-or-nongnu.org?): ...this.
> > > > > (%elpa-updater): Adjust accordingly.
> > > > > ---
> > > > >  guix/import/elpa.scm | 13 +++++++++----
> > > > >  1 file changed, 9 insertions(+), 4 deletions(-)
> > > > > 
> > > > > diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
> > > > > index edabb88b7a..038379e01b 100644
> > > > > --- a/guix/import/elpa.scm
> > > > > +++ b/guix/import/elpa.scm
> > > > > @@ -424,7 +424,11 @@ (define (guix-package->elpa-name
> > > > > package)
> > > > >  (define (latest-release package)
> > > > >    "Return an <upstream-release> for the latest release of
> > > > > PACKAGE."
> > > > >    (define name (guix-package->elpa-name package))
> > > > > -  (define repo 'gnu)
> > > > > +  (define repo
> > > > > +    (let ((url (origin-uri (package-source package))))
> > > > > +      (if (string-prefix? "https://elpa.nongnu.org" url)
> > > > > +          'nongnu
> > > > > +          'gnu)))
> > > > >  
> > > > >    (match (elpa-package-info name repo)
> > > > >      (#f
> > > > > @@ -443,11 +447,12 @@ (define repo 'gnu)
> > > > >          (urls (list url))
> > > > >          (signature-urls (list (string-append url
> > > > > ".sig"))))))))
> > > > >  
> > > > > -(define package-from-gnu.org?
> > > > > +(define package-from-gnu.org-or-nongnu.org?
> > > > >    (url-predicate (lambda (url)
> > > > >                     (let ((uri (string->uri url)))
> > > > >                       (and uri
> > > > > -                          (string=? (uri-host uri)
> > > > > "elpa.gnu.org"))))))
> > > > > +                          (or (string=? (uri-host uri)
> > > > > "elpa.gnu.org")
> > > > > +                              (string=? (uri-host uri)
> > > > > "elpa.nongnu.org")))))))
> > > > >  
> > > > >  (define %elpa-updater
> > > > >    ;; The ELPA updater.  We restrict it to packages hosted on
> > > > > elpa.gnu.org
> > > > > @@ -455,7 +460,7 @@ (define %elpa-updater
> > > > >    (upstream-updater
> > > > >     (name 'elpa)
> > > > >     (description "Updater for ELPA packages")
> > > > > -   (pred package-from-gnu.org?)
> > > > > +   (pred package-from-gnu.org-or-nongnu.org?)
> > > > >     (latest latest-release)))
> > > > >  
> > > > >  (define elpa-guix-name (cut guix-name "emacs-" <>))
> > > > > 
> > > > > base-commit: e8c1562599c7ebee8b7b228237fb0d75d4472a61
> > > > Could we make it so that package-from-gnu.org? becomes elpa-
> > > > package? s.t. (member (elpa-package? pkg) '(gnu nongnu #f)) and
> > > > its
> > > > evaluation can be reused?
> > > 
> > > Wouldn’t it be enough with just '(gnu nongnu)?
> > > 
> > > We could make the ‘elpa-package?’ procedure memoized to avoid
> > > evaluating the same thing twice.
> > The reason for #f is so that packages that are neither from GNU nor
> > NonGNU ELPA are still excluded from the updater.
> 
> I am not sure I follow.  If ‘elpa-package?’ returned #f, the
> following would return #f.
> 
>   (member (elpa-package? pkg) '(gnu nongnu))
> 
> Meaning that PKG is not hosted on GNU or NonGNU ELPA, and thus,
> should not be checked for updates.
> 
> When including #f in the list, the value returned by the ‘member’
> expression would be '(#f), which means that PKG would be checked for
> updates, even though it shouldn’t.
I think you're misunderstanding what I'm saying, but that might be
because I worded it badly.  My suggestion was to make elpa-package? a
"predicate with meaning", which returns #f if PKG is not an ELPA
package, and a truthy value otherwise, said truthy value being the
symbol 'gnu or 'nongnu at the moment (which could be expanded to e.g.
include 'melpa or 'some-other-law-abiding-elpa in case the ELPA updater
is found to work for those as well).  Saying that it satisfies the
above member function was a shorthand for that.





Information forwarded to guix-patches <at> gnu.org:
bug#52774; Package guix-patches. (Sun, 26 Dec 2021 12:45:01 GMT) Full text and rfc822 format available.

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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 52774 <at> debbugs.gnu.org
Subject: Re: [PATCH] import: elpa: Also check NonGNU ELPA for updates.
Date: Sun, 26 Dec 2021 13:44:34 +0100
[Message part 1 (text/plain, inline)]
Liliana schrieb am Samstag der 25. Dezember 2021 um 16:23 +01:

> Am Samstag, dem 25.12.2021 um 15:31 +0100 schrieb Xinglu Chen:
>> Liliana schrieb am Samstag der 25. Dezember 2021 um 11:15 +01:
>> 
>> > Am Samstag, dem 25.12.2021 um 10:44 +0100 schrieb Xinglu Chen:
>> > > Liliana schrieb am Freitag der 24. Dezember 2021 um 13:17 +01:
>> > > 
>> > > > Am Freitag, dem 24.12.2021 um 12:25 +0100 schrieb Xinglu Chen:
>> > > > > * elpa.scm (latest-release): Determine the repository based
>> > > > > on
>> > > > > the URL of the source.
>> > > > > (package-from-gnu.org?): Rename to ...
>> > > > > (package-from-gnu.org-or-nongnu.org?): ...this.
>> > > > > (%elpa-updater): Adjust accordingly.
>> > > > > ---
>> > > > >  guix/import/elpa.scm | 13 +++++++++----
>> > > > >  1 file changed, 9 insertions(+), 4 deletions(-)
>> > > > > 
>> > > > > diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
>> > > > > index edabb88b7a..038379e01b 100644
>> > > > > --- a/guix/import/elpa.scm
>> > > > > +++ b/guix/import/elpa.scm
>> > > > > @@ -424,7 +424,11 @@ (define (guix-package->elpa-name
>> > > > > package)
>> > > > >  (define (latest-release package)
>> > > > >    "Return an <upstream-release> for the latest release of
>> > > > > PACKAGE."
>> > > > >    (define name (guix-package->elpa-name package))
>> > > > > -  (define repo 'gnu)
>> > > > > +  (define repo
>> > > > > +    (let ((url (origin-uri (package-source package))))
>> > > > > +      (if (string-prefix? "https://elpa.nongnu.org" url)
>> > > > > +          'nongnu
>> > > > > +          'gnu)))
>> > > > >  
>> > > > >    (match (elpa-package-info name repo)
>> > > > >      (#f
>> > > > > @@ -443,11 +447,12 @@ (define repo 'gnu)
>> > > > >          (urls (list url))
>> > > > >          (signature-urls (list (string-append url
>> > > > > ".sig"))))))))
>> > > > >  
>> > > > > -(define package-from-gnu.org?
>> > > > > +(define package-from-gnu.org-or-nongnu.org?
>> > > > >    (url-predicate (lambda (url)
>> > > > >                     (let ((uri (string->uri url)))
>> > > > >                       (and uri
>> > > > > -                          (string=? (uri-host uri)
>> > > > > "elpa.gnu.org"))))))
>> > > > > +                          (or (string=? (uri-host uri)
>> > > > > "elpa.gnu.org")
>> > > > > +                              (string=? (uri-host uri)
>> > > > > "elpa.nongnu.org")))))))
>> > > > >  
>> > > > >  (define %elpa-updater
>> > > > >    ;; The ELPA updater.  We restrict it to packages hosted on
>> > > > > elpa.gnu.org
>> > > > > @@ -455,7 +460,7 @@ (define %elpa-updater
>> > > > >    (upstream-updater
>> > > > >     (name 'elpa)
>> > > > >     (description "Updater for ELPA packages")
>> > > > > -   (pred package-from-gnu.org?)
>> > > > > +   (pred package-from-gnu.org-or-nongnu.org?)
>> > > > >     (latest latest-release)))
>> > > > >  
>> > > > >  (define elpa-guix-name (cut guix-name "emacs-" <>))
>> > > > > 
>> > > > > base-commit: e8c1562599c7ebee8b7b228237fb0d75d4472a61
>> > > > Could we make it so that package-from-gnu.org? becomes elpa-
>> > > > package? s.t. (member (elpa-package? pkg) '(gnu nongnu #f)) and
>> > > > its
>> > > > evaluation can be reused?
>> > > 
>> > > Wouldn’t it be enough with just '(gnu nongnu)?
>> > > 
>> > > We could make the ‘elpa-package?’ procedure memoized to avoid
>> > > evaluating the same thing twice.
>> > The reason for #f is so that packages that are neither from GNU nor
>> > NonGNU ELPA are still excluded from the updater.
>> 
>> I am not sure I follow.  If ‘elpa-package?’ returned #f, the
>> following would return #f.
>> 
>>   (member (elpa-package? pkg) '(gnu nongnu))
>> 
>> Meaning that PKG is not hosted on GNU or NonGNU ELPA, and thus,
>> should not be checked for updates.
>> 
>> When including #f in the list, the value returned by the ‘member’
>> expression would be '(#f), which means that PKG would be checked for
>> updates, even though it shouldn’t.
> I think you're misunderstanding what I'm saying, but that might be
> because I worded it badly.  My suggestion was to make elpa-package? a
> "predicate with meaning", which returns #f if PKG is not an ELPA
> package, and a truthy value otherwise, said truthy value being the
> symbol 'gnu or 'nongnu at the moment

That was what I had in mind as well, but I don’t see why we would need
'(gnu nongnu #f) instead of just '(gnu nongnu).  If PKG is not in ELPA,
we _don’t_ want to check for updates, and therefore, #f shouldn’t be a
member of the list.

I took a stab at the problem (patch attached below), and the result
seems to be what would be expected.

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix refresh -t elpa emacs-caml emacs-project emacs-helm
gnu/packages/emacs-xyz.scm:10870:2: warning: no updater for emacs-helm                   ;github
gnu/packages/emacs-xyz.scm:636:13: 0.8.1 is already the latest version of emacs-project  ;gnu
gnu/packages/emacs-xyz.scm:2751:13: 4.9 is already the latest version of emacs-caml      ;nongnu
--8<---------------cut here---------------end--------------->8---

[0001-import-elpa-Also-check-NonGNU-ELPA-for-updates.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#52774; Package guix-patches. (Sun, 26 Dec 2021 13:09:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Xinglu Chen <public <at> yoctocell.xyz>, 52774 <at> debbugs.gnu.org
Subject: Re: [PATCH] import: elpa: Also check NonGNU ELPA for updates.
Date: Sun, 26 Dec 2021 14:08:18 +0100
Hi Xinglu,

Am Sonntag, dem 26.12.2021 um 13:44 +0100 schrieb Xinglu Chen:
> > > I am not sure I follow.  If ‘elpa-package?’ returned #f, the
> > > following would return #f.
> > > 
> > >   (member (elpa-package? pkg) '(gnu nongnu))
> > > 
> > > Meaning that PKG is not hosted on GNU or NonGNU ELPA, and thus,
> > > should not be checked for updates.
> > > 
> > > When including #f in the list, the value returned by the ‘member’
> > > expression would be '(#f), which means that PKG would be checked
> > > for updates, even though it shouldn’t.
> > I think you're misunderstanding what I'm saying, but that might be
> > because I worded it badly.  My suggestion was to make elpa-package?
> > a "predicate with meaning", which returns #f if PKG is not an ELPA
> > package, and a truthy value otherwise, said truthy value being the
> > symbol 'gnu or 'nongnu at the moment
> 
> That was what I had in mind as well, but I don’t see why we would
> need '(gnu nongnu #f) instead of just '(gnu nongnu).  If PKG is not
> in ELPA, we _don’t_ want to check for updates, and therefore, #f
> shouldn’t be a member of the list.
Because (eq? (elpa-package? NOT_AN_ELPA_PACKAGE) #f) needs to be
defined behaviour.

> I took a stab at the problem (patch attached below), and the result
> seems to be what would be expected.
> 
> --8<---------------cut here---------------start------------->8---
> $ ./pre-inst-env guix refresh -t elpa emacs-caml emacs-project emacs-
> helm
> gnu/packages/emacs-xyz.scm:10870:2: warning: no updater for emacs-
> helm                   ;github
> gnu/packages/emacs-xyz.scm:636:13: 0.8.1 is already the latest
> version of emacs-project  ;gnu
> gnu/packages/emacs-xyz.scm:2751:13: 4.9 is already the latest version
> of emacs-caml      ;nongnu
> --8<---------------cut here---------------end--------------->8---
In my personal opinion, elpa-repository as you defined it in that patch
would already be a valid value for the pred field of %elpa-updater. 
There is no need to define a procedure that does the member call and in
fact it makes it harder to update the updater, as now two locations
have to be updated.  If there is a requirement to only return #t or #f
we could make it (compose ->bool elpa-repository)

Cheers




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 05 Jan 2022 22:19:02 GMT) Full text and rfc822 format available.

Notification sent to Xinglu Chen <public <at> yoctocell.xyz>:
bug acknowledged by developer. (Wed, 05 Jan 2022 22:19:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: Liliana Marie Prikler <liliana.prikler <at> gmail.com>,
 52774-done <at> debbugs.gnu.org
Subject: Re: bug#52774: [PATCH] import: elpa: Also check NonGNU ELPA for
 updates.
Date: Wed, 05 Jan 2022 23:18:06 +0100
Hi,

Xinglu Chen <public <at> yoctocell.xyz> skribis:

> From 4332502000bd06a2be900c236666d10f07777807 Mon Sep 17 00:00:00 2001
> Message-Id: <4332502000bd06a2be900c236666d10f07777807.1640522590.git.public <at> yoctocell.xyz>
> From: Xinglu Chen <public <at> yoctocell.xyz>
> Date: Thu, 23 Dec 2021 22:08:33 +0100
> Subject: [PATCH] import: elpa: Also check NonGNU ELPA for updates.
>
> * elpa.scm (latest-release): Determine the repository based on the URL of the
> source.
> (package-from-gnu.org?): Rename to ...
> (elpa-repository): ...this; memoize.
> (elpa-package?): New procedure.
> (%elpa-updater): Adjust accordingly.

Applied, thanks to the two of you!

I had to rename ‘elpa-package?’ because:

  guix/import/elpa.scm:459:0: warning: shadows previous definition of `elpa-package?' at <unknown-location>

(The other ‘elpa-package?’ predicate wasn’t used, but still.)

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#52774; Package guix-patches. (Wed, 05 Jan 2022 23:04:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>, Xinglu Chen
 <public <at> yoctocell.xyz>
Cc: 52774-done <at> debbugs.gnu.org
Subject: Re: bug#52774: [PATCH] import: elpa: Also check NonGNU ELPA for
 updates.
Date: Thu, 06 Jan 2022 00:03:41 +0100
Am Mittwoch, dem 05.01.2022 um 23:18 +0100 schrieb Ludovic Courtès:
> Hi,
> 
> Xinglu Chen <public <at> yoctocell.xyz> skribis:
> 
> > From 4332502000bd06a2be900c236666d10f07777807 Mon Sep 17 00:00:00
> > 2001
> > Message-Id:
> > <4332502000bd06a2be900c236666d10f07777807.1640522590.git.public <at> yoctocell.xyz
> > >
> > From: Xinglu Chen <public <at> yoctocell.xyz>
> > Date: Thu, 23 Dec 2021 22:08:33 +0100
> > Subject: [PATCH] import: elpa: Also check NonGNU ELPA for updates.
> > 
> > * elpa.scm (latest-release): Determine the repository based on the
> > URL of the
> > source.
> > (package-from-gnu.org?): Rename to ...
> > (elpa-repository): ...this; memoize.
> > (elpa-package?): New procedure.
> > (%elpa-updater): Adjust accordingly.
> 
> Applied, thanks to the two of you!
Ahh, sorry for not applying it earlier.  I was too caught up in the
message accompanying it that I didn't notice the patch actually
behaving the way I intended.

My bad, I'll try to be less confusing next time




Information forwarded to guix-patches <at> gnu.org:
bug#52774; Package guix-patches. (Wed, 05 Jan 2022 23:13:01 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>, Xinglu Chen
 <public <at> yoctocell.xyz>
Cc: 52774-done <at> debbugs.gnu.org
Subject: Re: bug#52774: [PATCH] import: elpa: Also check NonGNU ELPA for
 updates.
Date: Thu, 06 Jan 2022 00:12:19 +0100
Am Donnerstag, dem 06.01.2022 um 00:03 +0100 schrieb Liliana Marie
Prikler:
> Ahh, sorry for not applying it earlier.  I was too caught up in the
> message accompanying it that I didn't notice the patch actually
> behaving the way I intended.
Okay, I take that back, my point about needing to modify two places
still applies, but shouldn't have held this patch back.  Either way,
sorry.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 03 Feb 2022 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 76 days ago.

Previous Next


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