Message ID | 20230203221409.15886-2-maxim.cournoyer@gmail.com |
---|---|
State | New |
Headers | show |
Series | Add support for the RPM format to "guix pack" | expand |
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis: > Rationale: the upcoming rpm-archive builder will also use it. > > * guix/scripts/pack.scm: > (keyword-ref): New top-level procedure, extracted from... > (debian-archive): ... here. Adjust usages accordingly. Commit aeded14b8342c1e72afd014a1bc121770f8c3a1c added #:extra-options, which is why we need ‘keyword-ref’ now. I’m thinking a different option would be to use #:allow-other-keys in all the image build procedures. That way the deb and rpm build procedures would get their extra arguments, which would be automatically bound without requiring manual ‘keyword-ref’ calls. Sounds a bit nicer maybe? If we skip to the current approach, we should consider using ‘let-keywords’ from (ice-9 optargs) instead of adding ‘keyword-ref’. Anyway, not a blocker IMO, but something to keep in mind. Ludo’.
Hi Ludovic, Ludovic Courtès <ludo@gnu.org> writes: > Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis: > >> Rationale: the upcoming rpm-archive builder will also use it. >> >> * guix/scripts/pack.scm: >> (keyword-ref): New top-level procedure, extracted from... >> (debian-archive): ... here. Adjust usages accordingly. > > Commit aeded14b8342c1e72afd014a1bc121770f8c3a1c added #:extra-options, > which is why we need ‘keyword-ref’ now. > > I’m thinking a different option would be to use #:allow-other-keys in > all the image build procedures. That way the deb and rpm build > procedures would get their extra arguments, which would be automatically > bound without requiring manual ‘keyword-ref’ calls. Sounds a bit nicer > maybe? I'm not sure; it sounds convenient, but at the same time, it makes the "contract" of the pack builders even fuzzier that it currently is. > If we skip to the current approach, we should consider using > ‘let-keywords’ from (ice-9 optargs) instead of adding ‘keyword-ref’. > > Anyway, not a blocker IMO, but something to keep in mind. OK! I'll try adapting to use (ice-9 optargs) for the next revision.
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index f65642fb85..7e466a2be7 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -194,6 +194,12 @@ (define (symlink-spec-option-parser opt name arg result) (leave (G_ "~a: invalid symlink specification~%") arg)))) +(define (keyword-ref lst keyword) + "Return the value of KEYWORD in LST, else #f." + (match (memq keyword lst) + ((_ value . _) value) + (#f #f))) + ;;; ;;; Tarball format. @@ -762,20 +768,15 @@ (define data-tarball-file-name (strip-store-file-name (copy-file #+data-tarball data-tarball-file-name) - (define (keyword-ref lst keyword) - (match (memq keyword lst) - ((_ value . _) value) - (#f #f))) - ;; Generate the control archive. (define control-file - (keyword-ref '#$extra-options #:control-file)) + #$(keyword-ref `(,@extra-options) #:control-file)) (define postinst-file - (keyword-ref '#$extra-options #:postinst-file)) + #$(keyword-ref `(,@extra-options) #:postinst-file)) (define triggers-file - (keyword-ref '#$extra-options #:triggers-file)) + #$(keyword-ref `(,@extra-options) #:triggers-file)) (define control-tarball-file-name (string-append "control.tar"