unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#40168] [PATCH]
@ 2020-03-21 17:02 Damien Cassou
  2020-03-21 22:39 ` bug#40168: [PATCH] Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Cassou @ 2020-03-21 17:02 UTC (permalink / raw)
  To: 40168; +Cc: Ludovic Courtès

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

Hi,

I've improved the packaging for clipmenu in
gnu/packages/xdisorg.scm. Please give feedback.

I found that my usage of wrap-script is very verbose. Is there a simpler
way?

Thank you

Damien Cassou (3):
  * gnu/packages/xdisorg.scm (clipmenu): Re-indent
  * gnu/packages/xdisorg.scm (clipnotify): Add a comment
  gnu: clipmenu: Improve the package definition

 gnu/packages/xdisorg.scm | 125 ++++++++++++++++++++++-----------------
 1 file changed, 72 insertions(+), 53 deletions(-)

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-packages-xdisorg.scm-clipmenu-Re-indent.patch --]
[-- Type: text/x-patch, Size: 5479 bytes --]

From c3dda4474189d32b80f260125115c9f8f159cbaf Mon Sep 17 00:00:00 2001
From: Damien Cassou <damien@cassou.me>
Date: Sat, 21 Mar 2020 17:42:07 +0100
Subject: [PATCH 1/3] * gnu/packages/xdisorg.scm (clipmenu): Re-indent

---
 gnu/packages/xdisorg.scm | 106 +++++++++++++++++++--------------------
 1 file changed, 53 insertions(+), 53 deletions(-)

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index c714b867f4..817eef6c29 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -2170,58 +2170,58 @@ (define-public clipmenu
   (let ((commit "a495bcc7a4ab125182a661c5808364f66938a87c")
         (revision "1"))
     (package
-     (name "clipmenu")
-     (version (string-append "5.6.0-"
-                             revision "." (string-take commit 7)))
-     (source
-      (origin
-        (method git-fetch)
-        (uri (git-reference
-              (url "https://github.com/cdown/clipnotify.git")
-              (commit commit)))
-        (file-name (git-file-name name version))
-        (sha256
-         (base32
-          "12vvircdhl4psqi51cnfd6bqy85v2vwfcmdq1mimjgng727nwzys"))))
-     (build-system gnu-build-system)
-     (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
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out  (assoc-ref outputs "out"))
-                    (bin  (string-append out "/bin"))
-                    (doc  (string-append %output "/share/doc/"
-                                         ,name "-" ,version)))
-               (install-file "clipdel" bin)
-               (install-file "clipmenu" bin)
-               (install-file "clipmenud" bin)
-               (install-file "README.md" doc)
-               #t))))
-       #:tests? #f))
-     (inputs
-      `(("clipnotify" ,clipnotify)
-        ("xsel" ,xsel)))
-     (home-page "https://github.com/cdown/clipmenu")
-     (synopsis "Simple clipboard manager using dmenu or rofi and xsel")
-     (description "Start @command{clipmenud}, then run @command{clipmenu} to
+      (name "clipmenu")
+      (version (string-append "5.6.0-"
+                              revision "." (string-take commit 7)))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/cdown/clipnotify.git")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "12vvircdhl4psqi51cnfd6bqy85v2vwfcmdq1mimjgng727nwzys"))))
+      (build-system gnu-build-system)
+      (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
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((out  (assoc-ref outputs "out"))
+                      (bin  (string-append out "/bin"))
+                      (doc  (string-append %output "/share/doc/"
+                                           ,name "-" ,version)))
+                 (install-file "clipdel" bin)
+                 (install-file "clipmenu" bin)
+                 (install-file "clipmenud" bin)
+                 (install-file "README.md" doc)
+                 #t))))
+         #:tests? #f))
+      (inputs
+       `(("clipnotify" ,clipnotify)
+         ("xsel" ,xsel)))
+      (home-page "https://github.com/cdown/clipmenu")
+      (synopsis "Simple clipboard manager using dmenu or rofi and xsel")
+      (description "Start @command{clipmenud}, then run @command{clipmenu} to
 select something to put on the clipboard.
 
 When @command{clipmenud} detects changes to the clipboard contents, it writes
@@ -2229,4 +2229,4 @@ (define-public clipmenu
 to find all available clips and launches @command{dmenu} (or @command{rofi},
 depending on the value of @code{CM_LAUNCHER}) to let the user select a clip.
 After selection, the clip is put onto the PRIMARY and CLIPBOARD X selections.")
-     (license license:public-domain))))
+      (license license:public-domain))))
-- 
2.25.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-packages-xdisorg.scm-clipnotify-Add-a-comment.patch --]
[-- Type: text/x-patch, Size: 733 bytes --]

From 5074bba8c91d24b542b78c07295842fba5c82d9c Mon Sep 17 00:00:00 2001
From: Damien Cassou <damien@cassou.me>
Date: Sat, 21 Mar 2020 17:45:11 +0100
Subject: [PATCH 2/3] * gnu/packages/xdisorg.scm (clipnotify): Add a comment

---
 gnu/packages/xdisorg.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 817eef6c29..21165f384f 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -2147,6 +2147,7 @@ (define-public clipnotify
                (install-file "README.md" doc)
                #t))))
        #:make-flags (list "CC=gcc")
+       ;; the package provides no test suite:
        #:tests? #f))
     (inputs
      `(("libx11" ,libx11)
-- 
2.25.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-clipmenu-Improve-the-package-definition.patch --]
[-- Type: text/x-patch, Size: 4147 bytes --]

From 391ad6deec073b7e01984fd81a44a5cac52afc5b Mon Sep 17 00:00:00 2001
From: Damien Cassou <damien@cassou.me>
Date: Sat, 21 Mar 2020 17:33:39 +0100
Subject: [PATCH 3/3] 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.
---
 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 21165f384f..f7c4668bf8 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -74,6 +74,7 @@ (define-module (gnu packages xdisorg)
   #: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 @@ (define-public clipmenu
       (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 @@ (define-public clipmenu
                  (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")
+                  (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")
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#40168: [PATCH]
  2020-03-21 17:02 [bug#40168] [PATCH] Damien Cassou
@ 2020-03-21 22:39 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2020-03-21 22:39 UTC (permalink / raw)
  To: Damien Cassou; +Cc: 40168-done

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

Hi Damien,

Damien Cassou <damien@cassou.me> skribis:

> Damien Cassou (3):
>   * gnu/packages/xdisorg.scm (clipmenu): Re-indent
>   * gnu/packages/xdisorg.scm (clipnotify): Add a comment
>   gnu: clipmenu: Improve the package definition

Applied!

I added a subject line to the commit logs.  For the last patch I
adjusted the shebang substitute:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1240 bytes --]

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index f7c4668bf8..facd63ab53 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -2204,8 +2204,8 @@ tools to complement clipnotify.")
                  #t)))
            (add-after 'install 'wrap-script
              (lambda* (#:key inputs outputs #:allow-other-keys)
-               (let* ((out (assoc-ref outputs "out"))
-                      (clipnotify (assoc-ref inputs "clipnotify"))
+               (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"))
@@ -2227,7 +2227,7 @@ tools to complement clipnotify.")
                ;; file writes this string to a temporary file):
                (substitute* "tests/test-clipmenu"
                  (("#!/usr/bin/env bash")
-                  (which "bash")))
+                  (string-append "#!" (which "bash"))))
                (invoke "tests/test-clipmenu")
                #t)))))
       (inputs

[-- Attachment #3: Type: text/plain, Size: 23 bytes --]


Thanks!

Ludo’.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-21 22:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-21 17:02 [bug#40168] [PATCH] Damien Cassou
2020-03-21 22:39 ` bug#40168: [PATCH] Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).