build-support/vm: fix unpopulated debsGrouped after structuredAttrs refactor
debsGrouped was a nested array, like `[ [ drv1 drv2 ] [ drv3 ] ... ]`.
that doesn't map to any bash item, so it would live only in the json attrs.
the `for component in "${debsGrouped[@]}"; ...` part of buildCommand
was thus referring to an unset variable... but the default bash behavior
is to treat that as an empty array even with `set -u` so the loop was
just doing nothing.
instead, flatten the array on the nix side. bash gets something like
`("drv1 drv2" "drv3" ...)` and the existing shell code destructures
that as expected.
verify by building a vm (e.g.
`tests.vmTools.buildPatchelfInDebian.diskImage`) and checking the
nix-log before and after for `INSTALLING COMPONENT` messages.
Co-Authored-By: Stefan Frijters <sfrijters@gmail.com>
This commit is contained in:
@@ -731,7 +731,7 @@ let
|
||||
;
|
||||
|
||||
debsFlat = lib.flatten debs;
|
||||
debsGrouped = debs;
|
||||
debsGrouped = map toString debs;
|
||||
|
||||
preVM = createEmptyImage { inherit size fullName; };
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
hello,
|
||||
patchelf,
|
||||
pcmanfm,
|
||||
runCommand,
|
||||
stdenv,
|
||||
vmTools,
|
||||
}:
|
||||
let
|
||||
inherit (vmTools)
|
||||
buildRPM
|
||||
diskImages
|
||||
makeImageTestScript
|
||||
runInLinuxImage
|
||||
@@ -46,6 +46,23 @@ in
|
||||
})
|
||||
);
|
||||
|
||||
# Sanity check to ensure the dpkg --install commands have run
|
||||
checkPerlInstalledInDebian = runInLinuxImage (
|
||||
runCommand "check-perl"
|
||||
{
|
||||
diskImage = diskImages.debian13x86_64;
|
||||
diskImageFormat = "qcow2";
|
||||
memSize = 512;
|
||||
}
|
||||
''
|
||||
echo Check if perl is present
|
||||
perl -v
|
||||
echo Check if perl is installed
|
||||
dpkg -l | grep 'ii *perl'
|
||||
mkdir $out
|
||||
''
|
||||
);
|
||||
|
||||
# RPM-based distros
|
||||
testFedora42Image = makeImageTestScript diskImages.fedora42x86_64;
|
||||
testFedora43Image = makeImageTestScript diskImages.fedora43x86_64;
|
||||
|
||||
Reference in New Issue
Block a user