diff mbox series

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

Message ID 3b43a54f344bbe0824d351915fdb4db979b10a00.1721757000.git.zimon.toutoune@gmail.com
State New
Headers show
Series [bug#66704,v2] gnu: patman: Wrap program with git. | expand

Commit Message

Simon Tournier July 23, 2024, 5:59 p.m. UTC
* 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 <maxim.cournoyer@gmail.com> 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



base-commit: d007b64356764f49677c78d82643f1125b5353b7

Comments

Maxim Cournoyer Sept. 14, 2024, 1:01 p.m. UTC | #1
Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

> * gnu/packages/bootloaders.scm (patman): Replace by 'package/inherit'.

I don't think package/inherit is appropriate here; patman is not a
variant of u-boot (doesn't share any of its inputs) -- it jut happens to
have its source part of the u-boot sources.

I've dropped it.

> [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 <maxim.cournoyer@gmail.com> 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.

[...]

>                (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"))))))))))

I think 'search-input-file' would be better here. It should be preferred
to gexps in general, as it is more lazy and works better with
inheritance.

> +    (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

I modified this to avoid adding labels, which was not necessary.  I've
also used wrap-script, which inserts the wrapping in the Python script
directly instead of creating a .patman-real wrapper, which uglifies the
process name in top, for example.

You'll find the result in commit 4c99ef43f0.

Thanks for kicking the ball.
diff mbox series

Patch

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 <stefan-guix@vodafonemail.de>
 ;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2023 Herman Rimm <herman@rimm.ee>
+;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
 ;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
 ;;;
 ;;; 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