GNU bug report logs - #26652
[PATCH 0/2] fresh: add -m manifest option.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <m.othacehe <at> gmail.com>

Date: Tue, 25 Apr 2017 12:59:02 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <m.othacehe <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: 26652 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: bug#26652: [PATCH 2/2] scripts: refresh: Add -m manifest option.
Date: Tue, 25 Apr 2017 15:00:24 +0200
* 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.
---
 guix/scripts/refresh.scm | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 4d3c695aa..36e339107 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2014 Eric Bavier <bavier <at> member.fsf.org>
 ;;; Copyright © 2015 Alex Kost <alezost <at> gmail.com>
 ;;; Copyright © 2016 Ben Woodcroft <donttrustben <at> gmail.com>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;;
 ;;; 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 (_ "
@@ -346,6 +353,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.
 ;;;
 
@@ -416,8 +434,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
@@ -438,7 +459,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





This bug report was last modified 7 years and 354 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.