gnu: gash-utils-boot: Use a gexp.

* gnu/packages/commencement.scm (gash-utils-boot)[arguments]: Use #:modules
instead of a non-top-level ‘use-modules’.  Turn #:phases into a gexp.
Use ‘search-input-file’ in ‘make-echo’ phase.
[inputs, native-inputs]: Remove labels.

Change-Id: Ib0eaa8a9ba4272b423fdb34a0eaf56b3a93ac7d4
This commit is contained in:
Ludovic Courtès 2025-03-23 01:29:24 +01:00 committed by Andreas Enge
parent cf46fefb0b
commit 1dff4c2e1f
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3

View file

@ -235,88 +235,108 @@ pure Scheme to Tar and decompression in one easy step.")
(inherit gash-utils) (inherit gash-utils)
(name "gash-utils-boot") (name "gash-utils-boot")
(arguments (arguments
`(#:implicit-inputs? #f (list #:implicit-inputs? #f
#:tests? #f #:tests? #f
#:guile ,%bootstrap-guile #:guile %bootstrap-guile
#:imported-modules ((guix build gnu-bootstrap) #:imported-modules `((guix build gnu-bootstrap)
,@%default-gnu-imported-modules) ,@%default-gnu-imported-modules)
#:phases #:modules `((guix build gnu-bootstrap)
(begin ,@%default-gnu-modules)
(use-modules (guix build gnu-bootstrap)) #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'set-load-path (add-after 'unpack 'set-load-path
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let ((gash (assoc-ref inputs "gash"))) (let ((gash (assoc-ref inputs "gash")))
(add-to-load-path (string-append gash "/share/guile/site/" (add-to-load-path (string-append gash
(effective-version)))))) "/share/guile/site/"
(add-before 'configure 'pre-configure (effective-version))))))
(lambda _ (add-before 'configure 'pre-configure
(format #t "Creating gash/commands/testb.scm~%") (lambda _
(copy-file "gash/commands/test.scm" (format #t "Creating gash/commands/testb.scm~%")
"gash/commands/testb.scm") (copy-file "gash/commands/test.scm"
(substitute* "gash/commands/testb.scm" "gash/commands/testb.scm")
(("gash commands test") "gash commands testb") (substitute* "gash/commands/testb.scm"
(("apply test [(]cdr") "apply test/bracket (cdr")) (("gash commands test")
(for-each (lambda (script) "gash commands testb")
(let ((target (string-append "scripts/" (("apply test [(]cdr")
script ".in"))) "apply test/bracket (cdr"))
(format #t "Creating scripts/~a~%" target) (for-each (lambda (script)
(copy-file "scripts/template.in" target) (let ((target (string-append
(substitute* target "scripts/" script ".in")))
(("@UTILITY@") script)))) (format #t "Creating scripts/~a~%"
'("awk" "basename" "cat" "chmod" "cmp" "command" target)
"compress" "cp" "cut" "diff" "dirname" "env" (copy-file "scripts/template.in"
"expr" "false" "find" "grep" "head" "ln" "ls" target)
"mkdir" "mv" "printf" "pwd" "reboot" "rm" "rmdir" (substitute* target
"sed" "sleep" "sort" "tar" "test" "touch" "tr" (("@UTILITY@") script))))
"true" "uname" "uniq" "wc" "which")) '("awk" "basename" "cat" "chmod" "cmp" "command"
(format #t "Creating scripts/[.in~%") "compress" "cp" "cut" "diff" "dirname" "env"
(copy-file "scripts/template.in" "scripts/[.in") "expr" "false" "find" "grep" "head" "ln" "ls"
(substitute* "scripts/[.in" "mkdir" "mv" "printf" "pwd" "reboot" "rm" "rmdir"
(("@UTILITY@") "testb")) "sed" "sleep" "sort" "tar" "test" "touch" "tr"
(delete-file "scripts/template.in"))) "true" "uname" "uniq" "wc" "which"))
(replace 'configure (format #t "Creating scripts/[.in~%")
(bootstrap-configure "Gash-Utils" ,(package-version gash-utils) (copy-file "scripts/template.in" "scripts/[.in")
'("gash" "gash-utils") "scripts")) (substitute* "scripts/[.in"
(replace 'build (bootstrap-build '("gash" "gash-utils"))) (("@UTILITY@")
(replace 'install "testb"))
(bootstrap-install '("gash" "gash-utils") "scripts")) (delete-file "scripts/template.in")))
;; XXX: The scripts should add Gash to their load paths and (replace 'configure
;; this phase should not exist. (bootstrap-configure "Gash-Utils"
(add-after 'install 'copy-gash #$(package-version gash-utils)
(lambda* (#:key inputs outputs #:allow-other-keys) '("gash" "gash-utils")
(let* ((out (assoc-ref outputs "out")) "scripts"))
(moddir (string-append out "/share/guile/site/" (replace 'build
(effective-version))) (bootstrap-build '("gash" "gash-utils")))
(godir (string-append out "/lib/guile/" (replace 'install
(effective-version) (bootstrap-install '("gash" "gash-utils") "scripts"))
"/site-ccache")) ;; XXX: The scripts should add Gash to their load paths and
(gash (assoc-ref inputs "gash")) ;; this phase should not exist.
(gash-moddir (string-append gash "/share/guile/site/" (add-after 'install 'copy-gash
(effective-version))) (lambda* (#:key inputs outputs #:allow-other-keys)
(gash-godir (string-append gash "/lib/guile/" (let* ((out (assoc-ref outputs "out"))
(effective-version) (moddir (string-append out
"/site-ccache"))) "/share/guile/site/"
(copy-file (string-append gash-moddir "/gash/compat.scm") (effective-version)))
(string-append moddir "/gash/compat.scm")) (godir (string-append out "/lib/guile/"
(copy-recursively (string-append gash-moddir "/gash/compat") (effective-version)
(string-append moddir "/gash/compat")) "/site-ccache"))
(copy-file (string-append gash-godir "/gash/compat.go") (gash (assoc-ref inputs "gash"))
(string-append godir "/gash/compat.go")) (gash-moddir (string-append gash
(copy-recursively (string-append gash-godir "/gash/compat") "/share/guile/site/"
(string-append godir "/gash/compat"))))) (effective-version)))
;; We need an external echo. (gash-godir (string-append gash
(add-after 'install 'make-echo "/lib/guile/"
(lambda* (#:key inputs outputs #:allow-other-keys) (effective-version)
(let* ((out (assoc-ref outputs "out")) "/site-ccache")))
(gash (assoc-ref inputs "gash"))) (copy-file (string-append gash-moddir
(with-output-to-file (string-append out "/bin/echo") "/gash/compat.scm")
(lambda () (string-append moddir
(display (string-append "#!" gash "/bin/gash\n")) "/gash/compat.scm"))
(newline) (copy-recursively (string-append gash-moddir
(display "echo \"$@\"") "/gash/compat")
(newline))) (string-append moddir
(chmod (string-append out "/bin/echo") #o755)))))))) "/gash/compat"))
(copy-file (string-append gash-godir
"/gash/compat.go")
(string-append godir
"/gash/compat.go"))
(copy-recursively (string-append gash-godir
"/gash/compat")
(string-append godir
"/gash/compat")))))
;; We need an external echo.
(add-after 'install 'make-echo
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(gash (search-input-file inputs "/bin/gash")))
(with-output-to-file (string-append out "/bin/echo")
(lambda ()
(display (string-append "#!" gash "\n"))
(newline)
(display "echo \"$@\"")
(newline)))
(chmod (string-append out "/bin/echo") #o755)))))))
(inputs `(("gash" ,gash-boot) (inputs `(("gash" ,gash-boot)
("guile" ,%bootstrap-guile))) ("guile" ,%bootstrap-guile)))
(native-inputs `(("bootar" ,bootar))))) (native-inputs `(("bootar" ,bootar)))))