summaryrefslogtreecommitdiff
path: root/tests/transformations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2021-08-11 15:54:59 +0200
committerLudovic Courtès <ludo@gnu.org>2021-08-11 16:35:28 +0200
commit373e7ac4f9d510d3a58fcdbe9ec2d67eb426336b (patch)
tree5f8b69cfa8b7a458fd7f13f50a771e1ec306f855 /tests/transformations.scm
parent168d107abf5608e6a1bfb37ee3448c4087856602 (diff)
transformations: 'with-patch' works on non-origin sources.
Fixes <https://issues.guix.gnu.org/49697>. Reported by Philippe Swartvagher <philippe.swartvagher@inria.fr>. * guix/transformations.scm (patched-source): New procedure. (transform-package-patches)[package-with-extra-patches]: Use it when (package-source p) is not an origin. * tests/transformations.scm ("options->transformation, with-commit + with-patch"): New test.
Diffstat (limited to 'tests/transformations.scm')
-rw-r--r--tests/transformations.scm30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/transformations.scm b/tests/transformations.scm
index 902bd45a6a4..3417c994ec4 100644
--- a/tests/transformations.scm
+++ b/tests/transformations.scm
@@ -29,7 +29,10 @@
29 #:use-module (guix build-system) 29 #:use-module (guix build-system)
30 #:use-module (guix build-system gnu) 30 #:use-module (guix build-system gnu)
31 #:use-module (guix transformations) 31 #:use-module (guix transformations)
32 #:use-module ((guix gexp) #:select (local-file? local-file-file)) 32 #:use-module ((guix gexp)
33 #:select (local-file? local-file-file
34 computed-file? computed-file-gexp
35 gexp-input-thing))
33 #:use-module (guix ui) 36 #:use-module (guix ui)
34 #:use-module (guix utils) 37 #:use-module (guix utils)
35 #:use-module (guix git) 38 #:use-module (guix git)
@@ -400,6 +403,31 @@
400 (map local-file-file 403 (map local-file-file
401 (origin-patches (package-source dep))))))))) 404 (origin-patches (package-source dep)))))))))
402 405
406(test-equal "options->transformation, with-commit + with-patch"
407 '(#t #t)
408 (let* ((patch (search-patch "glibc-locales.patch"))
409 (commit "f8934ec94df5868ee8baf1fb0f8ed0f24e7e91eb")
410 (t (options->transformation
411 ;; Note: options are applied in reverse order, so
412 ;; 'with-patch' comes on top.
413 `((with-patch . ,(string-append "guile-gcrypt=" patch))
414 (with-commit
415 . ,(string-append "guile-gcrypt=" commit))))))
416 (let ((new (t (@ (gnu packages gnupg) guile-gcrypt))))
417 (match (package-source new)
418 ((? computed-file? source)
419 (let* ((gexp (computed-file-gexp source))
420 (inputs (map gexp-input-thing
421 ((@@ (guix gexp) gexp-inputs) gexp))))
422 (list (any (lambda (input)
423 (and (git-checkout? input)
424 (string=? commit (git-checkout-commit input))))
425 inputs)
426 (any (lambda (input)
427 (and (local-file? input)
428 (string=? (local-file-file input) patch)))
429 inputs))))))))
430
403(test-equal "options->transformation, with-latest" 431(test-equal "options->transformation, with-latest"
404 "42.0" 432 "42.0"
405 (mock ((guix upstream) %updaters 433 (mock ((guix upstream) %updaters