summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjosch <j.schauer@email.de>2015-04-24 00:53:07 +0200
committerHolger Levsen <holger@layer-acht.org>2015-04-24 15:50:11 +0200
commit0e3c4a1079de3e6adc8491dd5845d3df703a6805 (patch)
treef83b984385e6ed119796ae2970c60009ebdc580b
parentba54423bf8131ee1d61e619f8f4e784d5457c1f8 (diff)
downloadjenkins.debian.net-0e3c4a1079de3e6adc8491dd5845d3df703a6805.tar.xz
bin/find_dpkg_trigger_cycles.sh: make work with set -e
- curl is allowed to exit with status 0 or 23 - grep is not allowed to exit with exit status 2
-rwxr-xr-xbin/find_dpkg_trigger_cycles.sh12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/find_dpkg_trigger_cycles.sh b/bin/find_dpkg_trigger_cycles.sh
index dc2b6ac9..2d17b1e3 100755
--- a/bin/find_dpkg_trigger_cycles.sh
+++ b/bin/find_dpkg_trigger_cycles.sh
@@ -171,7 +171,9 @@ curl --retry 3 --retry-delay 10 --globoff "http://binarycontrol.debian.net/?q=&p
| while read pkg url; do
echo "working on $pkg..." >&2
tmpdir=`mktemp -d --tmpdir="$scratch"`
- ( curl --retry 3 --retry-delay 10 --location --silent "$url" || ( echo "curl failed with exit $?">&2; exit 1 ) ) \
+ # curl is allowed to fail with exit status 23 because we want to stop
+ # downloading immediately after control.tar.gz has been extracted
+ ( curl --retry 3 --retry-delay 10 --location --silent "$url" || [ "$?" -eq 23 ] || ( echo "curl failed">&2 && exit 1 ) ) \
| dpkg-deb --ctrl-tarfile /dev/stdin \
| tar -C "$tmpdir" --exclude=./md5sums -x
if [ ! -f "$tmpdir/triggers" ]; then
@@ -180,16 +182,16 @@ curl --retry 3 --retry-delay 10 --globoff "http://binarycontrol.debian.net/?q=&p
fi
# find all triggers that are either interest or interest-await
# and which are file triggers (start with a slash)
- egrep "^\s*interest(-await)?\s+/" "$tmpdir/triggers" | while read line; do
+ egrep "^\s*interest(-await)?\s+/" "$tmpdir/triggers" || [ "$?" -ne 2 ] | while read line; do
echo "$pkg $line"
done >> $DIRECTORY/interested-file
- egrep "^\s*interest(-await)?\s+[^/]" "$tmpdir/triggers" | while read line; do
+ egrep "^\s*interest(-await)?\s+[^/]" "$tmpdir/triggers" || [ "$?" -ne 2 ] | while read line; do
echo "$pkg $line"
done >> $DIRECTORY/interested-explicit
- egrep "^\s*activate(-await)?\s+/" "$tmpdir/triggers" | while read line; do
+ egrep "^\s*activate(-await)?\s+/" "$tmpdir/triggers" || [ "$?" -ne 2 ] | while read line; do
echo "$pkg $line"
done >> $DIRECTORY/activated-file
- egrep "^\s*activate(-await)?\s+[^/]" "$tmpdir/triggers" | while read line; do
+ egrep "^\s*activate(-await)?\s+[^/]" "$tmpdir/triggers" || [ "$?" -ne 2 ] | while read line; do
echo "$pkg $line"
done >> $DIRECTORY/activated-explicit
rm -r "$tmpdir"