guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

06/08: gnu: clipmenu: Improve the package definition


From: guix-commits
Subject: 06/08: gnu: clipmenu: Improve the package definition
Date: Sat, 21 Mar 2020 19:02:36 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit f5e0634431819f753f5e20e6c8ddc310215d9051
Author: Damien Cassou <address@hidden>
AuthorDate: Sat Mar 21 17:33:39 2020 +0100

    gnu: clipmenu: Improve the package definition
    
    * gnu/packages/xdisorg.scm (clipmenu): Add the package's unit-tests to the
    check phase.  Wrap the program so the PATH contains all dependencies. The
    previous approach to patch the script was incomplete and more complex.
    
    Signed-off-by: Ludovic Court├Ęs <address@hidden>
---
 gnu/packages/xdisorg.scm | 52 ++++++++++++++++++++++++++++++++----------------
 1 file changed, 35 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 21165f3..facd63a 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -74,6 +74,7 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages gawk)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
@@ -2188,21 +2189,6 @@ tools to complement clipnotify.")
       (arguments
        `(#:phases
          (modify-phases %standard-phases
-           (add-after 'unpack 'fix-hardcoded-paths
-             (lambda _
-               (substitute* "clipmenud"
-                 (("has_clipnotify=0")
-                  "has_clipnotify=1")
-                 (("command -v clipnotify >/dev/null 2>&1 && has_clipnotify=1")
-                  "")
-                 (("clipnotify \\|\\| .*")
-                  (string-append (which "clipnotify") "\n"))
-                 (("xsel --logfile")
-                  (string-append (which "xsel") " --logfile")))
-               (substitute* "clipmenu"
-                 (("xsel --logfile")
-                  (string-append (which "xsel") " --logfile")))
-               #t))
            (delete 'configure)
            (delete 'build)
            (replace 'install
@@ -2215,10 +2201,42 @@ tools to complement clipnotify.")
                  (install-file "clipmenu" bin)
                  (install-file "clipmenud" bin)
                  (install-file "README.md" doc)
-                 #t))))
-         #:tests? #f))
+                 #t)))
+           (add-after 'install 'wrap-script
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((out               (assoc-ref outputs "out"))
+                      (clipnotify        (assoc-ref inputs "clipnotify"))
+                      (coreutils-minimal (assoc-ref inputs 
"coreutils-minimal"))
+                      (gawk              (assoc-ref inputs "gawk"))
+                      (util-linux        (assoc-ref inputs "util-linux"))
+                      (xdotool           (assoc-ref inputs "xdotool"))
+                      (xsel              (assoc-ref inputs "xsel")))
+                 (for-each
+                  (lambda (prog)
+                    (wrap-script (string-append out "/bin/" prog)
+                      `("PATH" ":" prefix
+                        ,(map (lambda (dir)
+                                (string-append dir "/bin"))
+                              (list clipnotify coreutils-minimal
+                                    gawk util-linux xdotool xsel)))))
+                  '("clipmenu" "clipmenud" "clipdel")))
+               #t))
+           (replace 'check
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               ;; substitute a shebang appearing inside a string (the test
+               ;; file writes this string to a temporary file):
+               (substitute* "tests/test-clipmenu"
+                 (("#!/usr/bin/env bash")
+                  (string-append "#!" (which "bash"))))
+               (invoke "tests/test-clipmenu")
+               #t)))))
       (inputs
        `(("clipnotify" ,clipnotify)
+         ("coreutils-minimal" ,coreutils-minimal)
+         ("gawk" ,gawk)
+         ("guile" ,guile-3.0) ; for wrap-script
+         ("util-linux" ,util-linux)
+         ("xdotool" ,xdotool)
          ("xsel" ,xsel)))
       (home-page "https://github.com/cdown/clipmenu";)
       (synopsis "Simple clipboard manager using dmenu or rofi and xsel")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]