[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#773253: jenkins: please add script to detect dpkg trigger cycles



Hi,

Quoting Johannes Schauer (2014-12-25 15:58:04)
> Please find attached a git format-patch to use python-arpy instead of dpkg
> until Jessie is released.

and another.

Thanks!

cheers, josch
From 89cc929c8f08ccc6f0666f1aa6600c0da23ce9df Mon Sep 17 00:00:00 2001
From: josch <j.schauer@email.de>
Date: Thu, 25 Dec 2014 18:40:40 +0100
Subject: [PATCH] bin/dpkg_sid_find_trigger_cycles - use temporary directory

---
 bin/find_dpkg_trigger_cycles.sh | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/bin/find_dpkg_trigger_cycles.sh b/bin/find_dpkg_trigger_cycles.sh
index 78b8286..9019ff3 100755
--- a/bin/find_dpkg_trigger_cycles.sh
+++ b/bin/find_dpkg_trigger_cycles.sh
@@ -155,31 +155,31 @@ curl "http://binarycontrol.debian.net/?q=&path=%2Ftriggers%24&format=pkglist"; \
 	| sort \
 	| while read pkg url; do
 	echo "working on $pkg..." >&2
-	mkdir DEBIAN
+	tmpdir=`mktemp`
 	# FIXME: please revert 9280f1c87 and following as soon as Jenkins run Jessie
 	# this is about the next line:
 	curl --retry 2 --location --silent "$url" \
 		| python -c 'exec("import arpy,sys,gzip,bz2,lzma,StringIO\nar=arpy.Archive(fileobj=sys.stdin)\nfor f in ar:\n\tif f.header.name == \"control.tar.gz\":\n\t\tsys.stdout.write(gzip.GzipFile(fileobj=StringIO.StringIO(f.read())).read())\n\t\tbreak\n\telif f.header.name == \"control.tar\":\n\t\tsys.stdout.write(f.read())\n\t\tbreak\n\telif f.header.name == \"control.tar.bz2\":\n\t\tsys.stdout.write(bz2.BZ2File(fileobj=StringIO.StringIO(f.read())).read())\n\t\tbreak\n\telif f.header.name == \"control.tar.xz\":\n\t\tsys.stdout.write(lzma.LZMAFile(fileobj=StringIO.StringIO(f.read())).read())\n\t\tbreak")' \
-		| tar -C "DEBIAN" --exclude=./md5sums -x
-	if [ ! -f DEBIAN/triggers ]; then
-		rm -r DEBIAN
+		| tar -C "$tmpdir" --exclude=./md5sums -x
+	if [ ! -f "$tmpdir/triggers" ]; then
+		rm -r "$tmpdir"
 		continue
 	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+/" DEBIAN/triggers | while read line; do
+	egrep "^\s*interest(-await)?\s+/" "$tmpdir/triggers" | while read line; do
 		echo "$pkg $line"
 	done >> interested-file
-	egrep "^\s*interest(-await)?\s+[^/]" DEBIAN/triggers | while read line; do
+	egrep "^\s*interest(-await)?\s+[^/]" "$tmpdir/triggers" | while read line; do
 		echo "$pkg $line"
 	done >> interested-explicit
-	egrep "^\s*activate(-await)?\s+/" DEBIAN/triggers | while read line; do
+	egrep "^\s*activate(-await)?\s+/" "$tmpdir/triggers" | while read line; do
 		echo "$pkg $line"
 	done >> activated-file
-	egrep "^\s*activate(-await)?\s+[^/]" DEBIAN/triggers | while read line; do
+	egrep "^\s*activate(-await)?\s+[^/]" "$tmpdir/triggers" | while read line; do
 		echo "$pkg $line"
 	done >> activated-explicit
-	rm -r DEBIAN
+	rm -r "$tmpdir"
 done
 
 printf "" > result-file
-- 
2.0.1


Reply to: