From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id sFj/Grfr3WSwWQAASxT56A (envelope-from ) for ; Thu, 17 Aug 2023 11:43:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SEM2G7fr3WSxDAAA9RJhRA (envelope-from ) for ; Thu, 17 Aug 2023 11:43:19 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B9E504170F for ; Thu, 17 Aug 2023 11:43:18 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=CFSSTTgf; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692265399; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=9PFGrYCpoXycpLt0tHRB0LM8Phjn29++3lGHcvslrJc=; b=VdusQUt4EvLttAQiKnRwFNb15TWe2OPrXG9+Yjarn6gflJo/qokgYduqXc1JyG65P9B3hu gulJl0hKZNUxNG4hd8FjgSVf0fxGMRk7hV4utY4G9eIEN2+/pHWYFd7bi+VQyDpG4U+9Dz KTJ57dt0dVhtyDQqw0P+DpnYLaP6WCVrTTDJeFrA1rJLEMJmSq/bQOq/VN6WVeRgh5OUZO 4XsQk7AlBYM1HY9qHg41x3oyJO3py20kCS4Nfv8zgH/tBLW67D6qgvluzE14v1yvw33KzU npT7UWd0Q29PyUKbYOGVyoApyICDPttPdboQaeV6eVLrqiQ9DoMwc6jpsex+nQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=CFSSTTgf; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692265399; a=rsa-sha256; cv=none; b=o1hGi3+aUnb6CO4Dhyhpm9Yf1+2xLbjaFBhN0pwxrQKJ9drfSUtH5bSnm0xnLk+auZNKro VtY48A42vyZPJrE7hhC8KBlBRFuyUj36V1IcqW3cV3b/fXGqKs4mkcaYAwlDBlgn5XTPz6 8xjw10DZBBHE0M70oFZb7Xl/lWTJwhXG8s2tvuD4jolqDbV5pdzoyYBk4KSEYWbyVsle+G 7Eg13GjpiiMOgLZWEtSZ9rQuLZix5Ptwwy2yd+GX1zPNCncjRVP1PaM1kKmvbJVBxnKKjB Jg45+yUstzmb4cG5CEE2pWmHJjSs5awnOEVIm7lotzi3/xmFzt6pYAjFkeBaNg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWZX5-0001e1-PS; Thu, 17 Aug 2023 05:43:12 -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 ) id 1qWZWw-0001bx-QX for guix-patches@gnu.org; Thu, 17 Aug 2023 05:43:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWZWw-0005mj-GA for guix-patches@gnu.org; Thu, 17 Aug 2023 05:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qWZWw-0000I9-2k for guix-patches@gnu.org; Thu, 17 Aug 2023 05:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64173] [PATCH 0/1] guix: pack: add --entry-point-argument option Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 17 Aug 2023 09:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64173 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Graham James Addis Cc: Graham James Addis , Josselin Poiret , Tobias Geerinckx-Rice , 64173@debbugs.gnu.org, Simon Tournier , Mathieu Othacehe , Christopher Baines , 64171@debbugs.gnu.org, Ricardo Wurmus Received: via spool by 64173-submit@debbugs.gnu.org id=B64173.16922653511070 (code B ref 64173); Thu, 17 Aug 2023 09:43:02 +0000 Received: (at 64173) by debbugs.gnu.org; 17 Aug 2023 09:42:31 +0000 Received: from localhost ([127.0.0.1]:42777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWZWQ-0000HB-Gl for submit@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 ) 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 ) 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <53f0c51cabbd317469721fb7f47b47af50d42177.1689149161.git.graham@addis.org.uk> Date: Thu, 17 Aug 2023 11:42:17 +0200 In-Reply-To: <53f0c51cabbd317469721fb7f47b47af50d42177.1689149161.git.graham@addis.org.uk> (Graham James Addis's message of "Wed, 12 Jul 2023 09:17:13 +0100") Message-ID: <87wmxuxax2.fsf_-_@gnu.org> 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -3.21 X-Spam-Score: -3.21 X-Migadu-Queue-Id: B9E504170F X-Migadu-Scanner: mx1.migadu.com X-TUID: UpdedXPG3Ado Hi Graham, Apologies for the delay (holiday time!). Graham James Addis 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.