nix-prefetch-docker: output informational messages to stderr

Informational messages belong on stderr, not on stdout and intermixed
with structured output for programmatic use.

Change-Id: I34d094d04460494e9ec8953db7490f4e2292d959
This commit is contained in:
edef 2020-12-01 16:48:29 +00:00 committed by edef
parent 48d423ee2a
commit de88771a7d

View File

@ -127,7 +127,7 @@ trap "rm -rf \"$tmpPath\"" EXIT
tmpFile="$tmpPath/$(get_name $finalImageName $finalImageTag)" tmpFile="$tmpPath/$(get_name $finalImageName $finalImageTag)"
if test -z "$QUIET"; then if test -z "$QUIET"; then
skopeo --insecure-policy --tmpdir=$TMPDIR --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag" skopeo --insecure-policy --tmpdir=$TMPDIR --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag" >&2
else else
skopeo --insecure-policy --tmpdir=$TMPDIR --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag" > /dev/null skopeo --insecure-policy --tmpdir=$TMPDIR --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag" > /dev/null
fi fi
@ -139,12 +139,12 @@ imageHash=$(nix-hash --flat --type $hashType --base32 "$tmpFile")
finalPath=$(nix-store --add-fixed "$hashType" "$tmpFile") finalPath=$(nix-store --add-fixed "$hashType" "$tmpFile")
if test -z "$QUIET"; then if test -z "$QUIET"; then
echo "-> ImageName: $imageName" echo "-> ImageName: $imageName" >&2
echo "-> ImageDigest: $imageDigest" echo "-> ImageDigest: $imageDigest" >&2
echo "-> FinalImageName: $finalImageName" echo "-> FinalImageName: $finalImageName" >&2
echo "-> FinalImageTag: $finalImageTag" echo "-> FinalImageTag: $finalImageTag" >&2
echo "-> ImagePath: $finalPath" echo "-> ImagePath: $finalPath" >&2
echo "-> ImageHash: $imageHash" echo "-> ImageHash: $imageHash" >&2
fi fi
if [ "$format" == "nix" ]; then if [ "$format" == "nix" ]; then