[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#57460] [PATCH 15/20] refresh: Allow updating to a specific version
From: |
Hartmut Goebel |
Subject: |
[bug#57460] [PATCH 15/20] refresh: Allow updating to a specific version (script) |
Date: |
Sun, 28 Aug 2022 15:18:41 +0200 |
* guix/scripts/refresh.scm(options->packages)[args-packages]: Handle version
specification in package name arguments.
(update-package): Add keyword-argument 'version' and pass it on to called
functions.
(guix-refresh): When updating, pass the specified version (if any) to
update-package.
[package-list-without-versions, package-list-with-versions]: New functions.
---
guix/scripts/refresh.scm | 40 +++++++++++++++++++++++++++++-----------
1 file changed, 29 insertions(+), 11 deletions(-)
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 14329751f8..441e71a6e4 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -9,6 +9,7 @@
;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -224,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))
@@ -298,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
@@ -307,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
@@ -523,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))
@@ -540,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)
@@ -558,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))))))))))
--
2.30.4
- [bug#57460] [PATCH 04/20] import: sourceforge: Issue error-message if version is given., (continued)
- [bug#57460] [PATCH 04/20] import: sourceforge: Issue error-message if version is given., Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 03/20] updaters: Issue error-message if version is given:, Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 05/20] refresh: Allow updating to a specific version (gnu-maintenance), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 06/20] refresh: Allow updating to a specific version (crate), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 07/20] refresh: Allow updating to a specific version (egg), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 10/20] refresh: Allow updating to a specific version (gnome), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 11/20] refresh: Allow updating to a specific version (hexpm), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 12/20] refresh: Allow updating to a specific version (kde), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 14/20] refresh: Allow updating to a specific version (pypi), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 15/20] refresh: Allow updating to a specific version (script),
Hartmut Goebel <=
- [bug#57460] [PATCH 09/20] refresh: Allow updating to a specific version (github), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 08/20] refresh: Allow updating to a specific version (git), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 13/20] refresh: Allow updating to a specific version (launchpad), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 16/20] refresh: Allow updating to a specific version (upstream), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 17/20] refresh: Allow updating to a specific version (documentation), Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 18/20] TEMP REMOVE import: git: Restrict to non-github origins., Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 19/20] TEMP REMOVE upstream: Output names of importers tried., Hartmut Goebel, 2022/08/28
- [bug#57460] [PATCH 20/20] TEMP REMOVE Add test-script for refesh-with-version, Hartmut Goebel, 2022/08/28