GNU bug report logs -
#49522
[PATCH] weather: Don't look for exported package replacements twice.
Previous Next
Reported by: Christopher Baines <mail <at> cbaines.net>
Date: Sun, 11 Jul 2021 11:57:01 UTC
Severity: normal
Tags: patch
Done: Christopher Baines <mail <at> cbaines.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#49522: [PATCH] weather: Don't look for exported package replacements twice.
which was filed against the guix-patches package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 49522 <at> debbugs.gnu.org.
--
49522: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=49522
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:
> Hi,
>
> Christopher Baines <mail <at> cbaines.net> skribis:
>
>> * guix/scripts/weather.scm (all-packages): Delete duplicates, so that exported
>> replacements aren't included twice.
>
> LGTM, and apologies for the delay!
Great, I've pushed this now as 9540323458de87b0b8aa421e449a4fe27af7c393.
[signature.asc (application/pgp-signature, inline)]
[Message part 5 (message/rfc822, inline)]
There could be performance issues with member here, but only if there are lots
of replacements.
* guix/scripts/weather.scm (all-packages): Return all exported packages, plus
non exported replacements, rather than including exported replacements twice.
---
guix/scripts/weather.scm | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 06312d65a2..0f70dc8460 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -53,17 +53,30 @@
#:export (guix-weather))
(define (all-packages)
- "Return the list of public packages we are going to query."
- (fold-packages (lambda (package result)
- (match (package-replacement package)
- ((? package? replacement)
- (cons* replacement package result))
- (#f
- (cons package result))))
- '()
-
- ;; Dismiss deprecated packages but keep hidden packages.
- #:select? (negate package-superseded)))
+ "Return the list of packages we are going to query."
+ (let* ((packages
+ (fold-packages (lambda (package result)
+ (cons package result))
+ '()
+
+ ;; Dismiss deprecated packages but keep hidden packages.
+ #:select? (negate package-superseded)))
+ (non-exported-replacement-packages
+ (fold-packages (lambda (package result)
+ (let ((replacement (package-replacement package)))
+ (if (and replacement
+ ;; Avoid double couting replacements
+ ;; that are themselves exported
+ (not (member replacement packages)))
+ (cons replacement result)
+ result)))
+ '()
+
+ ;; Dismiss deprecated packages but keep hidden packages.
+ #:select? (negate package-superseded))))
+ (append
+ packages
+ non-exported-replacement-packages)))
(define (call-with-progress-reporter reporter proc)
"This is a variant of 'call-with-progress-reporter' that works with monadic
--
2.32.0
This bug report was last modified 3 years and 265 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.