all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: 61949@debbugs.gnu.org, Christopher Baines <mail@cbaines.net>,
	Simon Tournier <zimon.toutoune@gmail.com>,
	Mathieu Othacehe <othacehe@gnu.org>,
	Tobias Geerinckx-Rice <me@tobias.gr>,
	Josselin Poiret <dev@jpoiret.xyz>,
	Ricardo Wurmus <rekado@elephly.net>
Subject: [bug#61949] [PATCH] pack: Move common build code to (guix build pack).
Date: Mon, 03 Jul 2023 11:10:51 +0200	[thread overview]
Message-ID: <87y1jxqs10.fsf_-_@gnu.org> (raw)
In-Reply-To: <20230306191421.3726-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Mon, 6 Mar 2023 14:14:21 -0500")

Hi Maxim and all,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> The rationale is to reduce the number of derivations built per pack to ideally
> one, to minimize storage requirements.  The number of derivations had gone up
> with 68380db4 ("pack: Extract populate-profile-root from
> self-contained-tarball/builder.") as a side effect to improving code reuse.
>
> * guix/scripts/pack.scm (guix): Add commentary comment.
> (populate-profile-root, self-contained-tarball/builder): Extract to...
> * guix/build/pack.scm (populate-profile-root): ... this, and...
> (build-self-contained-tarball): ... that, adjusting for use on the build side.
> (assert-utf8-locale): New procedure.
> (self-contained-tarball, debian-archive, rpm-archive): Adjust accordingly.

Sorry for dropping the ball!

> Changes in v2:
> - Drop '!' from populate-profile-root!
> - Move top commentary comment below define-module block
> - Move expressions after definitions for Guile 2.0 compatibility
> - Remove #:target and #:archiver from build-self-contained-tarball

I believe the only outstanding issue for me is the ability to run tests
without relying on an external store.

>  (define* (self-contained-tarball name profile
>                                   #:key target
>                                   (profile-name "guix-profile")
> @@ -367,16 +240,40 @@ (define* (self-contained-tarball name profile
>      (warning (G_ "entry point not supported in the '~a' format~%")
>               'tarball))
>  
> +  (define database
> +    (and localstatedir?
> +         (file-append (store-database (list profile))
> +                      "/db/db.sqlite")))
> +
>    (gexp->derivation (string-append name ".tar"
>                                     (compressor-extension compressor))
> -    (self-contained-tarball/builder profile
> -                                    #:profile-name profile-name
> -                                    #:target target
> -                                    #:localstatedir? localstatedir?
> -                                    #:deduplicate? deduplicate?
> -                                    #:symlinks symlinks
> -                                    #:compressor compressor
> -                                    #:archiver archiver)))
> +    (with-extensions (list guile-gcrypt)
> +      (with-imported-modules `(((guix config) => ,(make-config.scm))

You can remove (guix config) here since it’s unused.

> +                               ,@(source-module-closure
> +                                  `((guix build pack)
> +                                    (guix build utils))
> +                                  #:select? not-config?))

I figured that, to allow tests to run without an external store, we need
to change it like this:

  (gexp->derivation (string-append name ".tar"
                                   (compressor-extension compressor))
    (with-extensions (if deduplicate? (list guile-gcrypt) '())
      (with-imported-modules (let ((lst (source-module-closure
                                         `((guix build pack)
                                           (guix build utils))
                                         #:select? not-config?)))
                               (if deduplicate?
                                   lst
                                   (delete '(guix store deduplication) lst)))
        #~(begin
            (use-modules (guix build pack)
                         (guix build utils))
            …))))

Quite some boilerplate given that #:deduplicate? is always #f in practice.
So maybe it’s not worth the trouble, after all.

I’ll let you rebase and adjust as you see fit, but it LGTM!

Thanks,
Ludo’.




  reply	other threads:[~2023-07-03  9:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-04  3:15 [bug#61949] [PATCH] pack: Move common build code to (guix build pack) Maxim Cournoyer
2023-03-06 15:47 ` Ludovic Courtès
2023-03-06 19:13   ` Maxim Cournoyer
2023-03-06 19:14 ` [bug#61949] [PATCH v2] " Maxim Cournoyer
2023-07-03  9:10   ` Ludovic Courtès [this message]
2023-07-18 21:13     ` bug#61949: [PATCH] " 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1jxqs10.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=61949@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=mail@cbaines.net \
    --cc=maxim.cournoyer@gmail.com \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=rekado@elephly.net \
    --cc=zimon.toutoune@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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.