guix build: Take ‘--system’ into account together with ‘-S’.

* guix/scripts/build.scm (options->derivations)[compute-derivation]:
Pass ‘system’ to ‘package-source-derivation’.
* tests/guix-build.sh: Test ‘-S’ together with ‘-s’.

Change-Id: If35f116285dd9caaf939221163ad0ba831eea993
This commit is contained in:
Ludovic Courtès 2024-07-18 12:19:34 +02:00
parent c2ba8b9e66
commit 0553c44471
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 7 additions and 3 deletions

View file

@ -678,9 +678,9 @@ (define (compute-derivation obj system)
(package-name p)) (package-name p))
'()) '())
(s (s
(list (package-source-derivation store s))))) (list (package-source-derivation store s system)))))
(proc (proc
(map (cut package-source-derivation store <>) (map (cut package-source-derivation store <> system)
(proc p)))))) (proc p))))))
((? derivation? drv) ((? derivation? drv)
(list drv)) (list drv))

View file

@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU # GNU Guix --- Functional package management for GNU
# Copyright © 2012-2014, 2016-2023 Ludovic Courtès <ludo@gnu.org> # Copyright © 2012-2014, 2016-2024 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2020 Marius Bakke <mbakke@fastmail.com> # Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
# Copyright © 2021 Chris Marusich <cmmarusich@gmail.com> # Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
# #
@ -161,6 +161,10 @@ export GUIX_PACKAGE_PATH
guix build -d -S foo guix build -d -S foo
guix build -d -S foo | grep -e 'foo\.tar\.gz' guix build -d -S foo | grep -e 'foo\.tar\.gz'
# Make sure '-s' has an effect together with '-S'.
test "$(guix build -Sd coreutils -s x86_64-linux)" \
!= "$(guix build -Sd coreutils -s aarch64-linux)"
# 'baz' has a replacement so we should be getting the replacement's source. # 'baz' has a replacement so we should be getting the replacement's source.
(unset GUIX_BUILD_OPTIONS; (unset GUIX_BUILD_OPTIONS;
test "`guix build -d -S baz`" = "`guix build -d -S foo`") test "`guix build -d -S baz`" = "`guix build -d -S foo`")