summaryrefslogtreecommitdiff
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)
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 27fb918f907..ef97fca86df 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> 3;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
4;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> 4;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
5;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> 5;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
@@ -1592,6 +1592,24 @@
1592 (match (delete-duplicates pythons eq?) 1592 (match (delete-duplicates pythons eq?)
1593 ((p) (eq? p (rewrite python)))))) 1593 ((p) (eq? p (rewrite python))))))
1594 1594
1595(test-assert "package-input-rewriting/spec, hidden package"
1596 ;; Hidden packages are not subject to rewriting.
1597 (let* ((python (hidden-package python))
1598 (p0 (dummy-package "chbouib"
1599 (build-system trivial-build-system)
1600 (inputs (list python))))
1601 (rewrite (package-input-rewriting/spec
1602 `(("python" . ,(const sed)))
1603 #:deep? #t))
1604 (p1 (rewrite p0))
1605 (bag1 (package->bag p1))
1606 (pythons (filter-map (match-lambda
1607 (("python" python) python)
1608 (_ #f))
1609 (bag-transitive-inputs bag1))))
1610 (match (delete-duplicates pythons eq?)
1611 ((p) (eq? p python)))))
1612
1595(test-equal "package-input-rewriting/spec, graft" 1613(test-equal "package-input-rewriting/spec, graft"
1596 (derivation-file-name (package-derivation %store sed)) 1614 (derivation-file-name (package-derivation %store sed))
1597 1615