summaryrefslogtreecommitdiff
path: root/gnu/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-06-23 18:28:45 +0200
committerLudovic Courtès <ludo@gnu.org>2019-06-27 11:14:41 +0200
commit066eeae1a197b1926c7ffc42919d684686f56fdb (patch)
tree808479f4cf1a18ced524f5a087cbb55af59522b6 /gnu/packages.scm
parent7c690a47381f645ec5ec0a1fd6ffc34dba1b69c2 (diff)
packages: 'specification->package+output' distinguishes "no output specified".
Until now the caller couldn't tell the different between a spec like "foo:out" and one like "foo". This change allows users to distinguish between these two cases. * gnu/packages.scm (specification->package+output): Disable output membership test when OUTPUT = #f and SUB-DRV = #f. * tests/packages.scm ("specification->package+output") ("specification->package+output invalid output") ("specification->package+output no default output") ("specification->package+output invalid output, no default"): New tests.
Diffstat (limited to 'gnu/packages.scm')
-rw-r--r--gnu/packages.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 48390575ba..acb247e114 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -534,14 +534,18 @@ optionally contain a version number and an output name, as in these examples:
guile@2.0.9:debug
If SPEC does not specify a version number, return the preferred newest
-version; if SPEC does not specify an output, return OUTPUT."
+version; if SPEC does not specify an output, return OUTPUT.
+
+When OUTPUT is false and SPEC does not specify any output, return #f as the
+output."
(let-values (((name version sub-drv)
(package-specification->name+version+output spec output)))
(match (%find-package spec name version)
(#f
(values #f #f))
(package
- (if (member sub-drv (package-outputs package))
+ (if (or (and (not output) (not sub-drv))
+ (member sub-drv (package-outputs package)))
(values package sub-drv)
(leave (G_ "package `~a' lacks output `~a'~%")
(package-full-name package)