From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Dependency cycle issues when using a Gexp-based snippet
Date: Mon, 07 Sep 2020 11:30:32 +0200 [thread overview]
Message-ID: <877dt6orwn.fsf@gnu.org> (raw)
In-Reply-To: <87mu286wt0.fsf@gmail.com> (Maxim Cournoyer's message of "Wed, 02 Sep 2020 11:08:27 -0400")
Hi Maxim,
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>>> Attempting a suggested fix by Ludovic in that same conversation [0],
>>> namely, making the snippet field of the <origin> record a thunked one:
>>>
>>> modified guix/packages.scm
>>> @@ -250,7 +250,8 @@ as base32. Otherwise, it must be a bytevector."
>>> (patches origin-patches ; list of file names
>>> (default '()) (delayed))
>>>
>>> - (snippet origin-snippet (default #f)) ; sexp or #f
>>> + (snippet origin-snippet
>>> + (default #f) (thunked)) ; sexp or #f
>>> (patch-flags origin-patch-flags ; list of strings
>>> (default '("-p1")))
>>
>> We should check what this change costs in CPU and memory, but it’s
>> probably worth it. As Marius noted before, the snippets for
>> ungoogled-chromium and linux-libre are contrived because of this
>> limitation. (Perhaps we can use ‘delayed’ instead of ‘thunked’.)
>
> What is the difference between delayed and thunked? Would a thunked
> capture the closure of its environment while delayed not? Is the
> closure useful to access record-bound values such as the version field
> of a package?
‘Thunk’ uses an actual thunk (zero-argument procedure) that’s called
each time the field is accessed; ‘delayed’ uses a promise, which is
similar except that the result is memoized (info "(guile) Delayed
Evaluation").
> I checked the usage at compilation and run time, using the 'time'
> command (aliased to time+ on my system), and didn't find any meaningful
> difference whether the snippet is made a thunked or delayed field, or
> none (current situation):
>
> On current master:
>
> time+ make -j8
> 2436.29user 56.47system 14:29.36elapsed 286%CPU (0avgtext+0avgdata 870828maxresident)k
> 5480inputs+405952outputs (71major+320522minor)pagefaults 0swaps
>
> time+ ./pre-inst-env guix package -A | wc -l
> 9.87user 0.24system 0:06.51elapsed 155%CPU (0avgtext+0avgdata 281564maxresident)k
> 0inputs+0outputs (0major+25636minor)pagefaults 0swaps
> 14702
What would be interesting is a comparison of the performance of
‘package-derivation’, which can be done with something like:
time guix build -d --no-grafts libreoffice pandoc
For memory consumption, try:
GUIX_PROFILING=gc guix build -d --no-grafts libreoffice pandoc
>> + (snippet
>> + (with-imported-modules '((guix build utils))
>> + #~(begin
>> + (use-modules (guix build utils))
>> + ;; corelib uses bundled harfbuzz, md4, md5, sha3
>> + (with-directory-excursion "src/3rdparty"
>> + (for-each delete-file-recursively
>> + (list "double-conversion" "freetype" "harfbuzz-ng"
>> + "libpng" "libjpeg" "pcre2" "sqlite" "xcb"
>> + "zlib")))
>> +
>> + (let ((coreutils #+(canonical-package coreutils)))
>> + (substitute* "configure"
>> + (("/bin/pwd")
>> + (string-append coreutils "/bin/pwd")))
>> + (substitute* "src/corelib/global/global.pri"
>> + (("/bin/ls")
>> + (string-append coreutils "/bin/ls"))))
>> + #t)))))
>>
>> Such substitutions are system-dependent; thus, they should be made in a
>> phase, not in a snippet. Perhaps we’ll sidestep the issue altogether?
>> :-)
>
> Indeed. I didn't consider this aspect well. Apart from being
> inefficient (the sources of a package would be different for each
> system) it would still technically work, no?
It would work, but it’s “not the right place” for that, aesthetically.
(Note that when there’s a snippet, we get different derivations for each
system anyway.)
Thanks,
Ludo’.
next prev parent reply other threads:[~2020-09-07 9:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-24 2:10 Dependency cycle issues when using a Gexp-based snippet maxim.cournoyer
2020-08-24 21:09 ` Ludovic Courtès
2020-09-02 15:08 ` Maxim Cournoyer
2020-09-07 9:30 ` Ludovic Courtès [this message]
2020-09-14 16:55 ` Maxim Cournoyer
2020-09-16 10:08 ` Ludovic Courtès
2020-09-07 18:30 ` Mark H Weaver
2020-09-16 10:00 ` Ludovic Courtès
2020-09-08 4:07 ` What should "guix build --source" produce? (was Re: Dependency cycle issues when using a Gexp-based snippet) Mark H Weaver
2020-09-08 7:22 ` Andreas Enge
2020-09-11 18:22 ` Maxim Cournoyer
2020-09-11 18:42 ` zimoun
2020-09-11 20:40 ` Andreas Enge
2020-09-11 18:26 ` Maxim Cournoyer
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=877dt6orwn.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guix-devel@gnu.org \
--cc=maxim.cournoyer@gmail.com \
/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).