summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2020-12-29 17:37:17 +0100
committerMarius Bakke <marius@gnu.org>2020-12-29 17:37:17 +0100
commita22e75c073c785a3a71c952d97fb7ab87dfd282d (patch)
treec0ef12b8c271c9de37bcce9287b67adf8628ed93 /tests
parentbbe4ed65ed5fe7dc8ed9d226042852387cee3b1e (diff)
parent789bf7fcc241d010cb583dc76c366110bfca8b35 (diff)
downloadguix-a22e75c073c785a3a71c952d97fb7ab87dfd282d.tar.gz
Merge branch 'master' into ungrafting
Diffstat (limited to 'tests')
-rw-r--r--tests/import-utils.scm32
-rw-r--r--tests/transformations.scm24
2 files changed, 56 insertions, 0 deletions
diff --git a/tests/import-utils.scm b/tests/import-utils.scm
index 2357ea5c40..874816442e 100644
--- a/tests/import-utils.scm
+++ b/tests/import-utils.scm
@@ -122,6 +122,38 @@
     (or (package-license (alist->package meta))
         'license-is-false)))
 
+(test-equal "alist->package with SPDX license name 1/2"  ;<https://bugs.gnu.org/45453>
+  license:expat
+  (let* ((meta '(("name" . "hello")
+                 ("version" . "2.10")
+                 ("source" . (("method" . "url-fetch")
+                              ("uri"    . "mirror://gnu/hello/hello-2.10.tar.gz")
+                              ("sha256" .
+                               (("base32" .
+                                 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))))
+                 ("build-system" . "gnu")
+                 ("home-page" . "https://gnu.org")
+                 ("synopsis" . "Say hi")
+                 ("description" . "This package says hi.")
+                 ("license" . "expat"))))
+    (package-license (alist->package meta))))
+
+(test-equal "alist->package with SPDX license name 2/2"  ;<https://bugs.gnu.org/45453>
+  license:expat
+  (let* ((meta '(("name" . "hello")
+                 ("version" . "2.10")
+                 ("source" . (("method" . "url-fetch")
+                              ("uri"    . "mirror://gnu/hello/hello-2.10.tar.gz")
+                              ("sha256" .
+                               (("base32" .
+                                 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))))
+                 ("build-system" . "gnu")
+                 ("home-page" . "https://gnu.org")
+                 ("synopsis" . "Say hi")
+                 ("description" . "This package says hi.")
+                 ("license" . "MIT"))))
+    (package-license (alist->package meta))))
+
 (test-equal "alist->package with dependencies"
   `(("gettext" ,(specification->package "gettext")))
   (let* ((meta '(("name" . "hello")
diff --git a/tests/transformations.scm b/tests/transformations.scm
index 2d33bed7ae..9053deba41 100644
--- a/tests/transformations.scm
+++ b/tests/transformations.scm
@@ -26,6 +26,7 @@
   #:use-module (guix build-system)
   #:use-module (guix build-system gnu)
   #:use-module (guix transformations)
+  #:use-module ((guix gexp) #:select (local-file? local-file-file))
   #:use-module (guix ui)
   #:use-module (guix utils)
   #:use-module (guix git)
@@ -372,6 +373,29 @@
               (match (memq #:tests? (package-arguments tar))
                 ((#:tests? #f _ ...) #t))))))))
 
+(test-equal "options->transformation, with-patch"
+  (search-patches "glibc-locales.patch" "guile-relocatable.patch")
+  (let* ((dep    (dummy-package "dep"
+                   (source (dummy-origin))))
+         (p      (dummy-package "foo"
+                   (inputs `(("dep" ,dep)))))
+         (patch1 (search-patch "glibc-locales.patch"))
+         (patch2 (search-patch "guile-relocatable.patch"))
+         (t      (options->transformation
+                  `((with-patch . ,(string-append "dep=" patch1))
+                    (with-patch . ,(string-append "dep=" patch2))
+                    (with-patch . ,(string-append "tar=" patch1))))))
+    (let ((new (t p)))
+      (match (bag-direct-inputs (package->bag new))
+        ((("dep" dep) ("tar" tar) _ ...)
+         (and (member patch1
+                      (filter-map (lambda (patch)
+                                    (and (local-file? patch)
+                                         (local-file-file patch)))
+                                  (origin-patches (package-source tar))))
+              (map local-file-file
+                   (origin-patches (package-source dep)))))))))
+
 (test-end)
 
 ;;; Local Variables: