Merge pull request #248735 from considerate/considerate/merge-docker

dockerTools: replace --no-clobber with --update=none
This commit is contained in:
Robert Hensing 2023-08-19 17:58:40 +02:00 committed by GitHub
commit 65d41fb588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@
, closureInfo , closureInfo
, coreutils , coreutils
, e2fsprogs , e2fsprogs
, fakechroot , proot
, fakeNss , fakeNss
, fakeroot , fakeroot
, go , go
@ -777,7 +777,7 @@ rec {
fi fi
done done
# Copy all layers from input images to output image directory # Copy all layers from input images to output image directory
cp -R --no-clobber inputs/*/* image/ cp -R --update=none inputs/*/* image/
# Merge repositories objects and manifests # Merge repositories objects and manifests
jq -s add "''${repos[@]}" > repositories jq -s add "''${repos[@]}" > repositories
jq -s add "''${manifests[@]}" > manifest.json jq -s add "''${manifests[@]}" > manifest.json
@ -887,6 +887,13 @@ rec {
}); });
contentsList = if builtins.isList contents then contents else [ contents ]; contentsList = if builtins.isList contents then contents else [ contents ];
bind-paths = builtins.toString (builtins.map (path: "--bind=${path}:${path}!") [
"/dev/"
"/proc/"
"/sys/"
"${builtins.storeDir}/"
"$out/layer.tar"
]);
# We store the customisation layer as a tarball, to make sure that # We store the customisation layer as a tarball, to make sure that
# things like permissions set on 'extraCommands' are not overridden # things like permissions set on 'extraCommands' are not overridden
@ -898,21 +905,14 @@ rec {
nativeBuildInputs = [ nativeBuildInputs = [
fakeroot fakeroot
] ++ optionals enableFakechroot [ ] ++ optionals enableFakechroot [
fakechroot proot
# for chroot
coreutils
# fakechroot needs getopt, which is provided by util-linux
util-linux
]; ];
postBuild = '' postBuild = ''
mv $out old_out mv $out old_out
(cd old_out; eval "$extraCommands" ) (cd old_out; eval "$extraCommands" )
mkdir $out mkdir $out
${optionalString enableFakechroot '' ${optionalString enableFakechroot ''proot -r $PWD/old_out ${bind-paths} --pwd=/ ''}fakeroot bash -c '
export FAKECHROOT_EXCLUDE_PATH=/dev:/proc:/sys:${builtins.storeDir}:$out/layer.tar
''}
${optionalString enableFakechroot ''fakechroot chroot $PWD/old_out ''}fakeroot bash -c '
source $stdenv/setup source $stdenv/setup
${optionalString (!enableFakechroot) ''cd old_out''} ${optionalString (!enableFakechroot) ''cd old_out''}
eval "$fakeRootCommands" eval "$fakeRootCommands"