gnu: ipxe: Use G-expression.

* gnu/packages/bootloaders.scm (ipxe)[arguments]: Convert to G-expression.
While at it, remove trailing #t's and label usage.
This commit is contained in:
Marius Bakke 2023-01-07 20:36:29 +01:00
parent 998c8db2a5
commit b435f631a6
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA

View file

@ -3,7 +3,7 @@
;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Leo Famulari <leo@famulari.name> ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016-2018, 2021-2022 Marius Bakke <marius@gnu.org> ;;; Copyright © 2016-2018, 2021-2023 Marius Bakke <marius@gnu.org>
;;; Copyright © 2016, 2017 Danny Milosavljevic <dannym@scratchpost.org> ;;; Copyright © 2016, 2017 Danny Milosavljevic <dannym@scratchpost.org>
;;; Copyright © 2016, 2017 David Craven <david@craven.ch> ;;; Copyright © 2016, 2017 David Craven <david@craven.ch>
;;; Copyright © 2017, 2018, 2020, 2021, 2022 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2017, 2018, 2020, 2021, 2022 Efraim Flashner <efraim@flashner.co.il>
@ -1522,13 +1522,14 @@ order to add a suitable bootloader menu entry.")
"1pkf1n1c0rdlzfls8fvjvi1sd9xjd9ijqlyz3wigr70ijcv6x8i9")))) "1pkf1n1c0rdlzfls8fvjvi1sd9xjd9ijqlyz3wigr70ijcv6x8i9"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:modules ((guix build utils) (list
#:modules `((guix build utils)
(guix build gnu-build-system) (guix build gnu-build-system)
(guix base32) (guix base32)
(ice-9 string-fun) (ice-9 string-fun)
(ice-9 regex) (ice-9 regex)
(rnrs bytevectors)) (rnrs bytevectors))
#:imported-modules ((guix base32) #:imported-modules `((guix base32)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
#:make-flags #:make-flags
;; XXX: 'BUILD_ID' is used to determine when another ROM in the ;; XXX: 'BUILD_ID' is used to determine when another ROM in the
@ -1536,7 +1537,7 @@ order to add a suitable bootloader menu entry.")
;; legacy BIOS option ROM area, which is extremely limited in size. ;; legacy BIOS option ROM area, which is extremely limited in size.
;; It is supposed to be collision-free across all ROMs, to do so we ;; It is supposed to be collision-free across all ROMs, to do so we
;; use the truncated output hash of the package. ;; use the truncated output hash of the package.
(let ((build-id #~(let ((build-id
(lambda (out) (lambda (out)
(let* ((nix-store (string-append (let* ((nix-store (string-append
(or (getenv "NIX_STORE") "/gnu/store") (or (getenv "NIX_STORE") "/gnu/store")
@ -1548,8 +1549,7 @@ order to add a suitable bootloader menu entry.")
(bv (nix-base32-string->bytevector hash))) (bv (nix-base32-string->bytevector hash)))
(format #f "0x~x" (format #f "0x~x"
(bytevector-u32-ref bv 0 (endianness big)))))) (bytevector-u32-ref bv 0 (endianness big))))))
(out (assoc-ref %outputs "out")) (syslinux #$(this-package-native-input "syslinux")))
(syslinux (assoc-ref %build-inputs "syslinux")))
(list "ECHO_E_BIN_ECHO=echo" (list "ECHO_E_BIN_ECHO=echo"
"ECHO_E_BIN_ECHO_E=echo -e" "ECHO_E_BIN_ECHO_E=echo -e"
@ -1561,20 +1561,20 @@ order to add a suitable bootloader menu entry.")
"/share/syslinux/isohdpfx.bin") "/share/syslinux/isohdpfx.bin")
;; Build reproducibly. ;; Build reproducibly.
(string-append "BUILD_ID_CMD=echo -n " (build-id out)) (string-append "BUILD_ID_CMD=echo -n " (build-id #$output))
(string-append "BUILD_TIMESTAMP=" ,timestamp) (string-append "BUILD_TIMESTAMP=" #$timestamp)
"everything")) "everything"))
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'enter-source-directory (add-after 'unpack 'enter-source-directory
(lambda _ (chdir "src") #t)) (lambda _ (chdir "src")))
(add-after 'enter-source-directory 'set-version (add-after 'enter-source-directory 'set-version
(lambda _ (lambda _
;; When not building from a git checkout, iPXE encodes the ;; When not building from a git checkout, iPXE encodes the
;; version as "1.0.0+". Use the package version instead. ;; version as "1.0.0+". Use the package version instead.
(substitute* "Makefile" (substitute* "Makefile"
(("^VERSION[[:blank:]]+=.*") (("^VERSION[[:blank:]]+=.*")
(string-append "VERSION = " ,(package-version this-package) (string-append "VERSION = " #$(package-version this-package)
"-guix\n"))))) "-guix\n")))))
(add-after 'enter-source-directory 'set-options (add-after 'enter-source-directory 'set-options
(lambda _ (lambda _
@ -1585,13 +1585,11 @@ order to add a suitable bootloader menu entry.")
(("^#undef.*(DOWNLOAD_PROTO_HTTPS.*)" _ option) (("^#undef.*(DOWNLOAD_PROTO_HTTPS.*)" _ option)
(string-append "#define " option)) (string-append "#define " option))
(("^#undef.*(DOWNLOAD_PROTO_NFS.*)" _ option) (("^#undef.*(DOWNLOAD_PROTO_NFS.*)" _ option)
(string-append "#define " option))) (string-append "#define " option)))))
#t))
(delete 'configure) ; no configure script (delete 'configure) ; no configure script
(replace 'install (replace 'install
(lambda* (#:key outputs #:allow-other-keys) (lambda _
(let* ((out (assoc-ref outputs "out")) (let* ((ipxe (string-append #$output "/lib/ipxe"))
(ipxe (string-append out "/lib/ipxe"))
(exts-re (exts-re
"\\.(efi|efirom|iso|kkpxe|kpxe|lkrn|mrom|pxe|rom|usb)$") "\\.(efi|efirom|iso|kkpxe|kpxe|lkrn|mrom|pxe|rom|usb)$")
(dirs '("bin" "bin-i386-linux" "bin-x86_64-pcbios" (dirs '("bin" "bin-i386-linux" "bin-x86_64-pcbios"
@ -1608,10 +1606,9 @@ order to add a suitable bootloader menu entry.")
(string-drop subdir 4))))) (string-drop subdir 4)))))
(install-file file (install-file file
(string-append ipxe "/" tgtsubdir)))) (string-append ipxe "/" tgtsubdir))))
files)) files))))
#t))
(add-after 'install 'leave-source-directory (add-after 'install 'leave-source-directory
(lambda _ (chdir "..") #t))) (lambda _ (chdir ".."))))
#:tests? #f)) ; no test suite #:tests? #f)) ; no test suite
(native-inputs (native-inputs
(list perl syslinux xorriso)) (list perl syslinux xorriso))