diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-11-01 16:57:48 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-11-01 23:21:00 +0100 |
commit | 2876b9892583bc1245d77fd10286025cd8433ede (patch) | |
tree | 38cc9dc2cbb116c0ef3c3e742bb1d432b0bef0e4 /guix/scripts | |
parent | cc4ecc2d8869081483feaf47bdcb4a740c7c67f8 (diff) | |
download | gnu-guix-2876b9892583bc1245d77fd10286025cd8433ede.tar gnu-guix-2876b9892583bc1245d77fd10286025cd8433ede.tar.gz |
ui: Factorize package specification parsing.
* guix/ui.scm (package-specification->name+version+output): New
procedure.
* guix/scripts/package.scm (specification->package+output): Use it.
* tests/ui.scm ("package-specification->name+version+output"): New test.
Diffstat (limited to 'guix/scripts')
-rw-r--r-- | guix/scripts/package.scm | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 4dbe2b7b63..941b2cdca7 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -323,13 +323,8 @@ version; if SPEC does not specify an output, return OUTPUT." (package-full-name p) sub-drv))) - (let*-values (((name sub-drv) - (match (string-rindex spec #\:) - (#f (values spec output)) - (colon (values (substring spec 0 colon) - (substring spec (+ 1 colon)))))) - ((name version) - (package-name->name+version name))) + (let-values (((name version sub-drv) + (package-specification->name+version+output spec))) (match (find-best-packages-by-name name version) ((p) (values p (ensure-output p sub-drv))) |