diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-12-21 22:36:32 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-12-21 22:36:32 +0100 |
commit | 3f26bfc18a70a65443688d7724e5f97c53855c01 (patch) | |
tree | 71c1928fbced3aeb99c2b5a1b9bb2f0a62bdf30b /guix/scripts/package.scm | |
parent | 0820098d1ccf63e3e8b44df67dcb4236b78975c6 (diff) |
Factorize package search between 'guix package' and 'guix build'.
* guix/scripts/package.scm (newest-available-packages): Remove.
(find-best-packages-by-name): Move to...
* gnu/packages.scm (find-best-packages-by-name): ... here.
(find-newest-available-packages): Memoize.
* guix/scripts/build.scm (specification->package): New procedure,
formerly called 'find-package' within 'guix-build'.
(guix-build): Adjust accordingly.
Diffstat (limited to 'guix/scripts/package.scm')
-rw-r--r-- | guix/scripts/package.scm | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 49fa457a9c..8c197a741e 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -292,19 +292,6 @@ return its return value." (format (current-error-port) " interrupted by signal ~a~%" SIGINT) #f)))) -(define newest-available-packages - (memoize find-newest-available-packages)) - -(define (find-best-packages-by-name name version) - "If version is #f, return the list of packages named NAME with the highest -version numbers; otherwise, return the list of packages named NAME and at -VERSION." - (if version - (find-packages-by-name name version) - (match (vhash-assoc name (newest-available-packages)) - ((_ version pkgs ...) pkgs) - (#f '())))) - (define* (specification->package+output spec #:optional (output "out")) "Find the package and output specified by SPEC, or #f and #f; SPEC may optionally contain a version number and an output name, as in these examples: @@ -342,7 +329,7 @@ version; if SPEC does not specify an output, return OUTPUT." "Return #t if there's a version of package NAME newer than CURRENT-VERSION, or if the newest available version is equal to CURRENT-VERSION but would have an output path different than CURRENT-PATH." - (match (vhash-assoc name (newest-available-packages)) + (match (vhash-assoc name (find-newest-available-packages)) ((_ candidate-version pkg . rest) (case (version-compare candidate-version current-version) ((>) #t) |