summary refs log tree commit diff
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2022-06-24 20:40:57 +0200
committerHartmut Goebel <h.goebel@crazy-compilers.com>2022-06-30 11:31:54 +0200
commit1925fe7a0f20ce4033f26d2731ca28bbe4eb3fc3 (patch)
tree1aa830083784edbb368350d2cf6b864bd6d3c3fe
parenteb5de11e37d45fe21702e623dc26a7946fd0047d (diff)
downloadguix-1925fe7a0f20ce4033f26d2731ca28bbe4eb3fc3.tar.gz
refresh
-rw-r--r--guix/scripts/refresh.scm39
-rw-r--r--guix/upstream.scm1
2 files changed, 29 insertions, 11 deletions
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index ae8fb97b36..441e71a6e4 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -225,7 +225,8 @@ update would trigger a complete rebuild."
                          (('argument . spec)
                           ;; Take either the specified version or the
                           ;; latest one.
-                          (specification->package spec))
+                          (let* ((name version (package-name->name+version spec)))
+                            (list (specification->package name) version)))
                          (('expression . exp)
                           (read/eval-package-expression exp))
                          (_ #f))
@@ -299,7 +300,7 @@ update would trigger a complete rebuild."
            (G_ "no updater for ~a~%")
            (package-name package)))
 
-(define* (update-package store package updaters
+(define* (update-package store package version updaters
                          #:key (key-download 'interactive) warn?)
   "Update the source file that defines PACKAGE with the new version.
 KEY-DOWNLOAD specifies a download policy for missing OpenPGP keys; allowed
@@ -308,7 +309,7 @@ warn about packages that have no matching updater."
   (if (lookup-updater package updaters)
       (let ((version output source
                      (package-update store package updaters
-                                     #:key-download key-download))
+                                     #:key-download key-download #:version version))
             (loc (or (package-field-location package 'version)
                      (package-location package))))
         (when version
@@ -524,6 +525,18 @@ all are dependent packages: ~{~a~^ ~}~%")
       (lists
        (concatenate lists))))
 
+  (define (package-list-without-versions packages)
+    (map (match-lambda
+               ((package version) package)
+               (package package))
+              packages))
+
+  (define (package-list-with-versions packages)
+    (map (match-lambda
+               ((package version) (list package version))
+               (package (list package #f)))
+              packages))
+
   (let* ((opts            (parse-options))
          (update?         (assoc-ref opts 'update?))
          (updaters        (options->updaters opts))
@@ -541,12 +554,13 @@ all are dependent packages: ~{~a~^ ~}~%")
     (with-error-handling
       (with-store store
         (run-with-store store
+          (begin
           (mlet %store-monad ((packages (options->packages opts)))
             (cond
              (list-dependent?
-              (list-dependents packages))
+              (list-dependents (package-list-without-versions packages)))
              (list-transitive?
-              (list-transitive packages))
+              (list-transitive (package-list-without-versions packages)))
              (update?
               (parameterize ((%openpgp-key-server
                               (or (assoc-ref opts 'key-server)
@@ -559,13 +573,16 @@ all are dependent packages: ~{~a~^ ~}~%")
                                   (string-append (config-directory)
                                                  "/upstream/trustedkeys.kbx"))))
                 (for-each
-                 (cut update-package store <> updaters
-                      #:key-download key-download
-                      #:warn? warn?)
-                 packages)
+                 (cut apply
+                      (lambda (package version)
+                        (update-package store package version updaters
+                                        #:key-download key-download
+                                        #:warn? warn?))
+                      <>)
+                 (values (package-list-with-versions packages)))
                 (return #t)))
              (else
               (for-each (cut check-for-package-update <> updaters
                              #:warn? warn?)
-                        packages)
-              (return #t)))))))))
+                        (package-list-without-versions packages))
+              (return #t))))))))))
diff --git a/guix/upstream.scm b/guix/upstream.scm
index dac8153905..fcacd4983a 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2019, 2022 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
 ;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;