Received: (at 64173) by debbugs.gnu.org; 18 Aug 2023 14:01:01 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 18 10:01:01 2023 Received: from localhost ([127.0.0.1]:48454 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qX028-0001oB-S6 for submit <at> debbugs.gnu.org; Fri, 18 Aug 2023 10:01:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48722) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1qX026-0001nq-Vi; Fri, 18 Aug 2023 10:00:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1qX01z-0002XM-NR; Fri, 18 Aug 2023 10:00:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=JhtAixlJdVTxmFpSU+3fqCvtJyXg1vCx85TjPRo9cNo=; b=Hoxa4lMOj32y5fwLedhW pSWlv46DHMMv5USI2nGLp0OttPzdLhxxLBjM1w9XUWWDP9OmLtCJr8c5qoSQm3rTBzsK+zLxkirk/ Z2TFhuHXTu2o6Fuk3d6fjTBhg5VGDUFX7nKP9Tp5FuDNn9wEF9rgzgkPTH2TLIP3UiTDX4KJxFPNJ yf7broYM6Di6r2741/kSIQnqvic72k048TayNRx4WEly8o20SLC00tlLMLL4PHpbiuAX+op8JQ8Ql 61EyF1MO4bfJi7kRlKQmdS2JRWO8py0qHRwuzrnDAqUEPBRrrk9SKzexWL0nP/kOBFalXcwyI+Eb7 PIzxU/+hS0ZguQ==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: Simon Tournier <zimon.toutoune@HIDDEN> Subject: Re: [bug#64173] [PATCH 0/1] guix: pack: add --entry-point-argument option References: <cover.1687188729.git.graham@HIDDEN> <53f0c51cabbd317469721fb7f47b47af50d42177.1689149161.git.graham@HIDDEN> <87wmxuxax2.fsf_-_@HIDDEN> <87sf8h51pq.fsf@HIDDEN> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Primidi 1 Fructidor an 231 de la =?utf-8?Q?R=C3=A9vo?= =?utf-8?Q?lution=2C?= jour de la Prune X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 18 Aug 2023 16:00:48 +0200 In-Reply-To: <87sf8h51pq.fsf@HIDDEN> (Simon Tournier's message of "Thu, 17 Aug 2023 13:48:33 +0200") Message-ID: <87zg2oqwkv.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64173 Cc: Graham James Addis <graham@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Christopher Baines <mail@HIDDEN>, 64173 <at> debbugs.gnu.org, Mathieu Othacehe <othacehe@HIDDEN>, Graham James Addis <grahamjamesaddis@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, 64171 <at> debbugs.gnu.org, Ricardo Wurmus <rekado@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Hi, Simon Tournier <zimon.toutoune@HIDDEN> skribis: > Just to be sure to understand, the command-line could list several > --entry-point-argument options, right? Yes. > Well, since the order of the various command-line arguments might > matter, and since a =E2=80=99reverse=E2=80=99 is suggested, and since all= the Guix > command-lines do not behave the same way =E2=80=93 for instance =E2=80=9C= guix package=E2=80=9D > processes command-line argument from right to left; see #43585 or #50473 > [1,2]; anyway :-) =E2=80=93 I would suggest to add a sentence in the > documentation (manual) that the command-line arguments are parsed from > left to right. No: the =E2=80=98reverse=E2=80=99 puts them back in the right order (because =E2=80=98args-fold*=E2=80=99 traverses the option list from left to right a= nd thus conses the result in reverse order.) HTH! Ludo=E2=80=99.
guix-patches@HIDDEN
:bug#64173
; Package guix-patches
.
Full text available.Received: (at 64173) by debbugs.gnu.org; 17 Aug 2023 14:07:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 17 10:07:16 2023 Received: from localhost ([127.0.0.1]:45255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qWdee-0007WA-GA for submit <at> debbugs.gnu.org; Thu, 17 Aug 2023 10:07:16 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:40305) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>) id 1qWdea-0007Vp-Ub; Thu, 17 Aug 2023 10:07:15 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fe8d816a40so12940405e9.1; Thu, 17 Aug 2023 07:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692281227; x=1692886027; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ZsoI3nzONheWXBjGPK4RyHGMt1L2bXcPY2xSHnkfI/U=; b=QkoQHL2kkU9zIJDGO77vIWrrflA+1a47dMhBUtmmX9aEzV6y0lR/i2DYGbWJYvJdj9 PucKllJ6BomCRSQmafvaSamiJDOn5v4tv9Nnh5KRPUgcLoiovKtXUqceEsR7tx0RzgnK nzalATEJHjeDefdPfx+6unLTLoqEP+BHIPo4AX6BhqHT4W1aFMcqbc8pwgSiw/68t2zf 5wwM+zE+XV21LFg0u939dWCWveio4y31JE+xCeHoMt3Yq4gr5dhEQzIGy3gdruogzHdV azoBIVyDd9muon2zY6ko0Yq6F7J86mq0ebwp7ZgharbgH0OHkKTtEBFtiy5IiRML3KQz h4lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692281227; x=1692886027; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZsoI3nzONheWXBjGPK4RyHGMt1L2bXcPY2xSHnkfI/U=; b=Y5VLoqljc7NBsZHu1COqOCTusK4tW5KsfPcwmOQceCeq7l1bblHwISUSuvIbbxoH9p v6vn+CPq22TiMktrNoVP/XQpzQzP3rGd+WsvYOTOZqlEQQF7oKcf0g7/N3CoYFMBr75q +roW1UqQ4X06IE7pJhIItsUnLSAoYDsq34q/Q2L9YxTFBvOzNmUG+Fg4liRWO9+0lJXw GyJdyhrVwNDCTooMsai58Mfs+QAYm4nab1iQmHw6e6Fb5inSLdRt2OQdVpb7nAX26a3M y4L6zxIKolbbokjX8urIADon1e+a/EzJe+5PraVxrGYUUK9bdQDLTeEFFVUQPi/QISeM 9xHA== X-Gm-Message-State: AOJu0YyL/ZYJ7JSxZ0Xp0nNH86LIbuDaI4WV0xDblTHzWGnOWTc2zOgi z4IoZPWiO0Rtzq68wqVXqsc= X-Google-Smtp-Source: AGHT+IHsPxZBPIhDy+fMSHSbobm6QRDF4LtKVxU6Vt1sVtKylCmm4KF/duH63b25d9Y11EnRFiFfJg== X-Received: by 2002:a05:600c:3108:b0:3fc:2d8:b1f2 with SMTP id g8-20020a05600c310800b003fc02d8b1f2mr4589896wmo.3.1692281226636; Thu, 17 Aug 2023 07:07:06 -0700 (PDT) Received: from pfiuh07 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id p11-20020a1c740b000000b003fbb0c01d4bsm3141328wmc.16.2023.08.17.07.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 07:07:06 -0700 (PDT) From: Simon Tournier <zimon.toutoune@HIDDEN> To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Graham James Addis <grahamjamesaddis@HIDDEN> Subject: Re: [bug#64173] [PATCH 0/1] guix: pack: add --entry-point-argument option In-Reply-To: <87wmxuxax2.fsf_-_@HIDDEN> References: <cover.1687188729.git.graham@HIDDEN> <53f0c51cabbd317469721fb7f47b47af50d42177.1689149161.git.graham@HIDDEN> <87wmxuxax2.fsf_-_@HIDDEN> Date: Thu, 17 Aug 2023 13:48:33 +0200 Message-ID: <87sf8h51pq.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64173 Cc: Graham James Addis <graham@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Christopher Baines <mail@HIDDEN>, 64173 <at> debbugs.gnu.org, Mathieu Othacehe <othacehe@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, 64171 <at> debbugs.gnu.org, Ricardo Wurmus <rekado@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi, On Thu, 17 Aug 2023 at 11:42, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote: >> +(define (entry-point-argument-spec-option-parser opt name arg result) >> + "A SRFI-37 opion parser for the --entry-point-argument option. The sp= ec >> +takes multiple occurances. The entries are used in the exec form for the >> +docker entry-point. The values are used as parameters in conjunction wi= th >> +the --entry-point option which is used as the first value in the exec f= orm." >> + (let ((entry-point-argument (assoc-ref result 'entry-point-argument))) >> + (alist-cons 'entry-point-argument >> + (append entry-point-argument (list arg)) >> + (alist-delete 'entry-point-argument result eq?)))) > > I would just keep a regular option parser that does: > > (alist-cons 'entry-point-argument arg result) > > Later on, we=E2=80=99d collect all these arguments: > > (reverse > (filter-map (match-lambda > (('entry-point-argument . arg) arg) > (_ #f)) > opts)) > > I think this would be a bit clearer; this is what =E2=80=98guix repl=E2= =80=99 does, for > instance. [...] > This can be omitted if you take the approach suggested above, with one > =E2=80=98entry-point-argument=E2=80=99 pair per argument. [...] > This would become #:entry-point-arguments (plural), with the > =E2=80=98filter-map=E2=80=99 trick shown above. Just to be sure to understand, the command-line could list several --entry-point-argument options, right? Well, since the order of the various command-line arguments might matter, and since a =E2=80=99reverse=E2=80=99 is suggested, and since all t= he Guix command-lines do not behave the same way =E2=80=93 for instance =E2=80=9Cgu= ix package=E2=80=9D processes command-line argument from right to left; see #43585 or #50473 [1,2]; anyway :-) =E2=80=93 I would suggest to add a sentence in the documentation (manual) that the command-line arguments are parsed from left to right. 1: https://issues.guix.gnu.org/issue/43585 2: https://issues.guix.gnu.org/issue/50473 Cheers, simon
guix-patches@HIDDEN
:bug#64173
; Package guix-patches
.
Full text available.Received: (at 64173) by debbugs.gnu.org; 17 Aug 2023 09:42:31 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 17 05:42:31 2023 Received: from localhost ([127.0.0.1]:42777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qWZWQ-0000HB-Gl for submit <at> debbugs.gnu.org; Thu, 17 Aug 2023 05:42:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57128) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1qWZWO-0000Gv-3i; Thu, 17 Aug 2023 05:42:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1qWZWH-000548-Gv; Thu, 17 Aug 2023 05:42:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=9PFGrYCpoXycpLt0tHRB0LM8Phjn29++3lGHcvslrJc=; b=CFSSTTgfAQk9q5U6dg1E 8e7ksQPHhlhhdvGeopsustjY0S7DciBeVIHyfl1D6qDwNieDMalIYtUer7pIJnZuyVT7sqJkKdii9 kY9v7Yl9+vqI7p+JaHpWJAH8xeKAdDDo31+OmKliTWxJ2TTgrTO6bs5wAyI/7zhYzuK6lbgHb3j0K Z2xem/pOIGTLyJUjVkxONcpQhy+il6Je7eX2Ga7i38kUf/kgBQtjV0jLx/gPLlds5tPZ0nIYEQTLB pMhGwb/ncGniQRe6WBPxy2toPv8Txx/sKvKVpwZONGtu6eicWfUoXa9V2HK7T0EahV7DtuSN8ur5d 2uMBhZOt0ltAgA==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: Graham James Addis <grahamjamesaddis@HIDDEN> Subject: Re: bug#64173: [PATCH 0/1] guix: pack: add --entry-point-argument option References: <cover.1687188729.git.graham@HIDDEN> <53f0c51cabbd317469721fb7f47b47af50d42177.1689149161.git.graham@HIDDEN> Date: Thu, 17 Aug 2023 11:42:17 +0200 In-Reply-To: <53f0c51cabbd317469721fb7f47b47af50d42177.1689149161.git.graham@HIDDEN> (Graham James Addis's message of "Wed, 12 Jul 2023 09:17:13 +0100") Message-ID: <87wmxuxax2.fsf_-_@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64173 Cc: Graham James Addis <graham@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, 64173 <at> debbugs.gnu.org, Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Christopher Baines <mail@HIDDEN>, 64171 <at> debbugs.gnu.org, Ricardo Wurmus <rekado@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Hi Graham, Apologies for the delay (holiday time!). Graham James Addis <grahamjamesaddis@HIDDEN> skribis: > * guix/scripts/pack.scm: add support for parameters in entry-point > (entry-point-argument-spec-option-parser): add function to parse --entry-= point-argument > (docker-image): Add function (form_entry_point) to handle --entry-point > vs --entry-point-argument merging > (docker-image): change call to (build-docker-image) to use (form-entry-po= int) > (%default-options): add dafault for --entry-point-argument option > (%docker-format-options): parser for --entry-point-argument > (show-docker-format-options): help for --docker-format-options > (show-docker-format-options/detailed): detailed help for --docker-format-= options > (%options): add flag for --help-docker-format and add parser for --docker= -format-options > (extra-options): add entry-point-argument option This is really a minor issue and I don=E2=80=99t mind fixing it for you, but note that the ChangeLog style just needs to say what has been changed/added/removed. For example: (entry-point-argument-spec-option-parser): New procedure. > (guix.texi): add documentation And here: * doc/guix.texi (Inovking guix pack): Document it. I like this new version. Here are a few things that I think would need to be changed before we can push: > +@cindex entry point arguments, for docker images > +@item --entry-point-argument=3D@var{command} > +@itemx -A @var{command} Maybe @var{argument} for consistency and clarity? > +Use @var{command} as an argument to @dfn{entry point} of the resulting p= ack. > +This option is only valid in conjunction with @code{--entry-point} and c= an > +appear multiple times on the command line. Maybe add: =E2=80=9CThe example below shows illustrates that, passing @option{--help} to the @command{guile} command:=E2=80=9D > +@example > +guix pack -f docker --entry-point=3Dbin/guile --entry-point-argument=3D"= --help" guile > +@end example [...] > +(define (entry-point-argument-spec-option-parser opt name arg result) > + "A SRFI-37 opion parser for the --entry-point-argument option. The spec > +takes multiple occurances. The entries are used in the exec form for the > +docker entry-point. The values are used as parameters in conjunction with > +the --entry-point option which is used as the first value in the exec fo= rm." > + (let ((entry-point-argument (assoc-ref result 'entry-point-argument))) > + (alist-cons 'entry-point-argument > + (append entry-point-argument (list arg)) > + (alist-delete 'entry-point-argument result eq?)))) I would just keep a regular option parser that does: (alist-cons 'entry-point-argument arg result) Later on, we=E2=80=99d collect all these arguments: (reverse (filter-map (match-lambda (('entry-point-argument . arg) arg) (_ #f)) opts)) I think this would be a bit clearer; this is what =E2=80=98guix repl=E2=80= =99 does, for instance. > + (define (form-entry-point > + prefix entry-point > + entry-point-argument) > + ;; construct entry-point parameter for build-docker-image > + ;; the first entry is constructed by prefixing the entry-p= oint > + ;; with the supplied index subsequent entries are taken fr= om > + ;; the --entry-point-argument options > + (cond > + (entry-point > + (cons* > + (string-append prefix "/" entry-point) > + entry-point-argument) > + ) I=E2=80=99d avoid this extra procedure. > + ('()))) ;empty list returned if no conditions are met > + > + (let-keywords '#$extra-options #f ((entry-point-argument #f)) > + (setenv "PATH" #+(file-append archiver "/bin")) > + > + (build-docker-image #$output > + (map store-info-item > + (call-with-input-file "profile" > + read-reference-graph)) > + #$profile > + #:repository (manifest->friendly-name > + (profile-manifest #$prof= ile)) > + #:database #+database > + #:system (or #$target %host-type) > + #:environment environment > + #:entry-point (form-entry-point > + #$profile > + #$entry-point > + entry-point-argument) How about keeping it similar to what it looks like currently: #:entry-point #$(and entry-point #~(cons (string-append #$profile "/" #$entry-point) '#$(or (assoc-ref extra-options #:entry-point-arguments) '()))) ? > @@ -1346,6 +1375,7 @@ (define %default-options > (debug . 0) > (verbosity . 1) > (symlinks . ()) > + (entry-point-argument . ()) This can be omitted if you take the approach suggested above, with one =E2=80=98entry-point-argument=E2=80=99 pair per argument. > +(define %docker-format-options > + (list (option '(#\A "entry-point-argument") #t #f > + entry-point-argument-spec-option-parser))) > + > +(define (show-docker-format-options) > + (display (G_ " > + --help-docker-format > + list options specific to the DOCKER format"))) > + > +(define (show-docker-format-options/detailed) > + (display (G_ " > + -A, --entry-point-argument=3DCOMMAND/PARAMETER > + Value(s) to use for the Docker EntryPoint argum= ents. > + Multiple instances are accepted. This is only v= alid > + in conjunction with the --entry-point option.")) > + (newline) > + (exit 0)) > + > (define %options > ;; Specifications of the command-line options. > (cons* (option '(#\h "help") #f #f > @@ -1508,8 +1557,13 @@ (define %options > (lambda args > (show-rpm-format-options/detailed))) >=20=20 > + (option '("help-docker-format") #f #f > + (lambda args > + (show-docker-format-options/detailed))) > + > (append %deb-format-options > %rpm-format-options > + %docker-format-options > @@ -1528,6 +1582,7 @@ (define (show-help) > (newline) > (show-deb-format-options) > (show-rpm-format-options) > + (show-docker-format-options) Leftover, can be removed. > @@ -1696,6 +1751,8 @@ (define-command (guix-pack . args) > (process-file-arg opts 'preun= -file) > #:postun-file > (process-file-arg opts 'postu= n-file))) > + ('docker > + (list #:entry-point-argument (assoc= -ref opts 'entry-point-argument))) This would become #:entry-point-arguments (plural), with the =E2=80=98filter-map=E2=80=99 trick shown above. Also, it should be possible to make it work for the Singularity backend, right? We can keep it for a subsequent commit if you prefer, but then please add a TODO comment. Could you send an updated patch? Thanks in advance! Ludo=E2=80=99.
guix-patches@HIDDEN
:bug#64173
; Package guix-patches
.
Full text available.Graham Addis <grahamjamesaddis@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Ludovic Courtès <ludo@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at submit) by debbugs.gnu.org; 19 Jun 2023 15:38:37 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 19 11:38:36 2023 Received: from localhost ([127.0.0.1]:57039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qBGxg-00031j-4x for submit <at> debbugs.gnu.org; Mon, 19 Jun 2023 11:38:36 -0400 Received: from lists.gnu.org ([209.51.188.17]:52422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <grahamjamesaddis@HIDDEN>) id 1qBGxd-00031a-2q for submit <at> debbugs.gnu.org; Mon, 19 Jun 2023 11:38:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <grahamjamesaddis@HIDDEN>) id 1qBGxc-0000Fv-Rq for guix-patches@HIDDEN; Mon, 19 Jun 2023 11:38:32 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <grahamjamesaddis@HIDDEN>) id 1qBGxa-0007yS-PM for guix-patches@HIDDEN; Mon, 19 Jun 2023 11:38:32 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3f907f311ccso26055385e9.1 for <guix-patches@HIDDEN>; Mon, 19 Jun 2023 08:38:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687189109; x=1689781109; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/KBTE5bbZSlxHdWXXgpjYwi12ZxAJzPcpAPDN/T0Sao=; b=UqMPaV0fUq2XlwUVUo51k9dEQZb4vBKyNonRdmyyVqplfVlypD2tUER8YLeol40ly+ 9JuRcxX8QQ6TQA/1tCZAXv0S9vKkHesYG3qMeHutS9FRs+IRJHLXzrzAGLEzqhs89vwe 9nHZPx8d4PDJ8+e/WZqN/6w61gGtE0IPu6RVrLN3Mj5kcWWdDu3tmOPuVP+AStsOADlN AfLvcE8wSP5QNOVphf2tcHuWxU2h2Zw6XXX4uCfXjnJbV+Ha7Vx+1iw/vTS0v8//atSo wzxvrg3G0p98trDUr1a8JNTRE7lZ0Qz6KPUd2kwdvE0/KMSizgmInaH0IR1mu+VF7Azz nYPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687189109; x=1689781109; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/KBTE5bbZSlxHdWXXgpjYwi12ZxAJzPcpAPDN/T0Sao=; b=gFk1rJQ5ZAom1Li+63zN3Q6r4vZLCFhMhYwv0yg1JTCK6VP+arSX4HehPYRV2eHal6 2mmZ211zBhW8sHAjFXyeypM05Z8eBKMGCzDDe2W2pJcyT70U9rz1MdxJrpsYuK3JRRPJ pzWuDUpqkntlkrzt3tdIL0zsLzZX7EGE54/lovc6FgLiWXfrXzRadTJu+1n7yFYIUQxv c3tB8MKiVarQTq16SlV4dsXacNGnRx0P4A4FebfCOEDRwWKyjiS92yIGQnRXYDfzA8Ak DiWuE0jLEOWcwHqUJjOLGjY+8uNFNFS9TY46k7m8+uBszujcGWm19UKpg+NJTEpOG3/s +Imw== X-Gm-Message-State: AC+VfDy7P2TjbMEdX0rVQN+s3eU5TokM4c9oAuV8bNHQSWHlSQkfvkdn 2ngR3KGj45m+hEDOBP3brJyN2Pav8Zk= X-Google-Smtp-Source: ACHHUZ7TsNAJFnL6yMqz+OFPrFvUGYWFEVVCsrik+jcFzLmcuHtHDQ41hMwX9PgdLhcoRqBev6H+Hg== X-Received: by 2002:a05:600c:290b:b0:3f8:d8f7:ce23 with SMTP id i11-20020a05600c290b00b003f8d8f7ce23mr8211101wmd.5.1687189108937; Mon, 19 Jun 2023 08:38:28 -0700 (PDT) Received: from guix-test.home ([2a00:23c7:59a9:c901:41c8:db68:b8b1:9808]) by smtp.gmail.com with ESMTPSA id y17-20020a1c4b11000000b003f7f249e7dfsm10306432wma.4.2023.06.19.08.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 08:38:28 -0700 (PDT) From: Graham James Addis <grahamjamesaddis@HIDDEN> X-Google-Original-From: Graham James Addis <graham@HIDDEN> To: guix-patches@HIDDEN Subject: [PATCH 1/1] guix: pack: docker add docker-entry-point options Date: Mon, 19 Jun 2023 16:38:01 +0100 Message-Id: <3c7d4e0a42d650f808882f8b425284809b077220.1687188729.git.graham@HIDDEN> X-Mailer: git-send-email 2.40.1 In-Reply-To: <cover.1687188729.git.graham@HIDDEN> References: <cover.1687188729.git.graham@HIDDEN> MIME-Version: 1.0 X-Debbugs-Cc: Christopher Baines <mail@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=grahamjamesaddis@HIDDEN; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Graham James Addis <graham@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) * guix/scripts/pack.scm: add support for parameters in entry-point (docker-entry-point-spec-option-parser): add function to parse --docker-entry-point (docker-image): Add function (form_entry_point) to handle --entry-point vs --docker-entry-point precedence (docker-image): change call to (build-docker-image) to use (form-entry-point) (%default-options): add dafault for --docker-entry-point option (%docker-format-options): parser for --docker-entry-point (show-docker-format-options): help for --docker-format-options (show-docker-format-options/detailed): detailed help for --docker-format-options (%options): add flag for --help-docker-format and add parser for --docker-format-options (extra-options): add extra options for docker (guix.texi): add documentation --- doc/guix.texi | 16 +++++- guix/scripts/pack.scm | 113 ++++++++++++++++++++++++++++++++---------- 2 files changed, 103 insertions(+), 26 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index c961f706ec..8d8044f73c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -116,6 +116,7 @@ Copyright @copyright{} 2023 Karl Hallsby@* Copyright @copyright{} 2023 Nathaniel Nicandro@* Copyright @copyright{} 2023 Tanguy Le Carrour@* +Copyright @copyright{} 2023 Graham James Addis@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -7346,7 +7347,7 @@ Invoking guix pack @env{GUIX_EXECUTION_ENGINE} environment variable accordingly. @end quotation -@cindex entry point, for Docker images +@cindex entry point, for Docker and Singularity images @item --entry-point=@var{command} Use @var{command} as the @dfn{entry point} of the resulting pack, if the pack format supports it---currently @code{docker} and @code{squashfs} (Singularity) @@ -7369,6 +7370,19 @@ Invoking guix pack docker run @var{image-id} @end example +@cindex entry point, for Docker images +@item --docker-entry-point=@var{command} +Use @var{command} as the @dfn{entry point} of the resulting pack. This option +overrides any value passed to @code{--entry-point} and can appear multiple +times on the command line. The first instance of @var{command} is used as th +@dfn{entry point} and subsequent values are used as the parameters. +@var{command} must be relative to the profile contained in the +pack. + +@example +guix pack -f docker --docker-entry-point=bin/guile --docker-entry-point="--help" guile +@end example + @item --expression=@var{expr} @itemx -e @var{expr} Consider the package @var{expr} evaluates to. diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 0dc9979194..79739cb465 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@HIDDEN> ;;; Copyright © 2020 Eric Bavier <bavier@HIDDEN> ;;; Copyright © 2022 Alex Griffin <a@HIDDEN> +;;; Copyright © 2023 Graham James Addis <graham@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -193,6 +194,16 @@ (define (symlink-spec-option-parser opt name arg result) (leave (G_ "~a: invalid symlink specification~%") arg)))) +(define (docker-entry-point-spec-option-parser opt name arg result) + "A SRFI-37 opion parser for the --docker-entry-point option. The spec +takes multiple occurances. The entries are used in the exec form for the +docker entry-point. The first is used as the command and subsequent values +are used as parameters." + (let ((docker-entry-point (assoc-ref result 'docker-entry-point))) + (alist-cons 'docker-entry-point + (append docker-entry-point (list arg)) + (alist-delete 'docker-entry-point result eq?)))) + (define (set-utf8-locale profile) "Configure the environment to use the \"en_US.utf8\" locale provided by the GLIBC-UT8-LOCALES package." @@ -626,6 +637,7 @@ (define* (docker-image name profile (guix build utils) (guix profiles) (guix search-paths) (srfi srfi-1) (srfi srfi-19) + (ice-9 optargs) (ice-9 match)) #$(procedure-source manifest->friendly-name) @@ -653,31 +665,50 @@ (define* (docker-image name profile `((directory "/tmp" ,(getuid) ,(getgid) #o1777) ,@(append-map symlink->directives '#$symlinks))) - (setenv "PATH" #+(file-append archiver "/bin")) - - (build-docker-image #$output - (map store-info-item - (call-with-input-file "profile" - read-reference-graph)) - #$profile - #:repository (manifest->friendly-name - (profile-manifest #$profile)) - #:database #+database - #:system (or #$target %host-type) - #:environment environment - #:entry-point - #$(and entry-point - #~(list (string-append #$profile "/" - #$entry-point))) - #:extra-files directives - #:compressor #+(compressor-command compressor) - #:creation-time (make-time time-utc 0 1)))))) - - (gexp->derivation (string-append name ".tar" - (compressor-extension compressor)) - build - #:target target - #:references-graphs `(("profile" ,profile)))) + (define (form-entry-point + docker-entry-point + prefix entry-point) + ;; construct entry-point parameter for build-docker-image + ;; overriding the legacy use of --entry-point from the command + ;; line when the --docker-entry-point options are used + (cond + ;; if CLI --docker-entry-point values are available use them + ((and docker-entry-point (not (null? docker-entry-point)) + (cons + (string-append prefix "/" (car docker-entry-point)) + (cdr docker-entry-point)))) + ;; legacy behaviour uses --entry-point and prefixes with #$profile + (entry-point (list (string-append prefix "/" entry-point))) + ('()))) ;empty list returned if no conditions are met + + (let-keywords '#$extra-options #f ((docker-entry-point #f)) + + (setenv "PATH" #+(file-append archiver "/bin")) + + (build-docker-image #$output + (map store-info-item + (call-with-input-file "profile" + read-reference-graph)) + #$profile + #:repository (manifest->friendly-name + (profile-manifest #$profile)) + #:database #+database + #:system (or #$target %host-type) + #:environment environment + #:entry-point (form-entry-point + docker-entry-point + #$profile + #$entry-point) + #:extra-files directives + #:compressor #+(compressor-command compressor) + #:creation-time (make-time time-utc 0 1)))))) + ) + + (gexp->derivation (string-append name ".tar" + (compressor-extension compressor)) + build + #:target target + #:references-graphs `(("profile" ,profile)))) ;;; @@ -1346,6 +1377,7 @@ (define %default-options (debug . 0) (verbosity . 1) (symlinks . ()) + (docker-entry-point . ()) (compressor . ,(first %compressors)))) (define %formats @@ -1428,6 +1460,29 @@ (define (show-rpm-format-options/detailed) (newline) (exit 0)) + +(define %docker-format-options + (list (option '("docker-entry-point") #t #f + docker-entry-point-spec-option-parser))) + +(define (show-docker-format-options) + (display (G_ " + --help-docker-format + list options specific to the DOCKER format"))) + +(define (show-docker-format-options/detailed) + (display (G_ " + --docker-entry-point=COMMAND/PARAMETER + Value(s) to use for the Docker EntryPoint field. + Multiple instances are accepted. The first use is + supplied as the COMMAND in the Docker EntryPoint, + subsequent uses are supplied as PARAMETERs in the + Docker EntryPoint. + This overrides any COMMAND provided in the + --entry-point option.")) + (newline) + (exit 0)) + (define %options ;; Specifications of the command-line options. (cons* (option '(#\h "help") #f #f @@ -1508,8 +1563,13 @@ (define %options (lambda args (show-rpm-format-options/detailed))) + (option '("help-docker-format") #f #f + (lambda args + (show-docker-format-options/detailed))) + (append %deb-format-options %rpm-format-options + %docker-format-options %transformation-options %standard-build-options %standard-cross-build-options @@ -1528,6 +1588,7 @@ (define (show-help) (newline) (show-deb-format-options) (show-rpm-format-options) + (show-docker-format-options) (newline) (display (G_ " -f, --format=FORMAT build a pack in the given FORMAT")) @@ -1696,6 +1757,8 @@ (define-command (guix-pack . args) (process-file-arg opts 'preun-file) #:postun-file (process-file-arg opts 'postun-file))) + ('docker + (list #:docker-entry-point (assoc-ref opts 'docker-entry-point))) (_ '()))) (target (assoc-ref opts 'target)) (bootstrap? (assoc-ref opts 'bootstrap?)) -- 2.39.2
Graham James Addis <grahamjamesaddis@HIDDEN>
:mail@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN
.
Full text available.mail@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN
:bug#64173
; Package guix-patches
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.