diff options
author | Mathieu Lirzin <mthl@gnu.org> | 2016-02-28 23:11:36 +0100 |
---|---|---|
committer | Mathieu Lirzin <mthl@gnu.org> | 2016-03-02 21:41:41 +0100 |
commit | 1b846da8c372bee78851439fd9e72b2499115e5a (patch) | |
tree | 64702b006ce99e7bfd95538152218a63decf3152 /gnu/packages.scm | |
parent | fad155d47ea22c7ffd042ffddd03b0a6babd3b65 (diff) | |
download | guix-1b846da8c372bee78851439fd9e72b2499115e5a.tar.gz |
utils: Use '@' for separating package names and version numbers.
This provides the ability to use numbers in package names. Fixes <http://bugs.gnu.org/19219>. * guix/utils.scm (package-name->name+version): New procedure. * gnu/packages.scm (%find-package): Add a FALLBACK? keyword argument. Use the previous method when no package is found. (specification->package+output, specification->package): Adapt documentation to new syntax. * doc/guix.texi (Invoking guix package, Invoking guix import): Likewise. * guix/ui.scm (package-specification->name+version+output): Likewise. * guix/scripts/import/hackage.scm (show-help): Likewise. * tests/guix-build.sh: Adapt to new syntax. * tests/guix-lint.sh: Likewise. * tests/guix-package.sh: Likewise. * tests/ui.scm ("package-specification->name+version+output"): Likewise. * tests/utils.scm ("package-name->name+version"): Likewise. * NEWS: Mention new syntax.
Diffstat (limited to 'gnu/packages.scm')
-rw-r--r-- | gnu/packages.scm | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm index 9b111eda28..272a7628c1 100644 --- a/gnu/packages.scm +++ b/gnu/packages.scm @@ -282,7 +282,7 @@ return its return value." ;;; Package specification. ;;; -(define (%find-package spec name version) +(define* (%find-package spec name version #:key fallback?) (match (find-best-packages-by-name name version) ((pkg . pkg*) (unless (null? pkg*) @@ -290,15 +290,23 @@ return its return value." (warning (_ "choosing ~a from ~a~%") (package-full-name pkg) (location->string (package-location pkg)))) + (when fallback? + (warning (_ "deprecated NAME-VERSION syntax.~%"))) pkg) (_ (if version (leave (_ "~A: package not found for version ~a~%") name version) - (leave (_ "~A: unknown package~%") name))))) + (or fallback? + ;; XXX: Fallback to the older specification style with an hyphen + ;; between NAME and VERSION, for backward compatibility. + (let ((proc (@ (guix build utils) package-name->name+version))) + (call-with-values (proc name) + (cut %find-package spec <> <> #:fallback? #t))) + (leave (_ "~A: unknown package~%") name)))))) (define (specification->package spec) "Return a package matching SPEC. SPEC may be a package name, or a package -name followed by a hyphen and a version number. If the version number is not +name followed by an at-sign and a version number. If the version number is not present, return the preferred newest version." (let-values (((name version) (package-name->name+version spec))) (%find-package spec name version))) @@ -308,9 +316,9 @@ present, return the preferred newest version." optionally contain a version number and an output name, as in these examples: guile - guile-2.0.9 + guile@2.0.9 guile:debug - guile-2.0.9:debug + 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." |