diff mbox series

[bug#54615,v2,1/2] gnu: spike: Substitute path to dtc instead of wrapping executables.

Message ID 20220328185557.27310-2-arunisaac@systemreboot.net
State Accepted
Headers show
Series Add riscv-pk and improve spike | expand

Commit Message

Arun Isaac March 28, 2022, 6:55 p.m. UTC
* gnu/packages/virtualization.scm (spike)[arguments]: Delete the wrap-binary
phase. Add a configure-dtc-path phase that substitutes the absolute path to
dtc.
---
 gnu/packages/virtualization.scm | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Comments

M March 28, 2022, 7:49 p.m. UTC | #1
Arun Isaac schreef op di 29-03-2022 om 00:25 [+0530]:
> -                         (,(dirname (search-input-file inputs "/bin/dtc"))))))
> -                   (find-files (string-append out "/bin")))))))))
> +           (add-before 'configure 'configure-dtc-path
> +             (lambda* (#:key inputs #:allow-other-keys)
> +               ;; Reference dtc by its absolute store path.
> +               (substitute* "riscv/dts.cc"
> +                 (("DTC")
> +                  (string-append "\"" (assoc-ref inputs "dtc") "/bin/dtc\""))))))))

Why is search-input-file being replaced by assoc-ref?

Greetings,
Maxime.
Arun Isaac March 29, 2022, 10:42 a.m. UTC | #2
Hi Maxime,

> %outputs is almost undocumented

> Why is search-input-file being replaced by assoc-ref?

Thanks for catching these! It looks like my knowledge of Guix packaging
is a bit behind the times. I didn't know about %outputs being
deprecated, and didn't even know about search-input-file! I've fixed
both issues. A v3 of the patchset follows.

Regards,
Arun
diff mbox series

Patch

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index bd297977df..9c86670ce7 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -26,6 +26,7 @@ 
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com>
 ;;; Copyright © 2022 Ekaitz Zarraga <ekaitz@elenq.tech>
+;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1037,15 +1038,12 @@  (define-public spike
      (list
        #:phases
        #~(modify-phases %standard-phases
-           (add-after 'install 'wrap-binary
-             (lambda* (#:key inputs outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 (for-each
-                   (lambda (file)
-                     (wrap-program file
-                       `("PATH" ":" prefix
-                         (,(dirname (search-input-file inputs "/bin/dtc"))))))
-                   (find-files (string-append out "/bin")))))))))
+           (add-before 'configure 'configure-dtc-path
+             (lambda* (#:key inputs #:allow-other-keys)
+               ;; Reference dtc by its absolute store path.
+               (substitute* "riscv/dts.cc"
+                 (("DTC")
+                  (string-append "\"" (assoc-ref inputs "dtc") "/bin/dtc\""))))))))
     (inputs
      (list bash-minimal dtc))
     (native-inputs