[PATCH 0/1] guix: pack: add --entry-point-argument option

  • Open
  • quality assurance status badge
Details
4 participants
  • Oleg Pykhalov
  • Graham James Addis
  • Ludovic Courtès
  • Simon Tournier
Owner
unassigned
Submitted by
Graham James Addis
Severity
normal
Merged with
G
G
Graham James Addis wrote on 19 Jun 2023 17:38
[PATCH 1/1] guix: pack: docker add docker-entry-point options
(address . guix-patches@gnu.org)(name . Graham James Addis)(address . graham@addis.org.uk)
3c7d4e0a42d650f808882f8b425284809b077220.1687188729.git.graham@addis.org.uk
* 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(-)

Toggle diff (225 lines)
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@gmail.com>
;;; Copyright © 2020 Eric Bavier <bavier@posteo.net>
;;; Copyright © 2022 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2023 Graham James Addis <graham@addis.org.uk>
;;;
;;; 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
L
L
Ludovic Courtès wrote on 3 Jul 2023 11:12
control message for bug #64171
(address . control@debbugs.gnu.org)
87wmzhqry3.fsf@gnu.org
merge 64171 64173
quit
G
G
Graham Addis wrote on 11 Jul 2023 10:54
(address . control@debbugs.gnu.org)
CAA4DTewP3o6kpc+1aM=yB_0TjunNoMNFVDX0fwCuR40iF31saA@mail.gmail.com
retitle 64171 [PATCH 0/1] guix: pack: add --entry-point-argument option
Attachment: file
L
L
Ludovic Courtès wrote on 17 Aug 2023 11:42
(name . Graham James Addis)(address . grahamjamesaddis@gmail.com)
87wmxuxax2.fsf_-_@gnu.org
Hi Graham,

Apologies for the delay (holiday time!).

Graham James Addis <grahamjamesaddis@gmail.com> skribis:

Toggle quote (12 lines)
> * 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-point)
> (%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’t 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.

Toggle quote (2 lines)
> (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:

Toggle quote (4 lines)
> +@cindex entry point arguments, for docker images
> +@item --entry-point-argument=@var{command}
> +@itemx -A @var{command}

Maybe @var{argument} for consistency and clarity?

Toggle quote (4 lines)
> +Use @var{command} as an argument to @dfn{entry point} of the resulting pack.
> +This option is only valid in conjunction with @code{--entry-point} and can
> +appear multiple times on the command line.

Maybe add: “The example below shows illustrates that, passing
@option{--help} to the @command{guile} command:”

Toggle quote (4 lines)
> +@example
> +guix pack -f docker --entry-point=bin/guile --entry-point-argument="--help" guile
> +@end example

[...]

Toggle quote (10 lines)
> +(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 form."
> + (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’d 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 ‘guix repl’ does, for
instance.

Toggle quote (14 lines)
> + (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-point
> + ;; with the supplied index subsequent entries are taken from
> + ;; the --entry-point-argument options
> + (cond
> + (entry-point
> + (cons*
> + (string-append prefix "/" entry-point)
> + entry-point-argument)
> + )

I’d avoid this extra procedure.

Toggle quote (23 lines)
> + ('()))) ;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 #$profile))
> + #: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)
'())))


?

Toggle quote (6 lines)
> @@ -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
‘entry-point-argument’ pair per argument.

Toggle quote (38 lines)
> +(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=COMMAND/PARAMETER
> + Value(s) to use for the Docker EntryPoint arguments.
> + Multiple instances are accepted. This is only valid
> + 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)))
>
> + (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.

Toggle quote (7 lines)
> @@ -1696,6 +1751,8 @@ (define-command (guix-pack . args)
> (process-file-arg opts 'preun-file)
> #:postun-file
> (process-file-arg opts 'postun-file)))
> + ('docker
> + (list #:entry-point-argument (assoc-ref opts 'entry-point-argument)))

This would become #:entry-point-arguments (plural), with the
‘filter-map’ 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’.
S
S
Simon Tournier wrote on 17 Aug 2023 13:48
Re: [bug#64173] [PATCH 0/1] guix: pack: add --entry-point-argument option
87sf8h51pq.fsf@gmail.com
Hi,

On Thu, 17 Aug 2023 at 11:42, Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (25 lines)
>> +(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 form."
>> + (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’d 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 ‘guix repl’ does, for
> instance.

[...]

Toggle quote (3 lines)
> This can be omitted if you take the approach suggested above, with one
> ‘entry-point-argument’ pair per argument.

[...]

Toggle quote (3 lines)
> This would become #:entry-point-arguments (plural), with the
> ‘filter-map’ 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 ’reverse’ is suggested, and since all the Guix
command-lines do not behave the same way – for instance “guix package”
processes command-line argument from right to left; see #43585 or #50473
[1,2]; anyway :-) – I would suggest to add a sentence in the
documentation (manual) that the command-line arguments are parsed from
left to right.




Cheers,
simon
L
L
Ludovic Courtès wrote on 18 Aug 2023 16:00
(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
87zg2oqwkv.fsf@gnu.org
Hi,

Simon Tournier <zimon.toutoune@gmail.com> skribis:

Toggle quote (3 lines)
> Just to be sure to understand, the command-line could list several
> --entry-point-argument options, right?

Yes.

Toggle quote (8 lines)
> Well, since the order of the various command-line arguments might
> matter, and since a ’reverse’ is suggested, and since all the Guix
> command-lines do not behave the same way – for instance “guix package”
> processes command-line argument from right to left; see #43585 or #50473
> [1,2]; anyway :-) – I would suggest to add a sentence in the
> documentation (manual) that the command-line arguments are parsed from
> left to right.

No: the ‘reverse’ puts them back in the right order (because
‘args-fold*’ traverses the option list from left to right and thus
conses the result in reverse order.)

HTH!

Ludo’.
S
S
Simon Tournier wrote on 18 Aug 2023 16:15
(name . Ludovic Courtès)(address . ludo@gnu.org)
CAJ3okZ1LbkaSydP_m=712D4LTLDwRUBbowp7tQ24LKjp6jWBkg@mail.gmail.com
Hi,

On Fri, 18 Aug 2023 at 16:00, Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (12 lines)
> > Well, since the order of the various command-line arguments might
> > matter, and since a ’reverse’ is suggested, and since all the Guix
> > command-lines do not behave the same way – for instance “guix package”
> > processes command-line argument from right to left; see #43585 or #50473
> > [1,2]; anyway :-) – I would suggest to add a sentence in the
> > documentation (manual) that the command-line arguments are parsed from
> > left to right.
>
> No: the ‘reverse’ puts them back in the right order (because
> ‘args-fold*’ traverses the option list from left to right and thus
> conses the result in reverse order.)

Is "no" for not adding a sentence in the documentation? :-)

BTW, what means the "right order"? :-)
I point that "guix package" and "guix show" process the command-line
option in different order -- from right to left vs from left to right
respectively. Thus, this "right order" you are assuming can be
confusing, IMHO.

Therefore, applying POLA, it appears to me worth to add under the
option description of this new "--entry-point-argument" in the manual:
"The @code{--entry-point-arguement} option is applied from left to
right." Or something along this line.

My 2 cents.

Cheers,
simon
O
O
Oleg Pykhalov wrote on 27 Aug 2023 05:16
Merging guix pack changes for Docker containers packaging
(name . guix-devel)(address . guix-devel@gnu.org)
878r9xb2e6.fsf@gmail.com
Hi Guix,

I would like to merge 62153. After 64173 will be merge, merging 62153
is not possible without conflict resolving with Git.

64173 introduces ‘%docker-format-options’ variable. With this variable
it's possible in 62153 to replace ‘--image-type=docker-layered’ with
‘--docker-layers=N’ option, where:

if ‘N’ is zero, then use current non layered format
if ‘N’ is bigger than zero, then use layered format

Number of layers specification is nice to have, because Docker layers
are limited. So if user would like to modify a Docker image by adding
more layers on top, then hacks like squashing layers are not required.
Also, it will be possible to delete code which builds non layered Docker
image without deprecating command line options.

Is it possible to partially merge 64173, specifically
‘%docker-format-options’ variable and it requirements, so it can be used
in 62153 for ‘--docker-layers=N’ option?



Regards,
Oleg.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmTqwCEUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pwLNg//XqUbjKOGD1st7X1i7XAZKAwkPN/j
yOzVa1agcRi2bIwLqoh+/WWLf4afG0tE7b52VQKUbgSMdSfJi2RJoLs7PmTjhhhJ
/QKl35ffdDr4C6MgutK/nir/Dh2wYuZ4KtKdmj6VmXkC5uSd+GA4mNriwZGUf5IX
Oo2YqvEv9e9wkilRRX7BN/iVboKPlPWHxNT82x/gB2UTdgXxcICqUHa9L/h+4obl
7xrsBiGtIJMWmC0A6bZXscDrWTxlKdqAXZTkGRAh2XJ1EWdZeh6ED3s1n4lZySsE
gapcNf8112Th0+TRhSV3FP7OUc5LHK8nvosNCnr3WtLMEOG/TGeTx5POc6YwUVwA
oJQQu9Z9k8GCQKD58Uo4Bq7f8uhbq+iVfChESn0+ezNeJagir63CAD9eqegaQI1f
e2EVxEC3sjEe264ue4fW3L7zx5SkHTHehv8mVfDKAJJTmNgCXx1t+jjP51T1vmxg
n3wzP9hU4Ugg10r+whWC2BuH6k2B+wS/bJ1mkg/qSqHAB9/3wvhVikSSFFBmpI+s
FmRkjTDguLW9rfZQW8Q9EJtAqOF74FRt4JXkGZffOClTdLrYNuf958wN6r4uuW00
MTBRKy753fJrU7PlwvPi7SQEe6ziaCY7w+tvYOKSV8DPPShMZBhuYnrzRM4IvuDB
5Xgx6marsPHb7AA=
=VfnU
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 22 Dec 2023 23:11
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
875y0p99c4.fsf@gnu.org
Hi Oleg,

Apologies for not replying earlier. I occasionally get reminded of the
fact that building single-layer images is a problem, but only now did I
take the time to look more closely at the latest version of these
patches.

Oleg Pykhalov <go.wigust@gmail.com> skribis:

Toggle quote (10 lines)
> I would like to merge 62153. After 64173 will be merge, merging 62153
> is not possible without conflict resolving with Git.
>
> 64173 introduces ‘%docker-format-options’ variable. With this variable
> it's possible in 62153 to replace ‘--image-type=docker-layered’ with
> ‘--docker-layers=N’ option, where:
>
> if ‘N’ is zero, then use current non layered format
> if ‘N’ is bigger than zero, then use layered format

OK we should do that. However, the original submitter of #64173
apparently dropped the ball as we were approaching the final version.

Would you like to adopt it and submit/push a version that incorporates
the latest comments?

Alternatively, we could do the opposite: merge the Docker layer patches
first, and then rebase the ‘%docker-format-options’ patch, after which
we could add the ‘--docker-layers’ option.

What’s your preference?

Toggle quote (6 lines)
> Number of layers specification is nice to have, because Docker layers
> are limited. So if user would like to modify a Docker image by adding
> more layers on top, then hacks like squashing layers are not required.
> Also, it will be possible to delete code which builds non layered Docker
> image without deprecating command line options.

Agreed.

Anyway, apart from the stylistic issues I reported, v4 of this patch set
looks great to me. (For clarity I’d have preferred three patches, one
for (guix docker), one for ‘guix pack’, and one for ‘guix system’; but
it’s really a detail, let’s not block this patch series any longer.)

Thanks,
Ludo’.
O
O
Oleg Pykhalov wrote on 26 Dec 2023 03:40
(name . Ludovic Courtès)(address . ludo@gnu.org)
87il4l4rez.fsf@gmail.com
Hi Ludovic,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (29 lines)
> Apologies for not replying earlier. I occasionally get reminded of the
> fact that building single-layer images is a problem, but only now did I
> take the time to look more closely at the latest version of these
> patches.
>
> Oleg Pykhalov <go.wigust@gmail.com> skribis:
>
>> I would like to merge 62153. After 64173 will be merge, merging 62153
>> is not possible without conflict resolving with Git.
>>
>> 64173 introduces ‘%docker-format-options’ variable. With this variable
>> it's possible in 62153 to replace ‘--image-type=docker-layered’ with
>> ‘--docker-layers=N’ option, where:
>>
>> if ‘N’ is zero, then use current non layered format
>> if ‘N’ is bigger than zero, then use layered format
>
> OK we should do that. However, the original submitter of #64173
> apparently dropped the ball as we were approaching the final version.
>
> Would you like to adopt it and submit/push a version that incorporates
> the latest comments?
>
> Alternatively, we could do the opposite: merge the Docker layer patches
> first, and then rebase the ‘%docker-format-options’ patch, after which
> we could add the ‘--docker-layers’ option.
>
> What’s your preference?

[…]

Patches 64173 and 62153 (v5) have been sent to 62153.

If you don't mind, I have changed the option naming to '--max-layers=N'
instead of '--docker-layers=N' to align with the format of
'--entry-point-argument' (without specifying Docker as the only image
format that utilizes layers).

I did not include code to check if 'N' is zero and use the current
non-layered format. Instead, I opted for the default value of '#false'
as it was easier to implement.


Regards,
Oleg.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmWKPTQUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pzYpBAAuIqdacRLFs0TgY6PKw6yiUARQSRb
AKT1b/9dryTHfxL9STKiHdgkSXzCK7SvfXX/SkQrACybakckunGf0BD8ZTCZ47i8
d3vLKOA8iRlewHStIVeuJUzzJgwb+CefTkkXX4WwEVrrfvdFbCqs6iDZPsGZzI90
KmYfRkbNwfwEGXV+efZMKZ982gs+56dCMbJk6rK9TYAXxx4zxQJdQ7zGHyG9J2I2
zAMK/YsfvmaVVzcgtDkiFn0FBZ1hrXtL2EipzEGs3VtUO0l1XdHmei4auTyaxpD5
xlMYEhSXrTlW0JxXzEEQigJMeoKECesj9CzO1C18ByVTnJNT5ABJAcwXKMO7JT7i
iJlrlO1vce+u2XdeAlIaNU0225Nn21NZWoAce2O424wrIUvmtp0w835R+Zgp9OTR
uan2o5XTYXTRp6F9IRdTiDORBF5C7T7vay+f7TVPBafJDMpz2it87FXp9FlICFPl
HqNW56R0780AOl0N+Qg6UOlr8rQ2wlmjeIRCeLiSuQBvKE/eJzaXL1i72b/koHn6
c47tZbWbjTJqJgoDXC7QnJiUlvhlLvbR7c9cH+QKgj4Oi7IejG96prSZXrDli12z
IVPERJM9UsPmFSNoqOlgaVChbda3i8gPJjzZro6TxFPlk7JorMlmsUURvMWYhi5z
HAhQvJxZLviRjEY=
=Dj7B
-----END PGP SIGNATURE-----

?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 64173@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 64173
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch