diff options
author | Chris Marusich <cmmarusich@gmail.com> | 2016-11-01 22:48:11 -0700 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-11-06 18:08:53 +0100 |
commit | 9008debc54aaa4d65444d5cef85df83455d48d7b (patch) | |
tree | 47c3aa03ea611111a9df541d2b824b0ed0767c2f /guix/scripts | |
parent | 3382bfe9ea199086134d90e45e3d759aefed3dcf (diff) | |
download | gnu-guix-9008debc54aaa4d65444d5cef85df83455d48d7b.tar gnu-guix-9008debc54aaa4d65444d5cef85df83455d48d7b.tar.gz |
profiles: Extract a procedure for getting relative generation numbers.
* guix/profiles.scm (relative-generation-spec->number): New procedure.
* guix/scripts/package.scm (switch-generation-action): Use it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/scripts')
-rw-r--r-- | guix/scripts/package.scm | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 70ed0a7ea6..96a22f6fab 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com> ;;; Copyright © 2016 Roel Janssen <roel@gnu.org> ;;; Copyright © 2016 Benz Schenk <benz.schenk@uzh.ch> +;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -782,12 +783,7 @@ processed, #f otherwise." #:key dry-run?) "Switch PROFILE to the generation specified by SPEC." (unless dry-run? - (let* ((number (string->number spec)) - (number (and number - (case (string-ref spec 0) - ((#\+ #\-) - (relative-generation profile number)) - (else number))))) + (let ((number (relative-generation-spec->number profile spec))) (if number (switch-to-generation* profile number) (leave (_ "cannot switch to generation '~a'~%") spec))))) |