aboutsummaryrefslogtreecommitdiff
path: root/tests/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-03-08 12:53:20 +0100
committerLudovic Courtès <ludo@gnu.org>2023-03-13 15:08:33 +0100
commiteee95b5a879b7096dffd533f24107cf8926b621e (patch)
treeb6cef032a6e3a103374bfd0cf47bf2ad8046ed0c /tests/packages.scm
parent5dd0d7f99f4a71a6ed4a2dab66d32e4b7ed2b70c (diff)
downloadguix-eee95b5a879b7096dffd533f24107cf8926b621e.tar
guix-eee95b5a879b7096dffd533f24107cf8926b621e.tar.gz
packages: 'package-input-rewriting/spec' ignores hidden packages.
The primary motivation is to support things like: guix build guix --with-input=guile=guile-next without triggering a rebuild of (@@ (gnu packages commencement) guile-final) and similar things. It is also consistent with package name resolution on the command line: a package that cannot be named cannot be replaced. * guix/packages.scm (package-input-rewriting/spec)[rewrite]: When P is hidden, return it as-is. * tests/packages.scm ("package-input-rewriting/spec, hidden package"): New test. * doc/guix.texi (Defining Package Variants): Update. (Package Transformation Options): Update '--with-input' example.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r--tests/packages.scm20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 27fb918f90..ef97fca86d 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
@@ -1592,6 +1592,24 @@
(match (delete-duplicates pythons eq?)
((p) (eq? p (rewrite python))))))
+(test-assert "package-input-rewriting/spec, hidden package"
+ ;; Hidden packages are not subject to rewriting.
+ (let* ((python (hidden-package python))
+ (p0 (dummy-package "chbouib"
+ (build-system trivial-build-system)
+ (inputs (list python))))
+ (rewrite (package-input-rewriting/spec
+ `(("python" . ,(const sed)))
+ #:deep? #t))
+ (p1 (rewrite p0))
+ (bag1 (package->bag p1))
+ (pythons (filter-map (match-lambda
+ (("python" python) python)
+ (_ #f))
+ (bag-transitive-inputs bag1))))
+ (match (delete-duplicates pythons eq?)
+ ((p) (eq? p python)))))
+
(test-equal "package-input-rewriting/spec, graft"
(derivation-file-name (package-derivation %store sed))