Subject: [bug#66704] [PATCH v2] gnu: patman: Wrap program with git.

From: Simon Tournier <[email-masked]>
Date: Tue, 23 Jul 2024 19:59:18 +0200

* gnu/packages/bootloaders.scm (patman): Replace by 'package/inherit'.
[arguments]: Add 'wrap-program' that uses git dependency.
[inputs]: Add git and git:send-email.

Change-Id: Id4ebadd518f271baa087161b10455ec03d6f959b
---
 gnu/packages/bootloaders.scm | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

Hi,

On Mon, 23 Oct 2023 at 21:05, Maxim Cournoyer <[email-masked]> wrote:

> I see 'git send-email' in the above

Good catch!  Added.  However, I am not happy with the mix of “styles”.  And I
suspect a “bug” or something lacking for packages with multiple outputs; I am
going to open a report about that.  Another story and not blocking, IMHO.

>                        Did you test that this suffices to get a fully
> self-contained working patman?  Maybe you can send a v2 with patman.

Not really tested.  Well, I do not know what means:

        owner 66704 !
        thanks

that Steve sent to control.  Steve, do you want to give a try and test if this
patman package is a fully self-contained working patman? ;-)

Cheers,
simon

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 4072df50d7..e974feae5a 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -19,6 +19,7 @@
 ;;; Copyright © 2021 Stefan <[email-masked]>
 ;;; Copyright © 2022, 2023 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2023 Herman Rimm <[email-masked]>
+;;; Copyright © 2023 Simon Tournier <[email-masked]>
 ;;; Copyright © 2024 Zheng Junjie <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -71,6 +72,7 @@ (define-module (gnu packages bootloaders)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages swig)
   #:use-module (gnu packages valgrind)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages virtualization)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages python-web)
@@ -965,8 +967,7 @@ (define-public python-u-boot-pylib
 ;;; This is packaged separately, as it can be used in other contexts than for
 ;;; U-Boot development.
 (define-public patman
-  (package
-    (inherit u-boot)
+  (package/inherit u-boot
     (name "patman")
     (build-system pyproject-build-system)
     (arguments
@@ -991,8 +992,21 @@ (define-public patman
             (lambda _
               (substitute* "pyproject.toml"
                 (("patman.__main__:run_patman")
-                 "patman.__main__")))))))
-    (inputs (list python-pygit2 python-requests python-u-boot-pylib))
+                 "patman.__main__"))))
+          (add-after 'install 'wrap-program
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((git:send-email (assoc-ref inputs "git:send-email")))
+                (wrap-program (string-append #$output "/bin/patman")
+                  `("PATH" ":" prefix
+                    (,(string-append #$(this-package-input "git") "/bin")))
+                  `("GIT_EXEC_PATH" ":" prefix
+                    (,(string-append #$(this-package-input "git") "/libexec/git-core")
+                     ,(string-append git:send-email "/libexec/git-core"))))))))))
+    (inputs `(("git" ,git)
+              ("git:send-email" ,git "send-email")
+              ("python-pygit2" ,python-pygit2)
+              ("python-requests" ,python-requests)
+              ("python-u-boot-pylib" ,python-u-boot-pylib)))
     (synopsis "Patch automation tool")
     (description "Patman is a patch automation script which:
 @itemize

base-commit: d007b64356764f49677c78d82643f1125b5353b7
-- 
2.41.0