pld-ftp-admin: wwwbin/consistency-check.sh show src.rpm package name in rep...

glen glen at pld-linux.org
Wed Aug 1 17:28:39 CEST 2012


Author: glen                         Date: Wed Aug  1 15:28:39 2012 GMT
Module: pld-ftp-admin                 Tag: HEAD
---- Log message:
show src.rpm package name in reports; very hackish due poldek bugs/missing features

---- Files affected:
pld-ftp-admin/wwwbin:
   consistency-check.sh (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: pld-ftp-admin/wwwbin/consistency-check.sh
diff -u pld-ftp-admin/wwwbin/consistency-check.sh:1.2 pld-ftp-admin/wwwbin/consistency-check.sh:1.3
--- pld-ftp-admin/wwwbin/consistency-check.sh:1.2	Wed Aug  1 14:39:05 2012
+++ pld-ftp-admin/wwwbin/consistency-check.sh	Wed Aug  1 17:28:34 2012
@@ -8,6 +8,7 @@
 	grep -v "/eclipse/"
 }
 
+# group errors by same error kind
 group_deps() {
 	local t=$(mktemp)
 	cat > $t
@@ -17,6 +18,66 @@
 	rm -f $t
 }
 
+# convert pkg name to src.rpm name
+# uses poldek
+# TODO: simplify when these bugs get a solution:
+# https://bugs.launchpad.net/poldek/+bug/1031762
+# https://bugs.launchpad.net/poldek/+bug/1031767
+pkg2src() {
+	local t=$(mktemp)
+	local t1=$(mktemp)
+	local t2=$(mktemp)
+	local t3=$(mktemp)
+
+	# save input
+	cat > $t
+
+	# error: arcconf-7.0.18786-1: req libstdc++.so.5()(64bit) not found
+	# need to include arch as '*', due this bug: https://bugs.launchpad.net/poldek/+bug/1031762
+	sed -ne 's/error: \(.*\): req .* not found/\1/p' $t | sort -u > $t1
+
+	# poldek:/all-avail> ls -s arcconf-7.0.18786-1.*
+	# arcconf-7.0.18786-1.x86_64     arcconf-7.0.18786-1.src.rpm
+	#poldek --cmd < $t > $t2
+	# poldek is an ass, it doesn't allow stdout to be redirected: "error: not a tty"
+	# hack around with script(1) by capturing whole ls output
+	# https://bugs.launchpad.net/poldek/+bug/1031767
+	if [ ! -s $t2 ]; then
+		local args=$*
+		echo 'ls -s' | script $t2 -f -c "poldek -q -Q --noignore ${args%-O*}" >/dev/null 2>&1
+
+		# now poll until poldek command runs in this tty
+		local stat lstat tty=$(tty < /proc/self/fd/2)
+		while :; do
+			stat=$(stat -c %Y $t2)
+			if [ -s $t2 ]; then
+				# break if stat and last stat are same
+				if [ "$stat" = "$lstat" ]; then
+					break
+				fi
+			fi
+			lstat=$stat
+			sleep 3
+		done
+		killall -v script 2>/dev/null
+		sed -i -e 's,poldek:/all-avail> ,,' $t2
+	fi
+
+	# create N-V-R -> N list
+	local pkg error message srpm
+	while read pkg; do
+		sed -rne "s/^($pkg)\.(x86_64|i686|noarch)(.+)-[^-]+-[^-]+\.src\.rpm$/\1\t\3/p" $t2
+	done < $t1 > $t3
+
+	while read error pkg message; do
+		# error: arcconf-7.0.18786-1: req libstdc++.so.5()(64bit) not found
+		srpm=$(awk -vpkg="${pkg%:}" '$1 == pkg {printf("%s.spec", $2)}' $t3)
+		echo "$error [$srpm] $pkg $message"
+	done < $t
+
+	rm -f $t $t1 $t2 $t3
+}
+
 gen_list() {
 	date
 	/usr/bin/poldek -O "auto directory dependencies = yes" \
@@ -35,11 +96,11 @@
 	--ignore "hal-libs" \
 	--ignore "quicktime4linux*" \
 	--ignore "compat-libstdc++-*" \
-	--verify=deps -Q "$@" | filter_deps | group_deps | sort
+	--verify=deps -Q "$@" | filter_deps | group_deps | sort | pkg2src "$@"
 }
 
 gen_list_uniq() {
-	gen_list -O "unique package names = yes" "$@"
+	gen_list "$@" -O"unique package names = yes"
 }
 
 t=$(mktemp)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/pld-ftp-admin/wwwbin/consistency-check.sh?r1=1.2&r2=1.3



More information about the pld-cvs-commit mailing list