GNU bug report logs -
#28274
[PATCH] gnu: Add fold-packages-in-modules.
Previous Next
Reported by: Christopher Baines <mail <at> cbaines.net>
Date: Tue, 29 Aug 2017 07:08:02 UTC
Severity: normal
Tags: patch
Done: ludo <at> gnu.org (Ludovic Courtès)
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 28274 in the body.
You can then email your comments to 28274 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#28274
; Package
guix-patches
.
(Tue, 29 Aug 2017 07:08:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Christopher Baines <mail <at> cbaines.net>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Tue, 29 Aug 2017 07:08:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Add a more flexible variant of the fold-packages procedure, that takes a list
of the modules to work with. The existing fold-packages procedure then calls
fold-packages-in-modules with the result of the all-modules procedure.
I wrote this when looking at how to get the packages in a specific set of
modules, to create jobs for cuirass.
* gnu/packages.scm (fold-packages-in-modules): New procedure.
(fold-packages): Change to use fold-packages-in-modules.
---
gnu/packages.scm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 562906178..3f0ff56b8 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -47,6 +47,7 @@
%bootstrap-binaries-path
%package-module-path
+ fold-packages-in-modules
fold-packages
find-packages-by-name
@@ -144,13 +145,21 @@ for system '~a'")
"Call (PROC PACKAGE RESULT) for each available package, using INIT as
the initial value of RESULT. It is guaranteed to never traverse the
same package twice."
+ (fold-packages-in-modules (all-modules (%package-module-path))
+ proc
+ init))
+
+(define (fold-packages-in-modules modules proc init)
+ "Call (PROC PACKAGE RESULT) for each available package within any of the
+modules in MODULES, using INIT as the initial value of RESULT. It is
+guaranteed to never traverse the same package twice."
(fold-module-public-variables (lambda (object result)
(if (and (package? object)
(not (hidden-package? object)))
(proc object result)
result))
init
- (all-modules (%package-module-path))))
+ modules))
(define find-packages-by-name
(let ((packages (delay
--
2.14.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#28274
; Package
guix-patches
.
(Thu, 31 Aug 2017 13:22:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 28274 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Christopher Baines <mail <at> cbaines.net> skribis:
> Add a more flexible variant of the fold-packages procedure, that takes a list
> of the modules to work with. The existing fold-packages procedure then calls
> fold-packages-in-modules with the result of the all-modules procedure.
>
> I wrote this when looking at how to get the packages in a specific set of
> modules, to create jobs for cuirass.
>
> * gnu/packages.scm (fold-packages-in-modules): New procedure.
> (fold-packages): Change to use fold-packages-in-modules.
[...]
> +(define (fold-packages-in-modules modules proc init)
> + "Call (PROC PACKAGE RESULT) for each available package within any of the
> +modules in MODULES, using INIT as the initial value of RESULT. It is
> +guaranteed to never traverse the same package twice."
> (fold-module-public-variables (lambda (object result)
> (if (and (package? object)
> (not (hidden-package? object)))
> (proc object result)
> result))
> init
> - (all-modules (%package-module-path))))
> + modules))
Instead of introducing a new procedure, what about simply:
[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 562906178..b4ac6661c 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -140,17 +140,19 @@ for system '~a'")
directory))
%load-path)))
-(define (fold-packages proc init)
- "Call (PROC PACKAGE RESULT) for each available package, using INIT as
-the initial value of RESULT. It is guaranteed to never traverse the
-same package twice."
+(define* (fold-packages proc init
+ #:optional
+ (modules (all-modules (%package-module-path))))
+ "Call (PROC PACKAGE RESULT) for each available package defined in one of
+MODULES, using INIT as the initial value of RESULT. It is guaranteed to never
+traverse the same package twice."
(fold-module-public-variables (lambda (object result)
(if (and (package? object)
(not (hidden-package? object)))
(proc object result)
result))
init
- (all-modules (%package-module-path))))
+ modules))
(define find-packages-by-name
(let ((packages (delay
[Message part 3 (text/plain, inline)]
?
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#28274
; Package
guix-patches
.
(Thu, 31 Aug 2017 21:45:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 28274 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Thu, 31 Aug 2017 15:20:55 +0200
ludo <at> gnu.org (Ludovic Courtès) wrote:
> Instead of introducing a new procedure, what about simply:
>
>
> diff --git a/gnu/packages.scm b/gnu/packages.scm
> index 562906178..b4ac6661c 100644
> --- a/gnu/packages.scm
> +++ b/gnu/packages.scm
> @@ -140,17 +140,19 @@ for system '~a'")
> directory))
> %load-path)))
>
> -(define (fold-packages proc init)
> - "Call (PROC PACKAGE RESULT) for each available package, using INIT
> as -the initial value of RESULT. It is guaranteed to never traverse
> the -same package twice."
> +(define* (fold-packages proc init
> + #:optional
> + (modules (all-modules
> (%package-module-path))))
> + "Call (PROC PACKAGE RESULT) for each available package defined in
> one of +MODULES, using INIT as the initial value of RESULT. It is
> guaranteed to never +traverse the same package twice."
> (fold-module-public-variables (lambda (object result)
> (if (and (package? object)
> (not (hidden-package?
> object))) (proc object result)
> result))
> init
> - (all-modules
> (%package-module-path))))
> + modules))
>
> (define find-packages-by-name
> (let ((packages (delay
>
>
> ?
This looks great. Are you set to push it up, or shall I?
Thanks,
Chris
[Message part 2 (application/pgp-signature, inline)]
Reply sent
to
ludo <at> gnu.org (Ludovic Courtès)
:
You have taken responsibility.
(Fri, 01 Sep 2017 09:10:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Christopher Baines <mail <at> cbaines.net>
:
bug acknowledged by developer.
(Fri, 01 Sep 2017 09:10:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 28274-done <at> debbugs.gnu.org (full text, mbox):
Christopher Baines <mail <at> cbaines.net> skribis:
> On Thu, 31 Aug 2017 15:20:55 +0200
> ludo <at> gnu.org (Ludovic Courtès) wrote:
>
>> Instead of introducing a new procedure, what about simply:
>>
>>
>> diff --git a/gnu/packages.scm b/gnu/packages.scm
>> index 562906178..b4ac6661c 100644
>> --- a/gnu/packages.scm
>> +++ b/gnu/packages.scm
>> @@ -140,17 +140,19 @@ for system '~a'")
>> directory))
>> %load-path)))
>>
>> -(define (fold-packages proc init)
>> - "Call (PROC PACKAGE RESULT) for each available package, using INIT
>> as -the initial value of RESULT. It is guaranteed to never traverse
>> the -same package twice."
>> +(define* (fold-packages proc init
>> + #:optional
>> + (modules (all-modules
>> (%package-module-path))))
>> + "Call (PROC PACKAGE RESULT) for each available package defined in
>> one of +MODULES, using INIT as the initial value of RESULT. It is
>> guaranteed to never +traverse the same package twice."
>> (fold-module-public-variables (lambda (object result)
>> (if (and (package? object)
>> (not (hidden-package?
>> object))) (proc object result)
>> result))
>> init
>> - (all-modules
>> (%package-module-path))))
>> + modules))
>>
>> (define find-packages-by-name
>> (let ((packages (delay
>>
>>
>> ?
>
> This looks great. Are you set to push it up, or shall I?
Pushed, thanks!
Ludo'.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#28274
; Package
guix-patches
.
(Fri, 01 Sep 2017 18:21:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 28274 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Fri, 01 Sep 2017 11:08:56 +0200
ludo <at> gnu.org (Ludovic Courtès) wrote:
> Christopher Baines <mail <at> cbaines.net> skribis:
>
> > On Thu, 31 Aug 2017 15:20:55 +0200
> > ludo <at> gnu.org (Ludovic Courtès) wrote:
> >
> >> Instead of introducing a new procedure, what about simply:
> >>
> >>
> >> diff --git a/gnu/packages.scm b/gnu/packages.scm
> >> index 562906178..b4ac6661c 100644
> >> --- a/gnu/packages.scm
> >> +++ b/gnu/packages.scm
> >> @@ -140,17 +140,19 @@ for system '~a'")
> >> directory))
> >> %load-path)))
> >>
> >> -(define (fold-packages proc init)
> >> - "Call (PROC PACKAGE RESULT) for each available package, using
> >> INIT as -the initial value of RESULT. It is guaranteed to never
> >> traverse the -same package twice."
> >> +(define* (fold-packages proc init
> >> + #:optional
> >> + (modules (all-modules
> >> (%package-module-path))))
> >> + "Call (PROC PACKAGE RESULT) for each available package defined
> >> in one of +MODULES, using INIT as the initial value of RESULT. It
> >> is guaranteed to never +traverse the same package twice."
> >> (fold-module-public-variables (lambda (object result)
> >> (if (and (package? object)
> >> (not (hidden-package?
> >> object))) (proc object result)
> >> result))
> >> init
> >> - (all-modules
> >> (%package-module-path))))
> >> + modules))
> >>
> >> (define find-packages-by-name
> >> (let ((packages (delay
> >>
> >>
> >> ?
> >
> > This looks great. Are you set to push it up, or shall I?
>
> Pushed, thanks!
Awesome, thanks Ludo :)
[Message part 2 (application/pgp-signature, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 30 Sep 2017 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 348 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.