diff options
Diffstat (limited to 'guix/scripts')
-rw-r--r-- | guix/scripts/locate.scm | 31 | ||||
-rw-r--r-- | guix/scripts/refresh.scm | 33 |
2 files changed, 40 insertions, 24 deletions
diff --git a/guix/scripts/locate.scm b/guix/scripts/locate.scm index aeaffa3d34..79af533fd9 100644 --- a/guix/scripts/locate.scm +++ b/guix/scripts/locate.scm @@ -418,19 +418,24 @@ for each package to insert." (() entries) ((profile . rest) - (let* ((manifest (profile-manifest profile)) - (entries visited - (fold2 (lambda (entry lst visited) - (let ((item (manifest-entry-item entry))) - (if (set-contains? visited item) - (values lst visited) - (values (cons entry lst) - (set-insert item - visited))))) - entries - visited - (manifest-transitive-entries manifest)))) - (loop visited rest entries)))))) + (match (false-if-exception (profile-manifest profile)) + (#f + ;; PROFILE's manifest is unreadable for some reason such as an + ;; unsupported version. + (loop visited rest entries)) + (manifest + (let ((entries visited + (fold2 (lambda (entry lst visited) + (let ((item (manifest-entry-item entry))) + (if (set-contains? visited item) + (values lst visited) + (values (cons entry lst) + (set-insert item + visited))))) + entries + visited + (manifest-transitive-entries manifest)))) + (loop visited rest entries)))))))) (define (insert-manifest-entry db entry) "Insert a manifest ENTRY into DB." diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index 9676271542..f5cb18af22 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -6,7 +6,7 @@ ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> ;;; 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 © 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com> @@ -589,16 +589,27 @@ all are dependent packages: ~{~a~^ ~}~%") (or (assoc-ref opts 'keyring) (string-append (config-directory) "/upstream/trustedkeys.kbx")))) - (for-each - (lambda (update) - (update-package store - (update-spec-package update) - (update-spec-version update) - updaters - #:key-server (%openpgp-key-server) - #:key-download key-download - #:warn? warn?)) - update-specs) + (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 + (lambda (update) + (update-package store + (update-spec-package update) + (update-spec-version update) + updaters + #:key-server (%openpgp-key-server) + #:key-download key-download + #:warn? warn?)) + sorted-update-specs)) (return #t))) (else (for-each (cut check-for-package-update <> updaters |