unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] refresh: Add '--list-updaters' option.
@ 2015-10-22  8:17 Alex Kost
  2015-10-25 21:46 ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Kost @ 2015-10-22  8:17 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 179 bytes --]

I think this option may be useful.  Also it will be used (in the
upcoming patch) by emacs shell completions (as now --list-checkers is
used to complete "guix lint --checkers=").


[-- Attachment #2: 0001-refresh-Add-list-updaters-option.patch --]
[-- Type: text/x-patch, Size: 2881 bytes --]

From 6d82f6384902e7de837a4dbfc86c524dbfd9145a Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Thu, 22 Oct 2015 10:51:17 +0300
Subject: [PATCH] refresh: Add '--list-updaters' option.

* guix/scripts/refresh.scm (list-updaters-and-exit): New procedure.
  (%options, show-help): Add '--list-updaters' option.
* doc/guix.texi (Invoking guix refresh): Document it.
---
 doc/guix.texi            |  4 ++++
 guix/scripts/refresh.scm | 14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 99c10d8..b94b780 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4305,6 +4305,10 @@ be used when passing @command{guix refresh} one or more package names:
 
 @table @code
 
+@item --list-updaters
+@itemx -L
+List available updaters and exit.
+
 @item --list-dependent
 @itemx -l
 List top-level dependent packages that would need to be rebuilt as a
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 6f7ca4a..3e29c4e 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -69,6 +70,9 @@
         (option '(#\t "type") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'updater (string->symbol arg) result)))
+        (option '(#\L "list-updaters") #f #f
+                (lambda args
+                   (list-updaters-and-exit)))
         (option '(#\l "list-dependent") #f #f
                 (lambda (opt name arg result)
                   (alist-cons 'list-dependent? #t result)))
@@ -112,6 +116,8 @@ specified with `--select'.\n"))
   (display (_ "
   -t, --type=UPDATER     restrict to updates from UPDATER--e.g., 'gnu'"))
   (display (_ "
+  -L, --list-updaters    list available updaters and exit"))
+  (display (_ "
   -l, --list-dependent   list top-level dependent packages that would need to
                          be rebuilt as a result of upgrading PACKAGE..."))
   (newline)
@@ -149,6 +155,14 @@ specified with `--select'.\n"))
           (eq? name (upstream-updater-name updater)))
         %updaters))
 
+(define (list-updaters-and-exit)
+  "Display available updaters and exit."
+  (format #t (_ "Available updaters:~%"))
+  (for-each (lambda (updater)
+              (format #t "- ~a~%" (upstream-updater-name updater)))
+            %updaters)
+  (exit 0))
+
 (define* (update-package store package updaters
                          #:key (key-download 'interactive))
   "Update the source file that defines PACKAGE with the new version.
-- 
2.5.0


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

* Re: [PATCH] refresh: Add '--list-updaters' option.
  2015-10-22  8:17 [PATCH] refresh: Add '--list-updaters' option Alex Kost
@ 2015-10-25 21:46 ` Ludovic Courtès
  2015-10-26 19:28   ` [PATCH] upstream: Add 'description' field to 'upstream-updater' Alex Kost
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2015-10-25 21:46 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> From 6d82f6384902e7de837a4dbfc86c524dbfd9145a Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Thu, 22 Oct 2015 10:51:17 +0300
> Subject: [PATCH] refresh: Add '--list-updaters' option.
>
> * guix/scripts/refresh.scm (list-updaters-and-exit): New procedure.
>   (%options, show-help): Add '--list-updaters' option.
> * doc/guix.texi (Invoking guix refresh): Document it.

[...]

> +@item --list-updaters
> +@itemx -L
> +List available updaters and exit.

Maybe add: “(see @option{--type} below.)”

OK to push with this change!

To make it even more useful, I wonder if we should add a ‘description’
field to updaters.

The best way to do that would probably be by definition
<upstream-updater> with ‘define-record-type*’ (because ‘description’ is
a known keyword for xgettext, as per po/guix/Makevars.)

WDYT?

Ludo’.

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

* [PATCH] upstream: Add 'description' field to 'upstream-updater'.
  2015-10-25 21:46 ` Ludovic Courtès
@ 2015-10-26 19:28   ` Alex Kost
  2015-10-27 17:26     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Kost @ 2015-10-26 19:28 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1361 bytes --]

Ludovic Courtès (2015-10-26 00:46 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> From 6d82f6384902e7de837a4dbfc86c524dbfd9145a Mon Sep 17 00:00:00 2001
>> From: Alex Kost <alezost@gmail.com>
>> Date: Thu, 22 Oct 2015 10:51:17 +0300
>> Subject: [PATCH] refresh: Add '--list-updaters' option.
>>
>> * guix/scripts/refresh.scm (list-updaters-and-exit): New procedure.
>>   (%options, show-help): Add '--list-updaters' option.
>> * doc/guix.texi (Invoking guix refresh): Document it.
>
> [...]
>
>> +@item --list-updaters
>> +@itemx -L
>> +List available updaters and exit.
>
> Maybe add: “(see @option{--type} below.)”

As I put it right after ‘--type’ option, I'll use “above”, not “below”.

> OK to push with this change!

Thanks!  I think I better modify it so that ‘guix lint --list-checkers’
will also display descriptions, and I push it after (with) the attached
patch.

> To make it even more useful, I wonder if we should add a ‘description’
> field to updaters.

I like it!

> The best way to do that would probably be by definition
> <upstream-updater> with ‘define-record-type*’ (because ‘description’ is
> a known keyword for xgettext, as per po/guix/Makevars.)
>
> WDYT?

Great, thanks for the pointers!  The patch is attached (I hope I missed
nothing there).


[-- Attachment #2: 0001-upstream-Add-description-field-to-upstream-updater.patch --]
[-- Type: text/x-patch, Size: 4265 bytes --]

From 19cee5ca983f663117d272382d7063d48e273cd0 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Mon, 26 Oct 2015 21:24:53 +0300
Subject: [PATCH] upstream: Add 'description' field to 'upstream-updater'.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Suggested by Ludovic Courtès <ludo@gnu.org>.

* guix/upstream.scm (<upstream-updater>): Use 'define-record-type*'.
  [description]: New field.
  (lookup-updater): Adjust accordingly.
* guix/gnu-maintenance.scm (%gnu-updater): Likewise.
* guix/import/cran.scm (%cran-updater): Likewise.
* guix/import/elpa.scm (%elpa-updater): Likewise.
---
 guix/gnu-maintenance.scm |  8 +++++---
 guix/import/cran.scm     |  8 +++++---
 guix/import/elpa.scm     |  8 +++++---
 guix/upstream.scm        | 15 +++++++++------
 4 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index 5af1b88..e1455cc 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -413,8 +413,10 @@ for instance, whose releases are now uploaded to elpa.gnu.org."
        (gnu-package? package)))
 
 (define %gnu-updater
-  (upstream-updater 'gnu
-                    non-emacs-gnu-package?
-                    latest-release*))
+  (upstream-updater
+   (name 'gnu)
+   (description "Updater for GNU packages")
+   (pred non-emacs-gnu-package?)
+   (latest latest-release*)))
 
 ;;; gnu-maintenance.scm ends here
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 6284c9e..4b53d5e 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -236,8 +236,10 @@ representation of the package page."
   (string-prefix? "r-" (package-name package)))
 
 (define %cran-updater
-  (upstream-updater 'cran
-                    cran-package?
-                    latest-release))
+  (upstream-updater
+   (name 'cran)
+   (description "Updater for CRAN packages")
+   (pred cran-package?)
+   (latest latest-release)))
 
 ;;; cran.scm ends here
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 37fc2b8..8c10668 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -272,8 +272,10 @@ as \"debbugs\"."
 (define %elpa-updater
   ;; The ELPA updater.  We restrict it to packages hosted on elpa.gnu.org
   ;; because for other repositories, we typically grab the source elsewhere.
-  (upstream-updater 'elpa
-                    package-from-gnu.org?
-                    latest-release))
+  (upstream-updater
+   (name 'elpa)
+   (description "Updater for ELPA packages")
+   (pred package-from-gnu.org?)
+   (latest latest-release)))
 
 ;;; elpa.scm ends here
diff --git a/guix/upstream.scm b/guix/upstream.scm
index 9300113..219ae05 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -45,6 +46,7 @@
             upstream-updater
             upstream-updater?
             upstream-updater-name
+            upstream-updater-description
             upstream-updater-predicate
             upstream-updater-latest
 
@@ -109,18 +111,19 @@ correspond to the same version."
 ;;; Auto-update.
 ;;;
 
-(define-record-type <upstream-updater>
-  (upstream-updater name pred latest)
+(define-record-type* <upstream-updater>
+  upstream-updater make-upstream-updater
   upstream-updater?
-  (name      upstream-updater-name)
-  (pred      upstream-updater-predicate)
-  (latest    upstream-updater-latest))
+  (name        upstream-updater-name)
+  (description upstream-updater-description)
+  (pred        upstream-updater-predicate)
+  (latest      upstream-updater-latest))
 
 (define (lookup-updater package updaters)
   "Return an updater among UPDATERS that matches PACKAGE, or #f if none of
 them matches."
   (any (match-lambda
-         (($ <upstream-updater> _ pred latest)
+         (($ <upstream-updater> _ _ pred latest)
           (and (pred package) latest)))
        updaters))
 
-- 
2.5.0


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

* Re: [PATCH] upstream: Add 'description' field to 'upstream-updater'.
  2015-10-26 19:28   ` [PATCH] upstream: Add 'description' field to 'upstream-updater' Alex Kost
@ 2015-10-27 17:26     ` Ludovic Courtès
  2015-10-27 18:59       ` Alex Kost
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2015-10-27 17:26 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> From 19cee5ca983f663117d272382d7063d48e273cd0 Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Mon, 26 Oct 2015 21:24:53 +0300
> Subject: [PATCH] upstream: Add 'description' field to 'upstream-updater'.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Suggested by Ludovic Courtès <ludo@gnu.org>.
>
> * guix/upstream.scm (<upstream-updater>): Use 'define-record-type*'.
>   [description]: New field.
>   (lookup-updater): Adjust accordingly.
> * guix/gnu-maintenance.scm (%gnu-updater): Likewise.
> * guix/import/cran.scm (%cran-updater): Likewise.
> * guix/import/elpa.scm (%elpa-updater): Likewise.

Could you also add missing files to po/guix/POTFILES.in?

OK with this change, thank you!

Ludo’.

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

* Re: [PATCH] upstream: Add 'description' field to 'upstream-updater'.
  2015-10-27 17:26     ` Ludovic Courtès
@ 2015-10-27 18:59       ` Alex Kost
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Kost @ 2015-10-27 18:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2015-10-27 20:26 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> From 19cee5ca983f663117d272382d7063d48e273cd0 Mon Sep 17 00:00:00 2001
>> From: Alex Kost <alezost@gmail.com>
>> Date: Mon, 26 Oct 2015 21:24:53 +0300
>> Subject: [PATCH] upstream: Add 'description' field to 'upstream-updater'.
>> MIME-Version: 1.0
>> Content-Type: text/plain; charset=UTF-8
>> Content-Transfer-Encoding: 8bit
>>
>> Suggested by Ludovic Courtès <ludo@gnu.org>.
>>
>> * guix/upstream.scm (<upstream-updater>): Use 'define-record-type*'.
>>   [description]: New field.
>>   (lookup-updater): Adjust accordingly.
>> * guix/gnu-maintenance.scm (%gnu-updater): Likewise.
>> * guix/import/cran.scm (%cran-updater): Likewise.
>> * guix/import/elpa.scm (%elpa-updater): Likewise.
>
> Could you also add missing files to po/guix/POTFILES.in?

Sure!  I forgot about it.

> OK with this change, thank you!

Fixed and pushed, thanks!

-- 
Alex

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

end of thread, other threads:[~2015-10-27 19:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22  8:17 [PATCH] refresh: Add '--list-updaters' option Alex Kost
2015-10-25 21:46 ` Ludovic Courtès
2015-10-26 19:28   ` [PATCH] upstream: Add 'description' field to 'upstream-updater' Alex Kost
2015-10-27 17:26     ` Ludovic Courtès
2015-10-27 18:59       ` Alex Kost

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).