unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: jgart <jgart@dismail.de>
Cc: guix-devel@gnu.org
Subject: Re: Caching The Python World: guix shell --container
Date: Sat, 15 Jan 2022 12:25:28 +0100	[thread overview]
Message-ID: <871r19xmoo.fsf@elephly.net> (raw)
In-Reply-To: <20220115032429.GB16769@gac.attlocal.net>


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	other threads:[~2022-01-15 11:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-15  7:30 Caching The Python World: guix shell --container jgart
2022-01-15  7:45 ` Ricardo Wurmus
2022-01-15  8:24   ` jgart
2022-01-15 11:25     ` Ricardo Wurmus [this message]

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=871r19xmoo.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=guix-devel@gnu.org \
    --cc=jgart@dismail.de \
    /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).