summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Vong <alexvong1995@gmail.com>2018-10-14 00:08:29 +0800
committerDanny Milosavljevic <dannym@scratchpost.org>2018-11-19 12:02:09 +0100
commit8da9187a5a2477e3e7114e5a25ae8ae57bf73271 (patch)
tree14a058b1bccc2767e7b307b21bcae24057bb3068
parentdf0a180421b34b6f1f3395652291f94a37303988 (diff)
downloadguix-8da9187a5a2477e3e7114e5a25ae8ae57bf73271.tar.gz
gnu: clojure: Refactor to ensure there's a single list of libraries.
This avoids having to update multiple lists.

* gnu/packages/lisp.scm (clojure)[native-inputs]: Use new local variable.
[arguments]: Adjust build phases accordingly.
-rw-r--r--gnu/packages/lisp.scm101
1 files changed, 49 insertions, 52 deletions
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index f963dfb5de..24738f3f13 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -566,12 +566,40 @@ interface.")
                    license:clarified-artistic)))) ;TRIVIAL-LDAP package
 
 (define-public clojure
-  (let ((submodule (lambda (prefix version hash)
-                     (origin
-                       (method url-fetch)
-                       (uri (string-append "https://github.com/clojure/"
-                                           prefix version ".tar.gz"))
-                       (sha256 (base32 hash))))))
+  (let* ((lib (lambda (prefix version hash)
+                (origin (method url-fetch)
+                        (uri (string-append "https://github.com/clojure/"
+                                            prefix version ".tar.gz"))
+                        (sha256 (base32 hash)))))
+         ;; The libraries below are needed to run the tests.
+         (libraries
+          `(("core-specs-alpha-src"
+             ,(lib "core.specs.alpha/archive/core.specs.alpha-"
+                   "0.1.24"
+                   "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
+            ("data-generators-src"
+             ,(lib "data.generators/archive/data.generators-"
+                   "0.1.2"
+                   "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
+            ("spec-alpha-src"
+             ,(lib "spec.alpha/archive/spec.alpha-"
+                   "0.1.143"
+                   "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
+            ("test-check-src"
+             ,(lib "test.check/archive/test.check-"
+                   "0.9.0"
+                   "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
+            ("test-generative-src"
+             ,(lib "test.generative/archive/test.generative-"
+                   "0.5.2"
+                   "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
+            ("tools-namespace-src"
+             ,(lib "tools.namespace/archive/tools.namespace-"
+                   "0.2.11"
+                   "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
+         (library-names (match libraries
+                          (((library-name _) ...)
+                           library-name))))
     (package
       (name "clojure")
       (version "1.9.0")
@@ -594,27 +622,21 @@ interface.")
          #:test-target "test"
          #:phases
          (modify-phases %standard-phases
-           (add-after 'unpack 'unpack-submodule-sources
+           (add-after 'unpack 'unpack-library-sources
              (lambda* (#:key inputs #:allow-other-keys)
-               (for-each
-                (lambda (name)
-                  (mkdir-p name)
-                  (with-directory-excursion name
-                    (invoke "tar"
-                            "--extract"
-                            "--verbose"
-                            "--file" (assoc-ref inputs name)
-                            "--strip-components=1"))
-                  (copy-recursively (string-append name "/src/main/clojure/")
-                                    "src/clj/"))
-                '("core-specs-alpha-src"
-                  "data-generators-src"
-                  "spec-alpha-src"
-                  "test-check-src"
-                  "test-generative-src"
-                  "tools-namespace-src"))
+               (define (extract-library name)
+                 (mkdir-p name)
+                 (with-directory-excursion name
+                   (invoke "tar"
+                           "--extract"
+                           "--verbose"
+                           "--file" (assoc-ref inputs name)
+                           "--strip-components=1"))
+                 (copy-recursively (string-append name "/src/main/clojure/")
+                                   "src/clj/"))
+               (for-each extract-library ',library-names)
                #t))
-           (add-after 'unpack 'fix-manifest-classpath
+           (add-after 'unpack-library-sources 'fix-manifest-classpath
              (lambda _
                (substitute* "build.xml"
                  (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
@@ -647,32 +669,7 @@ interface.")
                                      <>)
                                    (scandir "./")))
                  #t))))))
-      ;; The native-inputs below are needed to run the tests.
-      (native-inputs
-       `(("core-specs-alpha-src"
-          ,(submodule "core.specs.alpha/archive/core.specs.alpha-"
-                      "0.1.24"
-                      "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
-         ("data-generators-src"
-          ,(submodule "data.generators/archive/data.generators-"
-                      "0.1.2"
-                      "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
-         ("spec-alpha-src"
-          ,(submodule "spec.alpha/archive/spec.alpha-"
-                      "0.1.143"
-                      "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
-         ("test-check-src"
-          ,(submodule "test.check/archive/test.check-"
-                      "0.9.0"
-                      "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
-         ("test-generative-src"
-          ,(submodule "test.generative/archive/test.generative-"
-                      "0.5.2"
-                      "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
-         ("tools-namespace-src"
-          ,(submodule "tools.namespace/archive/tools.namespace-"
-                      "0.2.11"
-                      "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
+      (native-inputs libraries)
       (home-page "https://clojure.org/")
       (synopsis "Lisp dialect running on the JVM")
       (description "Clojure is a dynamic, general-purpose programming language,
@@ -693,7 +690,7 @@ designs.")
       ;; ASM bytecode manipulation library is licensed under BSD-3
       ;; Guava Murmur3 hash implementation is licensed under APL2.0
       ;; src/clj/repl.clj is licensed under CPL1.0
-      ;;
+
       ;; See readme.html or readme.txt for details.
       (license (list license:epl1.0
                      license:bsd-3