GNU bug report logs - #57680
[PATCH 0/2] image: Add tarball support.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <othacehe <at> gnu.org>

Date: Thu, 8 Sep 2022 15:26:01 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <mathieu <at> meije.mail-host-address-is-not-set>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 57680 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 57680 <at> debbugs.gnu.org, Alex Griffin <a <at> ajgrf.com>
Subject: Re: bug#57680: [PATCH 0/2] image: Add tarball support.
Date: Sat, 24 Sep 2022 15:52:05 +0200
Hi,

Mathieu Othacehe <othacehe <at> gnu.org> skribis:

> From: Alex Griffin <a <at> ajgrf.com>
>
> * gnu/image.scm (<image>)[fields]: Add tarball to the supported formats.
> * gnu/system/image.scm (tarball-image, tarball-image-type): New variables.
> (system-tarball-image): New procedure.
> (image->root-file-system): Add tarball image support.
> (system-image): Ditto.
>
> Signed-off-by: Mathieu Othacehe <othacehe <at> gnu.org>

Nice!

Perhaps we need to mention it in the manual?

> +;;
> +;; Tarball image.
> +;;

Three semicolons maybe?  :-)

> +(define* (system-tarball-image image
> +                               #:key
> +                               (name "image")
> +                               (compressor (srfi-1:first %compressors)))
> +  "Build a tarball of IMAGE.  NAME is the base name to use for the
> +output file."
> +  (let* ((os (image-operating-system image))
> +         (substitutable? (image-substitutable? image))
> +         (schema (local-file (search-path %load-path
> +                                          "guix/store/schema.sql")))
> +         (name (string-append name ".tar" (compressor-extension compressor)))
> +         (graph "system-graph"))
> +    (define builder
> +      (with-extensions gcrypt-sqlite3&co          ;for (guix store database)
> +        (with-imported-modules `(,@(source-module-closure
> +                                    '((guix build pack)
> +                                      (guix build store-copy)
> +                                      (guix build utils)
> +                                      (guix store database)
> +                                      (gnu build image))
> +                                    #:select? not-config?)
> +                                 ((guix config) => ,(make-config.scm)))
> +          #~(begin
> +              (use-modules (guix build pack)
> +                           (guix build store-copy)
> +                           (guix build utils)
> +                           (guix store database)
> +                           (gnu build image))
> +
> +              ;; Set the SQL schema location.
> +              (sql-schema #$schema)
> +
> +              ;; Allow non-ASCII file names--e.g., 'nss-certs'--to be decoded.
> +              (setenv "GUIX_LOCPATH"
> +                      #+(file-append glibc-utf8-locales "/lib/locale"))
> +              (setlocale LC_ALL "en_US.utf8")
> +
> +              (let ((image-root (string-append (getcwd) "/tmp-root"))
> +                    (tar #+(file-append tar "/bin/tar")))
> +
> +                (mkdir-p image-root)
> +                (initialize-root-partition image-root
> +                                           #:references-graphs '(#$graph)
> +                                           #:deduplicate? #f
> +                                           #:system-directory #$os)
> +
> +                (with-directory-excursion image-root
> +                  (apply invoke tar "-cvf" #$output "."
> +                         (tar-base-options
> +                          #:tar tar
> +                          #:compressor
> +                          #+(and=> compressor compressor-command)))))))))
> +
> +    (computed-file name builder
> +                   ;; Allow offloading so that this I/O-intensive process
> +                   ;; doesn't run on the build farm's head node.
> +                   #:local-build? #f
> +                   #:options `(#:references-graphs ((,graph ,os))
> +                               #:substitutable? ,substitutable?))))

There’s probably something to be factorized with (guix scripts pack),
but that can be left for later with a TODO.

Otherwise LGTM, thank you & Alex!

Ludo’.




This bug report was last modified 2 years and 318 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.