diff options
Diffstat (limited to 'guix/scripts')
-rw-r--r-- | guix/scripts/refresh.scm | 49 | ||||
-rw-r--r-- | guix/scripts/shell.scm | 5 | ||||
-rw-r--r-- | guix/scripts/system.scm | 5 |
3 files changed, 45 insertions, 14 deletions
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index 14329751f8..e0b94ce48d 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. ;;; @@ -46,6 +47,7 @@ #:use-module (ice-9 vlist) #:use-module (ice-9 format) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) #:use-module (srfi srfi-37) #:use-module (srfi srfi-71) @@ -181,7 +183,7 @@ specified with `--select'.\n")) (newline) (show-bug-report-information)) -(define (options->packages opts) +(define (options->update-specs opts) "Return the list of packages requested by OPTS, honoring options like '--recursive'." (define core-package? @@ -224,7 +226,7 @@ update would trigger a complete rebuild." (('argument . spec) ;; Take either the specified version or the ;; latest one. - (specification->package spec)) + (update-specification->update-spec spec)) (('expression . exp) (read/eval-package-expression exp)) (_ #f)) @@ -256,6 +258,25 @@ update would trigger a complete rebuild." ;;; +;;; Utilities. +;;; + +(define-record-type <update-spec> + (update-spec package version) + update? + (package update-spec-package) + (version update-spec-version)) + +(define (update-specification->update-spec spec) + "Given SPEC, a package name like \"guile@2.0=2.0.8\", return a <update> +record with two fields: the package to upgrade, and the target version." + (match (string-rindex spec #\=) + (#f (update-spec (specification->package spec) #f)) + (idx (update-spec (specification->package (substring spec 0 idx)) + (substring spec (1+ idx)))))) + + +;;; ;;; Updates. ;;; @@ -298,7 +319,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 +328,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 @@ -540,12 +561,12 @@ all are dependent packages: ~{~a~^ ~}~%") (with-error-handling (with-store store (run-with-store store - (mlet %store-monad ((packages (options->packages opts))) + (mlet %store-monad ((update-specs (options->update-specs opts))) (cond (list-dependent? - (list-dependents packages)) + (list-dependents (map update-spec-package update-specs))) (list-transitive? - (list-transitive packages)) + (list-transitive (map update-spec-package update-specs))) (update? (parameterize ((%openpgp-key-server (or (assoc-ref opts 'key-server) @@ -558,13 +579,17 @@ 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) + (lambda (update) + (update-package store + (update-spec-package update) + (update-spec-version update) + updaters + #:key-download key-download + #:warn? warn?)) + update-specs) (return #t))) (else (for-each (cut check-for-package-update <> updaters #:warn? warn?) - packages) + (map update-spec-package update-specs)) (return #t))))))))) diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm index 2fc1dc942a..64b5c2e8e9 100644 --- a/guix/scripts/shell.scm +++ b/guix/scripts/shell.scm @@ -20,7 +20,8 @@ #:use-module (guix ui) #:use-module ((guix diagnostics) #:select (location)) #:use-module (guix scripts environment) - #:autoload (guix scripts build) (show-build-options-help) + #:autoload (guix scripts build) (show-build-options-help + show-native-build-options-help) #:autoload (guix transformations) (options->transformation transformation-option-key? show-transformation-options-help) @@ -76,6 +77,8 @@ interactive shell in that environment.\n")) (newline) (show-build-options-help) (newline) + (show-native-build-options-help) + (newline) (show-transformation-options-help) (newline) (display (G_ " diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 6482318168..6fd915cb5e 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -842,7 +842,10 @@ static checks." (check-mapped-devices os) (when (zero? (getuid)) (check-file-system-availability (operating-system-file-systems os)) - (check-initrd-modules os))) + (unless (%current-target-system) + ;; Skip the check if the user is making use of --target, as it cannot + ;; be checked against the running kernel. + (check-initrd-modules os)))) (mlet* %store-monad ((sys (system-derivation-for-action image action |