Message ID | 87ee5zbknh.fsf@yoctocell.xyz |
---|---|
State | Accepted |
Headers | show |
Series | [bug#52774] import: elpa: Also check NonGNU ELPA for updates. | expand |
Context | Check | Description |
---|---|---|
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
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
Hi, Xinglu Chen <public@yoctocell.xyz> skribis: > 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. 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’.
Am Mittwoch, dem 05.01.2022 um 23:18 +0100 schrieb Ludovic Courtès: > Hi, > > Xinglu Chen <public@yoctocell.xyz> skribis: > > > 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. > > 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
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.
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