From d5f01e48e0810147c4f304a0e5c661e5a61e08ff Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 26 Mar 2015 17:25:09 -0400 Subject: guix package: Add '--do-not-upgrade' option. * guix/scripts/package.scm (%options): Add the '--do-not-upgrade' option. (show-help): Document it. (options->installable): Add 'do-not-upgrade-regexps' variable. Use it in 'packages-to-upgrade'. * doc/guix.texi (Invoking guix package): Document the '--do-not-upgrade' option. --- guix/scripts/package.scm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 09ae782751..53813c14ab 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès ;;; Copyright © 2013 Nikita Karetnikov -;;; Copyright © 2013 Mark H Weaver +;;; Copyright © 2013, 2015 Mark H Weaver ;;; Copyright © 2014 Alex Kost ;;; ;;; This file is part of GNU Guix. @@ -464,6 +464,8 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n")) -r, --remove=PACKAGE remove PACKAGE")) (display (_ " -u, --upgrade[=REGEXP] upgrade all the installed packages matching REGEXP")) + (display (_ " + --do-not-upgrade[=REGEXP] do not upgrade any packages matching REGEXP")) (display (_ " --roll-back roll back to the previous generation")) (display (_ " @@ -543,6 +545,13 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n")) ;; would upgrade everything. (delete '(upgrade . #f) result)) arg-handler)))) + (option '("do-not-upgrade") #f #t + (lambda (opt name arg result arg-handler) + (let arg-handler ((arg arg) (result result)) + (values (if arg + (alist-cons 'do-not-upgrade arg result) + result) + arg-handler)))) (option '("roll-back") #f #f (lambda (opt name arg result arg-handler) (values (alist-cons 'roll-back? #t result) @@ -621,6 +630,13 @@ return the new list of manifest entries." (_ #f)) opts)) + (define do-not-upgrade-regexps + (filter-map (match-lambda + (('do-not-upgrade . regexp) + (make-regexp regexp)) + (_ #f)) + opts)) + (define packages-to-upgrade (match upgrade-regexps (() @@ -630,6 +646,8 @@ return the new list of manifest entries." (($ name version output path _) (and (any (cut regexp-exec <> name) upgrade-regexps) + (not (any (cut regexp-exec <> name) + do-not-upgrade-regexps)) (upgradeable? name version path) (let ((output (or output "out"))) (call-with-values -- cgit v1.2.3