From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 30 15:52:47 2020 Received: (at 43101) by debbugs.gnu.org; 30 Aug 2020 19:52:47 +0000 Received: from localhost ([127.0.0.1]:50810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCTNb-0005gT-Ar for submit@debbugs.gnu.org; Sun, 30 Aug 2020 15:52:47 -0400 Received: from lepiller.eu ([89.234.186.109]:47238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCTNY-0005gK-SK for 43101@debbugs.gnu.org; Sun, 30 Aug 2020 15:52:42 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id a1d29400; Sun, 30 Aug 2020 19:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:cc:subject:message-id:in-reply-to:references:mime-version :content-type; s=dkim; bh=tQWw6cGHTL1RIiwKub4lpfAKakqN4AZwdw3HyR CFLw4=; b=MD2bv68D8O4G5kIyJ/YTKs2pCyUDP1vq6VmEvkDxvjFVcxgRT8wL9y S+I+H/24xjo+LOoxG0Zw3J5f+hQHl+86GxOJmstskxMcHoS0agmx9IJYS74Mlufm h4BFaYrDCcQd8i8kvCPa9GjcrsYRvkhuLOT0Ho9juLG2hYl8M3/cH45gRQ/5ACtj Qthndp3G8btjOWJQHz7xaf5w2Juv0gPWPahSFen5YAt8t1wSicLVPdXnwfqo+Rjp F2HCEDuV27q3fDAtng/N73+k3DAj9HfaU2IejPk+hN1yg5hZLVTZK6S7FHIxaqz8 MuOR7bnSPK7hKrZIGK2lyuuS5iHGCn/A== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 7465d6da (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Sun, 30 Aug 2020 19:52:38 +0000 (UTC) Date: Sun, 30 Aug 2020 21:52:30 +0200 From: Julien Lepiller To: Mathieu Othacehe Subject: Re: [bug#43101] [PATCH v2] Add version number in release ISO Message-ID: <20200830215230.3dd526fd@tachikoma.lepiller.eu> In-Reply-To: References: <20200829154445.5512d99a@tachikoma.lepiller.eu> <87d038i6uf.fsf@gnu.org> <904ADAD9-76B7-4C7F-A0DF-39CEB6E3477D@lepiller.eu> <87v9h0p420.fsf@gnu.org> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/BeX4bW4G5pxTPKcgCN81SNR" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43101 Cc: Ludovic =?UTF-8?B?Q291cnTDqHM=?= , 43101@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --MP_/BeX4bW4G5pxTPKcgCN81SNR Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Here's v2 of the patch series. I've added one patch to (gnu ci) to set the version number in generated ISOs, and fixed other issues in the previous version of the patches. Le Sun, 30 Aug 2020 11:11:08 -0400, Julien Lepiller a =C3=A9crit : > Yes, it makes sense! I'll send a patch for that too. Thank you! >=20 > Le 30 ao=C3=BBt 2020 11:05:27 GMT-04:00, Mathieu Othacehe > a =C3=A9crit : > > > >Hello Julien, > > > >Thanks for this patch! > > =20 > >>>Please include (gnu image) and avoid =E2=80=98@=E2=80=99. =20 > >> > >> (gnu image) is already imported, but conflicts with another module > >> =20 > >for partition, leading to a compilation error. What should I do? > > > >You can maybe write something like: > > > >--8<---------------cut here---------------start------------->8--- > >#:use-module ((srfi srfi-1) #:hide (partition)) > >--8<---------------cut here---------------end--------------->8--- > > =20 > >> I'll add the architecture in there too, as per discussion in the =20 > >osinfo-db MR. > > > >Do you think it could be useful to add the same mechanism to ISO > >images built by the CI? In that case, you could maybe use the same > >mechanism in > >(gnu ci) and label the boot partition with %guix-version? > > > >Thanks, > > > >Mathieu =20 --MP_/BeX4bW4G5pxTPKcgCN81SNR Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-guix-system-Add-label-option.patch =46rom a502fa70b0230d3f91ddf05410f24a1f4fcad521 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sat, 29 Aug 2020 15:34:56 +0200 Subject: [PATCH 1/3] guix: system: Add `--label' option. * guix/scripts/system.scm (%options): Add `--label'. (system-derivation-for-action): Take a #:label key to set volume ID. (perform-action): Take a #:label key. (%default-options): Add default label value. (process-action): Pass label value from command-line to perform-action. --- doc/guix.texi | 4 +++- guix/scripts/system.scm | 27 ++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 6206a93857..56b1cd8976 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -28836,7 +28836,9 @@ the @option{--image-size} option is ignored in the = case of @code{docker-image}. =20 You can specify the root file system type by using the -@option{--file-system-type} option. It defaults to @code{ext4}. +@option{--file-system-type} option. It defaults to @code{ext4}. When its +value is @code{iso9660}, the @option{--label} option can be used to specify +a volume ID with @code{disk-image}. =20 When using @code{vm-image}, the returned image is in qcow2 format, which the QEMU emulator can efficiently use. @xref{Running Guix in a VM}, diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index f6d20382b6..33f4c8e4e8 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -6,6 +6,7 @@ ;;; Copyright =C2=A9 2018 Ricardo Wurmus ;;; Copyright =C2=A9 2019 Christopher Baines ;;; Copyright =C2=A9 2020 Jan (janneke) Nieuwenhuizen +;;; Copyright =C2=A9 2020 Julien Lepiller ;;; ;;; This file is part of GNU Guix. ;;; @@ -67,7 +68,7 @@ #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (gnu services herd) - #:use-module (srfi srfi-1) + #:use-module ((srfi srfi-1) #:hide (partition)) #:use-module (srfi srfi-11) #:use-module (srfi srfi-19) #:use-module (srfi srfi-26) @@ -662,7 +663,7 @@ checking this by themselves in their 'check' procedure." (define* (system-derivation-for-action os base-image action #:key image-size file-system-type full-boot? container-shared-network? - mappings) + mappings label) "Return as a monadic value the derivation for OS according to ACTION." (case action ((build init reconfigure) @@ -688,7 +689,14 @@ checking this by themselves in their 'check' procedure= ." (image (inherit base-image) (size image-size) - (operating-system os))))) + (operating-system os) + (partitions (match (image-partitions base-image) + ((boot others ...) + (cons + (partition + (inherit boot) + (label (or label (partition-label boot)))) + others)))))))) ((docker-image) (system-docker-image os #:shared-network? container-shared-network?))= )) =20 @@ -741,7 +749,7 @@ and TARGET arguments." install-bootloader? dry-run? derivations-only? use-substitutes? bootloader-target target - image-size file-system-type full-boot? + image-size file-system-type full-boot? label container-shared-network? (mappings '()) (gc-root #f)) @@ -795,6 +803,7 @@ static checks." ((target* (current-target-system)) (image -> (find-image file-system-type target*)) (sys (system-derivation-for-action os image action + #:label label #:file-system-type file-sy= stem-type #:image-size image-size #:full-boot? full-boot? @@ -942,6 +951,8 @@ Some ACTIONS support additional ARGS.\n")) --image-size=3DSIZE for 'vm-image', produce an image of SIZE")) (display (G_ " --no-bootloader for 'init', do not install a bootloader")) + (display (G_ " + --label=3DLABEL for 'disk-image', label disk image with LABEL")) (display (G_ " --save-provenance save provenance information")) (display (G_ " @@ -1008,6 +1019,9 @@ Some ACTIONS support additional ARGS.\n")) (option '("no-bootloader" "no-grub") #f #f (lambda (opt name arg result) (alist-cons 'install-bootloader? #f result))) + (option '("label") #t #f + (lambda (opt name arg result) + (alist-cons 'label arg result))) (option '("full-boot") #f #f (lambda (opt name arg result) (alist-cons 'full-boot? #t result))) @@ -1065,7 +1079,8 @@ Some ACTIONS support additional ARGS.\n")) (validate-reconfigure . ,ensure-forward-reconfigure) (file-system-type . "ext4") (image-size . guess) - (install-bootloader? . #t))) + (install-bootloader? . #t) + (label . #f))) =20 (define (verbosity-level opts) "Return the verbosity level based on OPTS, the alist of parsed options." @@ -1119,6 +1134,7 @@ resulting from command-line parsing." =20 (dry? (assoc-ref opts 'dry-run?)) (bootloader? (assoc-ref opts 'install-bootloader?)) + (label (assoc-ref opts 'label)) (target-file (match args ((first second) second) (_ #f))) @@ -1169,6 +1185,7 @@ resulting from command-line parsing." (_ #f)) opts) #:install-bootloader? bootloader? + #:label label #:target target-file #:bootloader-target bootloader-target #:gc-root (assoc-ref opts 'gc-root))))) --=20 2.28.0 --MP_/BeX4bW4G5pxTPKcgCN81SNR Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0002-gnu-ci-Set-label-in-iso9660-jobs.patch =46rom d98a5b9d36a74d47348a5a838209993f6b2539e0 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sun, 30 Aug 2020 20:43:42 +0200 Subject: [PATCH 2/3] gnu: ci: Set label in iso9660 jobs. * gnu/ci.scm (image-jobs): Set label of generated ISOs. --- gnu/ci.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gnu/ci.scm b/gnu/ci.scm index af0bb66775..c15baa99d3 100644 --- a/gnu/ci.scm +++ b/gnu/ci.scm @@ -2,6 +2,7 @@ ;;; Copyright =C2=A9 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 = Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2017 Jan Nieuwenhuizen ;;; Copyright =C2=A9 2018, 2019 Cl=C3=A9ment Lassieur +;;; Copyright =C2=A9 2020 Julien Lepiller ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,6 +26,7 @@ #:use-module (guix profiles) #:use-module (guix packages) #:use-module (guix channels) + #:use-module (guix config) #:use-module (guix derivations) #:use-module (guix build-system) #:use-module (guix monads) @@ -234,7 +236,15 @@ system.") (build-image (image (inherit iso9660-image) - (operating-system installation-os)))) + (operating-system installation-os) + (partitions (match (image-partitions iso9660-image) + ((boot others ...) + (cons + (partition + (inherit boot) + (label (string-append "GUIX_" system = "_" + %guix-version))) + others))))))) ;; Only cross-compile Guix System images from x86_64-linux for now. ,@(if (string=3D? system "x86_64-linux") (map (lambda (image) --=20 2.28.0 --MP_/BeX4bW4G5pxTPKcgCN81SNR Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0003-Makefile.am-Set-iso-label.patch From 2e8ca2e8ece588932d00d1bc12182e9a9a7f53e3 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sat, 29 Aug 2020 15:36:40 +0200 Subject: [PATCH 3/3] Makefile.am: Set iso label. * Makefile.am (release): Add version number in disk image label. --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 4c10bd37bc..063556c7ac 100644 --- a/Makefile.am +++ b/Makefile.am @@ -834,6 +834,7 @@ release: dist-with-updated-version image=`$(top_builddir)/pre-inst-env \ guix system disk-image \ --file-system-type=iso9660 \ + --label="GUIX_$${system}_$(VERSION)" \ --system=$$system --fallback \ gnu/system/install.scm` ; \ if [ ! -f "$$image" ] ; then \ -- 2.28.0 --MP_/BeX4bW4G5pxTPKcgCN81SNR--