[Qa-jenkins-scm] [jenkins.debian.net] 02/02: bin/find_dpkg_trigger_cycles.sh: make work with set -e

Holger Levsen holger at moszumanska.debian.org
Fri Apr 24 13:50:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 0e3c4a1079de3e6adc8491dd5845d3df703a6805
Author: josch <j.schauer at email.de>
Date:   Fri Apr 24 00:53:07 2015 +0200

    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
---
 bin/find_dpkg_trigger_cycles.sh | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/bin/find_dpkg_trigger_cycles.sh b/bin/find_dpkg_trigger_cycles.sh
index dc2b6ac..2d17b1e 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"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list