guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Caching The Python World: guix shell --container


From: Ricardo Wurmus
Subject: Re: Caching The Python World: guix shell --container
Date: Sat, 15 Jan 2022 12:25:28 +0100
User-agent: mu4e 1.6.10; emacs 27.2

jgart <jgart@dismail.de> writes:

> On Sat, 15 Jan 2022 08:45:57 +0100 Ricardo Wurmus <rekado@elephly.net> wrote:
>> 
>> jgart <jgart@dismail.de> writes:
>> 
>> > Is there currently a convenient way to tell Guix to build "all python-*
>> > packages" and cache them?
>> 
>> This should do it:
>> 
>>     guix build --keep-going -e '\
>>       (begin \
>>         (import (guix packages) (gnu packages) (guix build-system python)) \
>>         (fold-packages \
>>           (lambda (item acc) \
>>             (if (eq? python-build-system (package-build-system item)) \
>>               (cons item acc) acc)) \
>>           (list)))'
>> 
>> This will build all packages with python-build-system.

fold-packages is really neat.  You can also add even more filtering
here; by package name, by inputs, anything really.  For example, the
expression above will give you any package built with
python-build-system, but this may be too much, as it includes Python 2
packages.

It is just a fold, though, so all work happens in that procedure that is
given the current package and the accumulator from past invocations of
the procedure.  The only important thing is that the procedure always
returns a value for the accumulator.

It doesn’t have to be a list either; it could be a hash table so you can
easily look up packages you’ve already accumulated so far and base your
decision on that, etc.

-- 
Ricardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]