diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 6ae3b11e39..1d7a6e198d 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -311,6 +311,9 @@ use '--preserve' instead~%")) (define (options/resolve-packages store opts) "Return OPTS with package specification strings replaced by manifest entries for the corresponding packages." + (define system + (assoc-ref opts 'system)) + (define (manifest-entry=? e1 e2) (and (eq? (manifest-entry-item e1) (manifest-entry-item e2)) (string=? (manifest-entry-output e1) @@ -327,11 +330,11 @@ for the corresponding packages." ((? package? package) (if (eq? mode 'ad-hoc-package) (list (package->manifest-entry* package)) - (manifest-entries (package->development-manifest package)))) + (manifest-entries (package->development-manifest package system)))) (((? package? package) (? string? output)) (if (eq? mode 'ad-hoc-package) (list (package->manifest-entry* package output)) - (manifest-entries (package->development-manifest package)))) + (manifest-entries (package->development-manifest package system)))) ((lst ...) (append-map (cut packages->outputs <> mode) lst)))) @@ -345,7 +348,8 @@ for the corresponding packages." (('package 'package (? string? spec)) (manifest-entries (package->development-manifest - (transform (specification->package+output spec))))) + (transform (specification->package+output spec)) + system))) (('expression mode str) ;; Add all the outputs of the package STR evaluates to. (packages->outputs (read/eval str) mode)) diff --git a/tests/guix-shell.sh b/tests/guix-shell.sh index 2f5fd86809..b2f820bf26 100644 --- a/tests/guix-shell.sh +++ b/tests/guix-shell.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2021-2022 Ludovic Courtès +# Copyright © 2021-2023 Ludovic Courtès # # This file is part of GNU Guix. # @@ -103,6 +103,37 @@ guix shell --bootstrap --pure -D -f "$tmpdir/empty-package.scm" \ guile-bootstrap -- guile --version rm "$tmpdir/empty-package.scm" +# Make sure '--development' honors '--system'. +this_system="$(guile -c '(use-modules (guix utils)) + (display (%current-system))')" +other_system="$(guile -c '(use-modules (guix utils)) + (display (if (string=? "riscv64-linux" (%current-system)) + "x86_64-linux" + "riscv64-linux"))')" +cat > "$tmpdir/some-package.scm" < /dev/null then # Compute the build environment for the initial GNU Make.