From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5sUu-0000NW-5T for guix-patches@gnu.org; Wed, 03 May 2017 07:31:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5sUp-0008WS-Ru for guix-patches@gnu.org; Wed, 03 May 2017 07:31:08 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:53769) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d5sUp-0008WG-PP for guix-patches@gnu.org; Wed, 03 May 2017 07:31:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d5sUp-0001lU-KI for guix-patches@gnu.org; Wed, 03 May 2017 07:31:03 -0400 Subject: bug#26756: [PATCH 2/2] scripts: refresh: Add -m manifest option. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5sUA-0008JK-Ln for guix-patches@gnu.org; Wed, 03 May 2017 07:30:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5sU9-0008CJ-DR for guix-patches@gnu.org; Wed, 03 May 2017 07:30:22 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:37205) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d5sU9-0008C3-6n for guix-patches@gnu.org; Wed, 03 May 2017 07:30:21 -0400 Received: by mail-wm0-x22b.google.com with SMTP id m123so54061783wma.0 for ; Wed, 03 May 2017 04:30:21 -0700 (PDT) From: Mathieu Othacehe Date: Wed, 3 May 2017 13:29:56 +0200 Message-Id: <20170503112956.6785-3-m.othacehe@gmail.com> In-Reply-To: <20170503112956.6785-1-m.othacehe@gmail.com> References: <20170503112956.6785-1-m.othacehe@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26756@debbugs.gnu.org * guix/scripts/refresh.scm (%options): Add -m option, (show-help): document it, (get-manifest-packages): new procedure, (guix-refresh): use packages from manifest if specified, otherwise keep the previous behaviour. * doc/guix.texi (Invoking guix refresh): document new option. --- doc/guix.texi | 5 +++++ guix/scripts/refresh.scm | 29 ++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 9b2fe3fdb..f04b3cafe 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5759,6 +5759,11 @@ The @code{non-core} subset refers to the remaining packages. It is typically useful in cases where an update of the core packages would be inconvenient. +@item --manifest=@var{file} +@itemx -m @var{file} +Select only packages specified in manifest @var{file}. This is useful to +check if any packages of the user manifest can be updated. + @item --type=@var{updater} @itemx -t @var{updater} Select only packages handled by @var{updater} (may be a comma-separated diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index c0d589af1..9dcb8d126 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2014 Eric Bavier ;;; Copyright © 2015 Alex Kost ;;; Copyright © 2016 Ben Woodcroft +;;; Copyright © 2017 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -27,6 +28,7 @@ #:use-module (guix store) #:use-module (guix utils) #:use-module (guix packages) + #:use-module (guix profiles) #:use-module (guix upstream) #:use-module (guix graph) #:use-module (guix scripts graph) @@ -87,6 +89,9 @@ (option '(#\L "list-updaters") #f #f (lambda args (list-updaters-and-exit))) + (option '(#\m "manifest") #t #f + (lambda (opt name arg result) + (alist-cons 'manifest arg result))) (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) @@ -133,6 +138,8 @@ specified with `--select'.\n")) -s, --select=SUBSET select all the packages in SUBSET, one of `core' or `non-core'")) (display (_ " + -m, --manifest=FILE select all the packages in FILE manifest")) + (display (_ " -t, --type=UPDATER,... restrict to updates from the specified updaters (e.g., 'gnu')")) (display (_ " @@ -350,6 +357,17 @@ dependent packages are rebuilt: ~{~a~^ ~}~%" ;;; +;;; Manifest. +;;; + +(define (get-manifest-packages manifest) + "Return the list of packages in loaded MANIFEST." + (let* ((user-module (make-user-module '((guix profiles) (gnu)))) + (manifest (load* manifest user-module))) + (manifest->packages manifest))) + + +;;; ;;; Entry point. ;;; @@ -420,8 +438,11 @@ update would trigger a complete rebuild." ;; the command line. (warn? (or (assoc-ref opts 'argument) (assoc-ref opts 'expression))) - - (packages + (manifest-packages + (match (assoc-ref opts 'manifest) + ((? string? manifest) (get-manifest-packages manifest)) + (x #f))) + (args-packages (match (filter-map (match-lambda (('argument . spec) ;; Take either the specified version or the @@ -442,7 +463,9 @@ update would trigger a complete rebuild." result)) '()))) (some ; user-specified packages - some)))) + some))) + (packages + (or manifest-packages args-packages))) (with-error-handling (with-store store (run-with-store store -- 2.12.2