unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] package: allow users to upgrade the whole system by not providing a regexp.
@ 2013-04-15 21:27 Cyril Roelandt
  2013-04-15 21:50 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Cyril Roelandt @ 2013-04-15 21:27 UTC (permalink / raw)
  To: bug-guix

'guix package --upgrade' is now the same as "guix package --upgrade=''".
---
Hi!

On #guix, we discussed the idea that "--upgrade" should not always require an
argument. When upgrading the whole system, "package --upgrade" feels natural,
maybe even more than "package --upgrade=''".

Here is a patch that implements that. I'm not sure that it is a very beautiful
piece of Guile code; comment are welcome!

Cyril.


 guix/scripts/package.scm |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index ac99d16..8d666b9 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -328,7 +328,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
   (display (_ "
   -r, --remove=PACKAGE   remove PACKAGE"))
   (display (_ "
-  -u, --upgrade=REGEXP   upgrade all the installed packages matching REGEXP"))
+  -u, --upgrade[=REGEXP] upgrade all the installed packages matching REGEXP"))
   (display (_ "
       --roll-back        roll back to the previous generation"))
   (newline)
@@ -379,7 +379,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
         (option '(#\r "remove") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'remove arg result)))
-        (option '(#\u "upgrade") #t #f
+        (option '(#\u "upgrade") #f #f
                 (lambda (opt name arg result)
                   (alist-cons 'upgrade arg result)))
         (option '("roll-back") #f #f
@@ -602,7 +602,9 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
         (let* ((installed (manifest-packages (profile-manifest profile)))
                (upgrade-regexps (filter-map (match-lambda
                                              (('upgrade . regexp)
-                                              (make-regexp regexp))
+                                              (if regexp
+                                               (make-regexp regexp)
+                                               (make-regexp "")))
                                              (_ #f))
                                             opts))
                (upgrade  (if (null? upgrade-regexps)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] package: allow users to upgrade the whole system by not providing a regexp.
  2013-04-15 21:27 [PATCH] package: allow users to upgrade the whole system by not providing a regexp Cyril Roelandt
@ 2013-04-15 21:50 ` Ludovic Courtès
  2013-04-15 22:17   ` Cyril Roelandt
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2013-04-15 21:50 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: bug-guix

Cyril Roelandt <tipecaml@gmail.com> skribis:

> 'guix package --upgrade' is now the same as "guix package --upgrade=''".

[...]

> -        (option '(#\u "upgrade") #t #f
> +        (option '(#\u "upgrade") #f #f

Should be #f #t (the first one is ‘required?’, the second one is
‘optional?’, see SRFI-37.)

> @@ -602,7 +602,9 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
>          (let* ((installed (manifest-packages (profile-manifest profile)))
>                 (upgrade-regexps (filter-map (match-lambda
>                                               (('upgrade . regexp)
> -                                              (make-regexp regexp))
> +                                              (if regexp
> +                                               (make-regexp regexp)
> +                                               (make-regexp "")))

Rather: (make-regexp (or regexp "")).

Could you also update the manual?

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] package: allow users to upgrade the whole system by not providing a regexp.
  2013-04-15 21:50 ` Ludovic Courtès
@ 2013-04-15 22:17   ` Cyril Roelandt
  2013-04-16 18:57     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Cyril Roelandt @ 2013-04-15 22:17 UTC (permalink / raw)
  To: bug-guix

'guix package --upgrade' is now the same as "guix package --upgrade=''".
---
 doc/guix.texi            |    7 ++++---
 guix/scripts/package.scm |    6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index c91bc20..d69b7d0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -537,9 +537,10 @@ multiple-output package.
 @itemx -r @var{package}
 Remove @var{package}.
 
-@item --upgrade=@var{regexp}
-@itemx -u @var{regexp}
-Upgrade all the installed packages matching @var{regexp}.
+@item --upgrade[=@var{regexp}]
+@itemx -u [@var{regexp}]
+Upgrade all the installed packages. When @var{regexp} is specified, upgrade only
+installed packages whose name matches @var{regexp}.
 
 Note that this upgrades package to the latest version of packages found
 in the distribution currently installed.  To update your distribution,
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index ac99d16..5b340c6 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -328,7 +328,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
   (display (_ "
   -r, --remove=PACKAGE   remove PACKAGE"))
   (display (_ "
-  -u, --upgrade=REGEXP   upgrade all the installed packages matching REGEXP"))
+  -u, --upgrade[=REGEXP] upgrade all the installed packages matching REGEXP"))
   (display (_ "
       --roll-back        roll back to the previous generation"))
   (newline)
@@ -379,7 +379,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
         (option '(#\r "remove") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'remove arg result)))
-        (option '(#\u "upgrade") #t #f
+        (option '(#\u "upgrade") #f #t
                 (lambda (opt name arg result)
                   (alist-cons 'upgrade arg result)))
         (option '("roll-back") #f #f
@@ -602,7 +602,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
         (let* ((installed (manifest-packages (profile-manifest profile)))
                (upgrade-regexps (filter-map (match-lambda
                                              (('upgrade . regexp)
-                                              (make-regexp regexp))
+                                              (make-regexp (or regexp "")))
                                              (_ #f))
                                             opts))
                (upgrade  (if (null? upgrade-regexps)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] package: allow users to upgrade the whole system by not providing a regexp.
  2013-04-15 22:17   ` Cyril Roelandt
@ 2013-04-16 18:57     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2013-04-16 18:57 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: bug-guix

Cyril Roelandt <tipecaml@gmail.com> skribis:

> 'guix package --upgrade' is now the same as "guix package --upgrade=''".

Please add ChangeLog-style entries in the commit log.

> +@itemx -u [@var{regexp}]
> +Upgrade all the installed packages. When @var{regexp} is specified, upgrade only

Two spaces after period.

OK to push after fixing these.

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-16 18:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-15 21:27 [PATCH] package: allow users to upgrade the whole system by not providing a regexp Cyril Roelandt
2013-04-15 21:50 ` Ludovic Courtès
2013-04-15 22:17   ` Cyril Roelandt
2013-04-16 18:57     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).