From aa042770da2fe6411089a965ea8b2219a99d3448 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 11 Jan 2017 11:55:51 +0100 Subject: guix package: Fix version and output for 'guix package -i /gnu/store/…'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/utils.scm (package-name->name+version): Add optional 'delimiter' parameter. * guix/scripts/package.scm (store-item->manifest-entry): Pass #\- as the delimiter for 'package-name->name+version'. Use "out" instead of #f for the 'output' field. * tests/guix-package.sh: Add test. --- guix/utils.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'guix/utils.scm') diff --git a/guix/utils.scm b/guix/utils.scm index 06f49daca8..ee06e47fe9 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès ;;; Copyright © 2013, 2014, 2015 Mark H Weaver ;;; Copyright © 2014 Eric Bavier ;;; Copyright © 2014 Ian Denhardt @@ -500,11 +500,13 @@ returned by `config.guess'." ;; cross-building to. (make-parameter #f)) -(define (package-name->name+version spec) +(define* (package-name->name+version spec + #:optional (delimiter #\@)) "Given SPEC, a package name like \"foo@0.9.1b\", return two values: \"foo\" and \"0.9.1b\". When the version part is unavailable, SPEC and #f are -returned. Both parts must not contain any '@'." - (match (string-rindex spec #\@) +returned. Both parts must not contain any '@'. Optionally, DELIMITER can be +a character other than '@'." + (match (string-rindex spec delimiter) (#f (values spec #f)) (idx (values (substring spec 0 idx) (substring spec (1+ idx)))))) -- cgit v1.2.3