From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: bug#26271: 'guix system' does not support common build option '--root' Date: Tue, 04 Apr 2017 00:39:12 -0700 Message-ID: <87zifwaafz.fsf@garuda.i-did-not-set--mail-host-address--so-tickle-me> References: <871stjfhfk.fsf@gmail.com> <87y3vrm6zi.fsf@gnu.org> <87inmu3j12.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvJ4P-0003ff-VO for bug-guix@gnu.org; Tue, 04 Apr 2017 03:40:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvJ4M-00045E-Pu for bug-guix@gnu.org; Tue, 04 Apr 2017 03:40:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:33327) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cvJ4M-000455-NK for bug-guix@gnu.org; Tue, 04 Apr 2017 03:40:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cvJ4M-0002TQ-GH for bug-guix@gnu.org; Tue, 04 Apr 2017 03:40:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87inmu3j12.fsf@gmail.com> (Chris Marusich's message of "Mon, 27 Mar 2017 07:12:57 -0700") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Chris Marusich Cc: 26271@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Chris Marusich writes: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Hi Chris, >> >> Chris Marusich skribis: >> >>> The manual says ((guix) Invoking guix system) that the options to 'guix >>> system' "can contain any of the common build options". Although some >>> common build options (e.g. '--fallback') do seem to work, I have noticed >>> that the '--root' option does not. Consider the following: >> >> That=E2=80=99s because =E2=80=98--root=E2=80=99 is not a =E2=80=9Ccommon= build option=E2=80=9D in the sense of >> "(guix) Common Build Options". :-) >> >> That said, I agree we should either make it a common option (i.e., add >> it to =E2=80=98%standard-build-options=E2=80=99 in (guix scripts build))= or add it >> explicitly to =E2=80=98guix system=E2=80=99. The latter may be simpler. >> >> Thoughts? > > As long as 'guix system' will create an indirect gc root as expected, > regardless of whether '--root' was specified in the environment variable > for build options or as a command-line option for the 'guix system' > command, adding it explicitly to 'guix system' seems OK to me. > > I'll see if I can submit a patch later this week. I've attached a small patch series which adds support. Please let me know what you think. (If you prefer that I send the patches to you via some other email list or something, please let me know.) I've verified manually that the patches fix the issue. For example: =2D-8<---------------cut here---------------start------------->8--- $ GUIX_BUILD_OPTIONS=3D'--root=3Dmy-indirect-root' ./pre-inst-env guix syst= em disk-image ~/guix/gnu/system/install.scm /gnu/store/qr83vk7lifm63jscrv1gfqzj80zwkmca-disk-image $ ls -l | grep indir lrwxrwxrwx 1 marusich users 54 Apr 3 23:44 my-indirect-root -> /gnu/= store/qr83vk7lifm63jscrv1gfqzj80zwkmca-disk-image $ ls -l /var/guix/gcroots/auto/ | grep indir lrwxrwxrwx 1 root root 36 Apr 3 23:44 wk6bx8f7xjq8ab7dz683n64ly21dyw8x -> = /home/marusich/guix/my-indirect-root =2D-8<---------------cut here---------------end--------------->8--- It works the same when I pass the option directly on the command line as '--root=3Dfoo' or '-r foo', too. =2D-=20 Chris --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-build-Export-register-root-procedure.patch Content-Transfer-Encoding: quoted-printable From=20ccf03e4bb5d5c2d3a47efdf64e36a7d903bfb2c5 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Mon, 3 Apr 2017 23:47:22 -0700 Subject: [PATCH 1/2] build: Export register-root procedure. * guix/scripts/build.scm: Export register-root procedure. =2D-- guix/scripts/build.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 68402fda1..ba47b1232 100644 =2D-- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -51,7 +51,8 @@ options->transformation show-transformation-options-help =20 =2D guix-build)) + guix-build + register-root)) =20 (define %default-log-urls ;; Default base URLs for build logs. =2D-=20 2.12.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-system-Support-the-root-option-in-guix-system.patch Content-Transfer-Encoding: quoted-printable From=20e96c877459555f4cf868fb5fe4579183f6a773d5 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Mon, 3 Apr 2017 23:49:22 -0700 Subject: [PATCH 2/2] system: Support the --root option in 'guix system'. Fixes . * guix/scripts/system.scm (perform-action): Add parameters 'store' and 'gc-root'. Update docstring. (perform-action) [gc-root]: Add an indirect GC root using store. (%options): Add 'root'. (process-action): Pass 'store' and 'root' to perform-action. =2D-- guix/scripts/system.scm | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 144a7fd37..54a9e1d37 100644 =2D-- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -589,19 +589,24 @@ PATTERN, a string. When PATTERN is #f, display all t= he system generations." (warning (_ "Consider running 'guix pull' before 'reconfigure'.~%")) (warning (_ "Failing to do that may downgrade your system!~%")))) =20 =2D(define* (perform-action action os +(define* (perform-action store action os #:key grub? dry-run? derivations-only? use-substitutes? device target image-size full-boot? =2D (mappings '())) =2D "Perform ACTION for OS. GRUB? specifies whether to install GRUB; DEVI= CE is =2Dthe target devices for GRUB; TARGET is the target root directory; IMAGE-= SIZE =2Dis the size of the image to be built, for the 'vm-image' and 'disk-image' =2Dactions. FULL-BOOT? is used for the 'vm' action; it determines whether = to =2Dboot directly to the kernel or to the bootloader. + (mappings '()) + (gc-root #f)) + "Perform ACTION for OS using STORE, which is an open connection to the +store. GRUB? specifies whether to install GRUB; DEVICE is the target dev= ices +for GRUB; TARGET is the target root directory; IMAGE-SIZE is the size of t= he +image to be built, for the 'vm-image' and 'disk-image' actions. FULL-BOOT= ? is +used for the 'vm' action; it determines whether to boot directly to the ke= rnel +or to the bootloader. =20 When DERIVATIONS-ONLY? is true, print the derivation file name(s) without =2Dbuilding anything." +building anything. + +When GC-ROOT is a path, also make that path an indirect root of the build +output when building a system derivation, such as a disk image." (define println (cut format #t "~a~%" <>)) =20 @@ -666,7 +671,10 @@ building anything." #:device device)) (else ;; All we had to do was to build SYS. =2D (return (derivation->output-path sys)))))))) + (return (let ((output-path (derivation->output-path sys))) + (if gc-root + (register-root store (list output-path) gc-root) + output-path))))))))) =20 (define (export-extension-graph os port) "Export the service extension graph of OS to PORT." @@ -797,6 +805,9 @@ Some ACTIONS support additional ARGS.\n")) (lambda (opt name arg result) (alist-cons 'system arg (alist-delete 'system result eq?)))) + (option '(#\r "root") #t #f + (lambda (opt name arg result) + (alist-cons 'gc-root arg result))) %standard-build-options)) =20 (define %default-options @@ -850,7 +861,7 @@ resulting from command-line parsing." ((shepherd-graph) (export-shepherd-graph os (current-output-port))) (else =2D (perform-action action os + (perform-action store action os #:dry-run? dry? #:derivations-only? (assoc-ref opts 'derivations-o= nly?) @@ -863,7 +874,8 @@ resulting from command-line parsing." (_ #f)) opts) #:grub? grub? =2D #:target target #:device device)))) + #:target target #:device device + #:gc-root (assoc-ref opts 'gc-root))))) #:system system)))) =20 (define (process-command command args opts) =2D-=20 2.12.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAljjTaEACgkQ3UCaFdgi Rp12yRAAuSDQZNgFwMR7EhAJR/HnlOJS3oc1BUcxk3y3fQa6k+jEiW0AebSukfUQ X4IJKTqzuiowVQC8ZesRbLU9oLJaUZxyBk8tLcZ5JP+McV8BoocDhI55mb5ILEEK Cw4QLaXBQjy4WMO7TT94Zbe2gcn3NkKaWs6Ndb03JXLkSNDWlQUgRdsnmYl9sk/8 FEe9ptT7bYU4BMywobI7np7dHtmN8tYRbDFHEJUMgkMOXYiWnU/fpBZm/8FimnpZ Gj/FLSFJt6dPkNkOgT4gXUuMrVzOTqgmNUgqIEM59MDUzaZ6K9n2KiuhOMeJ8jGC pnS1boskmO7K8R8ELgQTcljAY4RuK01TAtHkEANEXjzCRpa2AjVra9AqeUc6CaJU mGP5JySsUIcx0zPxZkk+GMLHtuiP9L3puAidB6h1Z3JnO/8f0s1RadrhNTpRoQN5 LtUy26yNrhmUZgJflOdZWI+b7mpPi7eeW3nwKgNKm2jTtMWcTrZc7K2gUvoPKLNY cnissb8A4WdSdpGVIC9AGT1qMExqv+kLJpHgeUYU1bGL56meECh/D35FNAD1FGDf LFgXymuMj6oSKBLS4RB8VSDJoAOEc+tFC+oRE00Or6y+bByJrQJSXNpKTDMgAAoA mpUhNVmuhjHi+vUVYynIBTPRrIuPbiL3ioTcbDWpKhj45BSdP88= =5FqN -----END PGP SIGNATURE----- --==-=-=--