UBUNTU: [Packaging] actually enforce set -e in dkms-build--nvidia-N

The current code is effectively this:

  set -e; (false; true) || exit "$?"

Due to historical reasons any code inside a pipeline is executed with
`set +e` mode effective, meaning false command doesn't return, the
rest of commands are executed, and the error code from () is set to
the last (usually successful) command.

This is the reason, why my previous buggy behaviour despite generating
errors inside the dkms-build--nvidia-N didn't abort the build, but
happily produced linux-nvidia-objects.deb which contained empty
SHA256SUMS file and broken BUILD CLEAN scripts that did nothing.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Dimitri John Ledkov
2023-02-27 14:49:53 +00:00
committed by Paolo Pisati
parent 8b1d918149
commit 5746790504
+2 -2
View File
@@ -61,7 +61,7 @@ sed -e 's/.*-o *\([^ ]*\) .*/rm -f \1/g' <"$pkgdir/bits/BUILD" >"$pkgdir/bits/C
# rebuild the .ko's, sign them, pull off the signatures and then finally clean
# up again.
(
cd "$pkgdir/bits" || exit 1
cd "$pkgdir/bits"
# Add checksum check.
echo "\$check_only sha256sum -c SHA256SUMS || exit 1" >>"$pkgdir/bits/BUILD"
@@ -110,4 +110,4 @@ sed -e 's/.*-o *\([^ ]*\) .*/rm -f \1/g' <"$pkgdir/bits/BUILD" >"$pkgdir/bits/C
find "$pkgdir" -name \*.sig -prune -o -name SHA256SUMS -prune -o -type f -print | xargs rm -f
find "$pkgdir" -depth -type d -print | xargs rmdir --ignore-fail-on-non-empty
fi
) || exit "$?"
)