diff mbox series

bug#63793: [PATCH] gnu: sbsigntools: Update to 0.9.5.

Message ID 87bkhvef98.fsf@jpoiret.xyz
State New
Headers show
Series bug#63793: [PATCH] gnu: sbsigntools: Update to 0.9.5. | expand

Commit Message

Josselin Poiret June 4, 2023, 9:41 a.m. UTC
Hi,

kiasoc5 via Guix-patches via <guix-patches@gnu.org> writes:

> This fixes a build failure with openssl-3.
>
> * gnu/packages/efi.scm (sbsigntools): Update to 0.9.5.
> [arguments]: Remove trailing #t's. Use Gexps. Use "this-package-input". Simplify lambdas.
> [inputs]: Remove labels.

Thanks for your patch!  Pushed as
f72f3a909a41dce5dc4512c30d4cd0673bc6560f with the following best
practices modifications (importantly, note cc-for-target and
search-input-file for bash).

By the way, please enable forceinbodyfrom in git so that a pristine From
field is inserted into your patches, as your mail From list is being
rewritten to comply with your domain's DKIM.

Comments

kiasoc5 June 4, 2023, 1:54 p.m. UTC | #1
Hi Josselin,

On 6/4/23 05:41, Josselin Poiret wrote:

> Thanks for your patch!  Pushed as
> f72f3a909a41dce5dc4512c30d4cd0673bc6560f with the following best
> practices modifications (importantly, note cc-for-target and
> search-input-file for bash).

Thanks for merging!

What is the difference between this

> -                 (lambda _
> -                   (substitute* "lib/ccan.git/tools/create-ccan-tree"
> -                     (("#!/bin/bash")
> -                      (string-append "#!"
> -                                     #$(this-package-native-input "bash")
> -                                     "/bin/bash")))))

and this?

> +            (lambda* (#:key inputs native-inputs #:allow-other-keys)
> +              (substitute* "lib/ccan.git/tools/create-ccan-tree"
> +                (("#!/bin/bash")
> +                 (string-append "#!"
> +                                (search-input-file (or native-inputs inputs)
> +                                                   "/bin/bash"))))))

I meant to search for bash as a native input but I guess they are different.
Josselin Poiret June 4, 2023, 3:06 p.m. UTC | #2
Hi kiasoc5,

kiasoc5 <kiasoc5@disroot.org> writes:

> What is the difference between this
>
>> -                 (lambda _
>> -                   (substitute* "lib/ccan.git/tools/create-ccan-tree"
>> -                     (("#!/bin/bash")
>> -                      (string-append "#!"
>> -                                     #$(this-package-native-input "bash")
>> -                                     "/bin/bash")))))
>
> and this?
>
>> +            (lambda* (#:key inputs native-inputs #:allow-other-keys)
>> +              (substitute* "lib/ccan.git/tools/create-ccan-tree"
>> +                (("#!/bin/bash")
>> +                 (string-append "#!"
>> +                                (search-input-file (or native-inputs inputs)
>> +                                                   "/bin/bash"))))))
>
> I meant to search for bash as a native input but I guess they are different.

In general, the first method doesn't compose well with package
transformations that replace inputs, since it will still refer to the
original bash input.  The bottom one will always search for a /bin/bash
binary among all the inputs, so will pick up a new one if the input is
replaced.  Also, in general, inside phases, if you're building natively,
native-inputs is always #f and inputs also contains the native inputs,
hence the need for that (or ...) form.

HTH,
diff mbox series

Patch

diff --git a/gnu/packages/efi.scm b/gnu/packages/efi.scm
index 50d52c4d65..499745eba1 100644
--- a/gnu/packages/efi.scm
+++ b/gnu/packages/efi.scm
@@ -114,28 +114,29 @@  (define-public sbsigntools
         (base32 "060n6w0dx1mrilhdv482ncckanqz6pdv53piimiki0bm15d2fcp4"))))
     (build-system gnu-build-system)
     (arguments
-     (list #:phases
-           #~(modify-phases %standard-phases
-               (add-after 'unpack 'patch-more-shebangs
-                 (lambda _
-                   (substitute* "lib/ccan.git/tools/create-ccan-tree"
-                     (("#!/bin/bash")
-                      (string-append "#!"
-                                     #$(this-package-native-input "bash")
-                                     "/bin/bash")))))
-               (add-after 'unpack 'patch
-                 (lambda _
-                   (substitute* '("configure.ac"
-                                  "tests/Makefile.am")
-                     (("/usr/include/efi")
-                      (string-append #$(this-package-input "gnu-efi")
-                                     "/include/efi"))
-                     (("/usr/lib/gnuefi")
-                      (string-append #$(this-package-input "gnu-efi")
-                                     "/lib")))))
-               (add-after 'unpack 'setenv
-                 (lambda _
-                   (setenv "CC" "gcc"))))))
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-more-shebangs
+            (lambda* (#:key inputs native-inputs #:allow-other-keys)
+              (substitute* "lib/ccan.git/tools/create-ccan-tree"
+                (("#!/bin/bash")
+                 (string-append "#!"
+                                (search-input-file (or native-inputs inputs)
+                                                   "/bin/bash"))))))
+          (add-after 'unpack 'patch
+            (lambda _
+              (substitute* '("configure.ac"
+                             "tests/Makefile.am")
+                (("/usr/include/efi")
+                 (string-append #$(this-package-input "gnu-efi")
+                                "/include/efi"))
+                (("/usr/lib/gnuefi")
+                 (string-append #$(this-package-input "gnu-efi")
+                                "/lib")))))
+          (add-after 'unpack 'setenv
+            (lambda _
+              (setenv "CC" #$(cc-for-target)))))))
     (native-inputs
      (list autoconf
            automake