From e38d90d497e19e00263fa28961c688a433154386 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 21 Dec 2020 14:52:38 +0100 Subject: transformations: Add '--with-patch'. Suggested by Philippe Swartvagher . * guix/transformations.scm (transform-package-patches): New procedure. (%transformations): Add it as 'with-patch'. (%transformation-options, show-transformation-options-help/detailed): Add '--with-patch'. * tests/transformations.scm ("options->transformation, with-patch"): New test. * doc/guix.texi (Package Transformation Options): Document it. --- tests/transformations.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/transformations.scm') 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: -- cgit 1.4.1