diff options
Diffstat (limited to 'tests/transformations.scm')
-rw-r--r-- | tests/transformations.scm | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/tests/transformations.scm b/tests/transformations.scm index 902bd45a6a..09839dc1c5 100644 --- a/tests/transformations.scm +++ b/tests/transformations.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2021 Marius Bakke <marius@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,7 +30,10 @@ #: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 gexp) + #:select (local-file? local-file-file + computed-file? computed-file-gexp + gexp-input-thing)) #:use-module (guix ui) #:use-module (guix utils) #:use-module (guix git) @@ -232,6 +236,26 @@ (string=? (package-name dep2) "chbouib") (package-source dep2)))))))) +(test-equal "options->transformation, with-commit, version transformation" + '("1.0" "1.0-rc1-2-gabc123" "git.abc123") + (map (lambda (commit) + (let* ((p (dummy-package "guix.scm" + (inputs `(("foo" ,(dummy-package "chbouib" + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://example.org") + (commit "cabba9e"))) + (sha256 #f))))))))) + (t (options->transformation + `((with-commit . ,(string-append "chbouib=" commit)))))) + (let ((new (t p))) + (and (not (eq? new p)) + (match (package-inputs new) + ((("foo" dep1)) + (package-version dep1))))))) + '("v1.0" "1.0-rc1-2-gabc123" "abc123"))) + (test-equal "options->transformation, with-git-url" (let ((source (git-checkout (url "https://example.org") (recursive? #t)))) @@ -400,6 +424,31 @@ (map local-file-file (origin-patches (package-source dep))))))))) +(test-equal "options->transformation, with-commit + with-patch" + '(#t #t) + (let* ((patch (search-patch "glibc-locales.patch")) + (commit "f8934ec94df5868ee8baf1fb0f8ed0f24e7e91eb") + (t (options->transformation + ;; Note: options are applied in reverse order, so + ;; 'with-patch' comes on top. + `((with-patch . ,(string-append "guile-gcrypt=" patch)) + (with-commit + . ,(string-append "guile-gcrypt=" commit)))))) + (let ((new (t (@ (gnu packages gnupg) guile-gcrypt)))) + (match (package-source new) + ((? computed-file? source) + (let* ((gexp (computed-file-gexp source)) + (inputs (map gexp-input-thing + ((@@ (guix gexp) gexp-inputs) gexp)))) + (list (any (lambda (input) + (and (git-checkout? input) + (string=? commit (git-checkout-commit input)))) + inputs) + (any (lambda (input) + (and (local-file? input) + (string=? (local-file-file input) patch))) + inputs)))))))) + (test-equal "options->transformation, with-latest" "42.0" (mock ((guix upstream) %updaters |