ngz pushed a commit to branch master
in repository guix.

commit 1d412a24d62f9698fd9b72bce00e3e1f9dc729c5
Author: Bruno Victal <mi...@makinata.eu>
AuthorDate: Sun Feb 23 20:15:47 2025 +0100

    gnu: licensecheck: Use G-Expressions. Refactor phases.
    
    * gnu/packages/license.scm (licensecheck)[arguments]: Use G-Expressions.
    Drop trailing #t.
    <#:phases>: Rename 'wrap-program to 'wrap-licensecheck. Add 'check-wrap.
    
    Change-Id: I475810dca334032a9a6e30a1acf86abdbb77a30d
    Signed-off-by: Nicolas Goaziou <m...@nicolasgoaziou.fr>
---
 gnu/packages/license.scm | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/license.scm b/gnu/packages/license.scm
index e10d9b60d2..78b1b3a39f 100644
--- a/gnu/packages/license.scm
+++ b/gnu/packages/license.scm
@@ -183,19 +183,25 @@ string and serializes them in a normalized format.")
            perl-string-copyright
            perl-string-escape
            perl-string-license))
-    (inputs (list bash-minimal))         ; for wrap-program
+    (inputs (list bash-minimal))        ; for wrap-program
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'install 'wrap-program
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (perllib (string-append out "/lib/perl5/site_perl/"
-                                            ,(package-version perl))))
-               (wrap-program (string-append out "/bin/licensecheck")
-                 `("PERL5LIB" ":"
-                   prefix (,(string-append perllib ":" (getenv "PERL5LIB")))))
-               #t))))))
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'wrap-licensecheck
+            (lambda _
+              (let ((licensecheck (string-append #$output "/bin/licensecheck"))
+                    (perl5lib (string-append #$output "/lib/perl5/site_perl/"
+                                             #$(package-version perl))))
+                (wrap-program licensecheck
+                  `("PERL5LIB" ":" prefix
+                    ,(list perl5lib (getenv "PERL5LIB")))))))
+          (add-after 'wrap-licensecheck 'check-wrap
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (unsetenv "PERL5LIB")
+                (invoke/quiet (string-append #$output "/bin/licensecheck")
+                              "--version")))))))
     (home-page "https://metacpan.org/release/App-Licensecheck";)
     (synopsis "License checker for source files")
     (description "Licensecheck attempts to determine the license that applies

Reply via email to