guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: guix package: Add '--do-not-upgrade' option.


From: Mark H. Weaver
Subject: 02/02: guix package: Add '--do-not-upgrade' option.
Date: Tue, 14 Apr 2015 14:44:04 +0000

mhw pushed a commit to branch master
in repository guix.

commit d5f01e48e0810147c4f304a0e5c661e5a61e08ff
Author: Mark H Weaver <address@hidden>
Date:   Thu Mar 26 17:25:09 2015 -0400

    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.
---
 doc/guix.texi            |   12 +++++++++++-
 guix/scripts/package.scm |   20 +++++++++++++++++++-
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 872caa8..1bd2a84 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -947,13 +947,23 @@ and/or output name in addition to the package name.  For 
instance,
 @itemx -u address@hidden @dots{}]
 Upgrade all the installed packages.  If one or more @var{regexp}s are
 specified, upgrade only installed packages whose name matches a
address@hidden
address@hidden  Also see the @code{--do-not-upgrade} option below.
 
 Note that this upgrades package to the latest version of packages found
 in the distribution currently installed.  To update your distribution,
 you should regularly run @command{guix pull} (@pxref{Invoking guix
 pull}).
 
address@hidden address@hidden @dots{}]
+When used together with the @code{--upgrade} option, do @emph{not}
+upgrade any packages whose name matches a @var{regexp}.  For example, to
+upgrade all packages in the current profile except those containing the
+substring ``emacs'':
+
address@hidden
+$ guix package --upgrade . --do-not-upgrade emacs
address@hidden example
+
 @item --roll-back
 Roll back to the previous @dfn{generation} of the profile---i.e., undo
 the last transaction.
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 09ae782..53813c1 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 <address@hidden>
 ;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
-;;; Copyright © 2013 Mark H Weaver <address@hidden>
+;;; Copyright © 2013, 2015 Mark H Weaver <address@hidden>
 ;;; Copyright © 2014 Alex Kost <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -465,6 +465,8 @@ Install, remove, or upgrade PACKAGES in a single 
transaction.\n"))
   (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 (_ "
       --search-paths     display needed environment variable definitions"))
@@ -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."
                     (($ <manifest-entry> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]