refresh: Sort update specs by package location.
Fixes <https://issues.guix.gnu.org/64358>. * guix/scripts/refresh.scm (guix-refresh): Sort update specs by location from bottom to top before updating packages.
This commit is contained in:
parent
4a027d2b0e
commit
b43841c124
1 changed files with 22 additions and 11 deletions
|
@ -6,7 +6,7 @@
|
||||||
;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
|
;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
|
||||||
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||||
;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
|
;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
|
||||||
;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2019, 2023 Ricardo Wurmus <rekado@elephly.net>
|
||||||
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
|
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
|
||||||
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
|
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
|
||||||
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
|
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
|
||||||
|
@ -589,6 +589,17 @@ all are dependent packages: ~{~a~^ ~}~%")
|
||||||
(or (assoc-ref opts 'keyring)
|
(or (assoc-ref opts 'keyring)
|
||||||
(string-append (config-directory)
|
(string-append (config-directory)
|
||||||
"/upstream/trustedkeys.kbx"))))
|
"/upstream/trustedkeys.kbx"))))
|
||||||
|
(let* ((spec-line
|
||||||
|
(compose location->string
|
||||||
|
package-location
|
||||||
|
update-spec-package))
|
||||||
|
;; Sort the specs so that we update packages from the
|
||||||
|
;; bottom of the file to the top. This way we can be
|
||||||
|
;; sure that the package locations are always correct
|
||||||
|
;; and never shifted due to previous edits.
|
||||||
|
(sorted-update-specs
|
||||||
|
(sort update-specs
|
||||||
|
(lambda (a b) (string> (spec-line a) (spec-line b))))))
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (update)
|
(lambda (update)
|
||||||
(update-package store
|
(update-package store
|
||||||
|
@ -598,7 +609,7 @@ all are dependent packages: ~{~a~^ ~}~%")
|
||||||
#:key-server (%openpgp-key-server)
|
#:key-server (%openpgp-key-server)
|
||||||
#:key-download key-download
|
#:key-download key-download
|
||||||
#:warn? warn?))
|
#:warn? warn?))
|
||||||
update-specs)
|
sorted-update-specs))
|
||||||
(return #t)))
|
(return #t)))
|
||||||
(else
|
(else
|
||||||
(for-each (cut check-for-package-update <> updaters
|
(for-each (cut check-for-package-update <> updaters
|
||||||
|
|
Reference in a new issue