From: Xinglu Chen <public@yoctocell.xyz>
To: Liliana Marie Prikler <liliana.prikler@gmail.com>, 52774@debbugs.gnu.org
Subject: [bug#52774] [PATCH] import: elpa: Also check NonGNU ELPA for updates.
Date: Sun, 26 Dec 2021 13:44:34 +0100 [thread overview]
Message-ID: <87ee5zbknh.fsf@yoctocell.xyz> (raw)
In-Reply-To: <5ba4b071c95b0db888ad3290d1aa569e979acec5.camel@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 5414 bytes --]
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---
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-import-elpa-Also-check-NonGNU-ELPA-for-updates.patch --]
[-- Type: text/x-patch, Size: 2858 bytes --]
From 4332502000bd06a2be900c236666d10f07777807 Mon Sep 17 00:00:00 2001
Message-Id: <4332502000bd06a2be900c236666d10f07777807.1640522590.git.public@yoctocell.xyz>
From: Xinglu Chen <public@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.
---
guix/import/elpa.scm | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index edabb88b7a..a03df5167e 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -44,6 +44,7 @@ (define-module (guix import elpa)
#:use-module (guix base32)
#:use-module (guix upstream)
#:use-module (guix packages)
+ #:use-module (guix memoization)
#:use-module ((guix utils) #:select (call-with-temporary-output-file))
#:export (elpa->guix-package
guix-package->elpa-name
@@ -424,7 +425,7 @@ (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 (elpa-repository package))
(match (elpa-package-info name repo)
(#f
@@ -443,11 +444,20 @@ (define repo 'gnu)
(urls (list url))
(signature-urls (list (string-append url ".sig"))))))))
-(define package-from-gnu.org?
- (url-predicate (lambda (url)
- (let ((uri (string->uri url)))
- (and uri
- (string=? (uri-host uri) "elpa.gnu.org"))))))
+(define elpa-repository
+ (memoize
+ (url-predicate (lambda (url)
+ (let ((uri (string->uri url)))
+ (and uri
+ (cond
+ ((string=? (uri-host uri) "elpa.gnu.org")
+ 'gnu)
+ ((string=? (uri-host uri) "elpa.nongnu.org")
+ 'nongnu)
+ (else #f))))))))
+
+(define (elpa-package? package)
+ (member (elpa-repository package) '(gnu nongnu)))
(define %elpa-updater
;; The ELPA updater. We restrict it to packages hosted on elpa.gnu.org
@@ -455,7 +465,7 @@ (define %elpa-updater
(upstream-updater
(name 'elpa)
(description "Updater for ELPA packages")
- (pred package-from-gnu.org?)
+ (pred elpa-package?)
(latest latest-release)))
(define elpa-guix-name (cut guix-name "emacs-" <>))
base-commit: 2495582e08cf411163f0799d290fda5101141949
--
2.33.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
next prev parent reply other threads:[~2021-12-26 12:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-24 11:25 [bug#52774] [PATCH] import: elpa: Also check NonGNU ELPA for updates Xinglu Chen
2021-12-24 12:17 ` Liliana Marie Prikler
2021-12-25 9:44 ` Xinglu Chen
2021-12-25 10:15 ` Liliana Marie Prikler
2021-12-25 14:31 ` Xinglu Chen
2021-12-25 15:23 ` Liliana Marie Prikler
2021-12-26 12:44 ` Xinglu Chen [this message]
2021-12-26 13:08 ` Liliana Marie Prikler
2022-01-05 22:18 ` bug#52774: " Ludovic Courtès
2022-01-05 23:03 ` [bug#52774] " Liliana Marie Prikler
2022-01-05 23:12 ` Liliana Marie Prikler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ee5zbknh.fsf@yoctocell.xyz \
--to=public@yoctocell.xyz \
--cc=52774@debbugs.gnu.org \
--cc=liliana.prikler@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).