diff mbox series

[bug#70123,12/12] gnu: fiano: Update to 1.2.0.

Message ID 900f5467d3196f4baed9c7938904748e4ececf95.1711915492.git.sharlatanus@gmail.com
State New
Headers show
Series fiano: Update to 1.2.0. | expand

Commit Message

Sharlatan Hellseher April 1, 2024, 10:43 a.m. UTC
The version style has been changed from v7.0.2 starting v1.0.3. This
change may cause guix refresh to detect incorrect latest version, see
<https://github.com/linuxboot/fiano/tags>.

This changes consolidate building all commands directly from the fiano
package.

* gnu/packages/admin.scm (fiano): Make variable public, update to 1.2.0.
[source]: Remove snippet, there is no longer 'vendor' directory in a
new release.
[arguments] <#:phases>: Add custom 'build, 'check and 'install phases to
cover complex package structure and produce all provided commands.
[inputs]: Add go-github-com-dustin-go-humanize,
go-github-com-hashicorp-errwrap, go-github-com-hashicorp-go-multierror,
go-github-com-jessevdk-go-flags, go-github-com-pierrec-lz4, and
go-github-com-spf13-pflag.
[description]: Highlight which commands are included in the package.

* gnu/packages/admin.scm (fiano-utk, fiano-fmap): Delete variables.

Change-Id: I4b7573e20953ba52c9736e7f64c6b6347221fc72
---
 gnu/packages/admin.scm | 126 +++++++++++++++++++++++++++++++----------
 1 file changed, 97 insertions(+), 29 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 78e5e355d6..e5a4895dc9 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -135,6 +135,7 @@  (define-module (gnu packages admin)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages golang-build)
   #:use-module (gnu packages golang-compression)
+  #:use-module (gnu packages golang-xyz)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
@@ -5161,10 +5162,12 @@  (define-public atop
     (license license:gpl2+)))
 
 ;; TODO: Pack u-root for: forth, and some tests.
-(define fiano
-  (package
-    (name "fiano")
-    (version "5.0.0")
+(define-public fiano
+   (package
+     (name "fiano")
+    ;; The versioning count has been changed since commit <2021-12-01>
+    ;; 1eb599564549691603589219c2be34f966a32ff1.
+    (version "1.2.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -5173,41 +5176,106 @@  (define fiano
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "03ihdwwhb7g6bihx141cn0924sjs5ps6q3ps58pk1cg0g0srrr9h"))
-              (modules '((guix build utils)))
-              (snippet
-               #~(begin
-                   ;; Remove all vendored sources.
-                   (delete-file-recursively "vendor")))))
+                "0s5fx4lhgb68qbx4ql34rcm678qdf0c4xl97bgc8dx9xwwqifza1"))))
     (build-system go-build-system)
     (arguments
      (list
+      #:install-source? #f
       #:import-path "github.com/linuxboot/fiano"
-      #:unpack-path "github.com/linuxboot/fiano"))
+      #:unpack-path "github.com/linuxboot/fiano"
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; XXX: Replace this part when it's implemented in go-build-system.
+          (replace 'build
+            (lambda* (#:key import-path #:allow-other-keys)
+              (for-each
+               (lambda (cmd)
+                 (invoke "go" "build" "-v" "-x" "-ldflags=-s -w" "-trimpath"
+                         (string-append import-path "/cmds/" cmd)))
+               (list "cbfs"
+                     "create-ffs"
+                     ;; TODO: Not packed yet in guix, long jorney:
+                     ;; - github.com/tjfoc/gmsm
+                     ;;
+                     ;; "fittool"
+                     "fmap"
+                     "fspinfo"
+                     "glzma"
+                     "guid2english"
+                     "microcode"
+                     "utk"))))
+          (replace 'check
+            (lambda* (#:key import-path tests? #:allow-other-keys)
+              (when tests?
+                (for-each
+                 (lambda (dir)
+                   (invoke "go" "test" "-v"
+                           (string-append import-path dir "/...")))
+                 (list "/pkg/bytes"
+                       ;; TODO: Not packed yet in Guix, long jorney:
+                       ;; - github.com/jedib0t
+                       ;;
+                       ;; "/pkg/amd"
+                       "/pkg/cbfs"
+                       "/pkg/compression"
+                       "/pkg/fmap"
+                       "/pkg/fsp"
+                       "/pkg/guid"
+                       "/pkg/guid2english"
+                       ;; TODO: Not packed yet in Guix, long jorney:
+                       ;; - github.com/tjfoc/gmsm
+                       ;;
+                       ;; "/pkg/intel"
+                       "/pkg/knownguids"
+                       "/pkg/log"
+                       "/pkg/uefi"
+                       "/pkg/unicode"
+                       "/pkg/utk"
+                       "/pkg/visitors"
+                       "/cmds/cbfs"
+                       "/cmds/create-ffs"
+                       ;; TODO: Not packed yet in Guix, long jorney:
+                       ;; - github.com/u-root/u-root
+                       ;;
+                       ;; "/cmds/fmap"
+                       ;; "/cmds/fittool"
+                       "/cmds/fspinfo"
+                       "/cmds/glzma"
+                       "/cmds/guid2english"
+                       "/cmds/microcode"
+                       "/cmds/utk")))))
+          (replace 'install
+            (lambda _
+              (let ((bindir (string-append #$output "/bin")))
+                (for-each
+                 (lambda (cmd)
+                   (install-file cmd bindir))
+                 (list "cbfs"
+                       "create-ffs"
+                       ;; "fittool"
+                       "fmap"
+                       "fspinfo"
+                       "glzma"
+                       "guid2english"
+                       "microcode"
+                       "utk"))))))))
     (inputs
-     (list go-golang-org-x-text go-github-com-ulikunitz-xz))
+     (list go-github-com-dustin-go-humanize
+           go-github-com-hashicorp-errwrap
+           go-github-com-hashicorp-go-multierror
+           go-github-com-jessevdk-go-flags
+           go-github-com-pierrec-lz4
+           go-github-com-spf13-pflag
+           go-github-com-ulikunitz-xz
+           go-golang-org-x-text))
     (home-page "https://github.com/linuxboot/fiano")
     (synopsis "UEFI image editor")
     (description
-     "This package provides a command-line UEFI image editor.")
+     "This package provides a command-line UEFI image editor, including cbfs,
+create-ffs, fmap, fspinfo, glzma, guid2english, microcode and utk CLI
+utilities.")
     (license license:bsd-3)))
 
-(define-public fiano-utk
-  (package
-    (inherit fiano)
-    (name "fiano-utk")
-    (arguments
-     `(#:import-path "github.com/linuxboot/fiano/cmds/utk"
-       #:unpack-path "github.com/linuxboot/fiano"))))
-
-(define-public fiano-fmap
-  (package
-    (inherit fiano)
-    (name "fiano-fmap")
-    (arguments
-     `(#:import-path "github.com/linuxboot/fiano/cmds/fmap"
-       #:unpack-path "github.com/linuxboot/fiano"))))
-
 (define-public novena-eeprom
   (package
     (name "novena-eeprom")