pld-ftp-admin: wwwbin/consistency-check.sh - replace tmux hack with xargs +...

baggins baggins at pld-linux.org
Mon Aug 6 14:49:30 CEST 2012


Author: baggins                      Date: Mon Aug  6 12:49:30 2012 GMT
Module: pld-ftp-admin                 Tag: HEAD
---- Log message:
- replace tmux hack with xargs + poldek --cmd one

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

---- Diffs:

================================================================
Index: pld-ftp-admin/wwwbin/consistency-check.sh
diff -u pld-ftp-admin/wwwbin/consistency-check.sh:1.4 pld-ftp-admin/wwwbin/consistency-check.sh:1.5
--- pld-ftp-admin/wwwbin/consistency-check.sh:1.4	Wed Aug  1 21:58:44 2012
+++ pld-ftp-admin/wwwbin/consistency-check.sh	Mon Aug  6 14:49:25 2012
@@ -18,31 +18,6 @@
 	rm -f $t
 }
 
-# hack for tmux server inside pkg2src
-poldek_server() {
-	local t2=$(mktemp)
-	cat | script $t2 -f -c "poldek $*" >/dev/null 2>&1
-
-	# poll until poldek output file is updated
-	local stat lstat
-	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
-
-	cat $t2
-	rm -f $t2
-}
-
 # convert pkg name to src.rpm name
 # uses poldek
 # TODO: simplify when these bugs get a solution:
@@ -59,26 +34,15 @@
 
 	# 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
+	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
+	# hack around with xargs submitting input to 'ls' command
 	# https://bugs.launchpad.net/poldek/+bug/1031767
-	if [ ! -s $t2 ]; then
-		local args=$*
-		tmux new-session -d "echo 'ls -s' | $0 poldek -q -Q --noignore ${args%-O*} > $t2"
-
-		# poll until there is output
-		while :; do
-			if [ -s $t2 ]; then
-				break
-			fi
-			sleep 3
-		done
-	fi
+	xargs --delimiter='\n' --arg-file=$t1 -- /usr/bin/poldek --noignore -Q "$@" --cmd ls -q -s >$t2
 
 	# create N-V-R -> N list
 	local pkg error message srpm
@@ -109,7 +73,7 @@
 	--ignore "opera-plugin32-*" \
 	--ignore "nspluginwrapper-*" \
 	--ignore "mbrola-voice-*" \
-    --ignore "hal" \
+	--ignore "hal" \
 	--ignore "hal-libs" \
 	--ignore "quicktime4linux*" \
 	--ignore "compat-libstdc++-*" \
@@ -117,14 +81,8 @@
 }
 
 gen_list_uniq() {
-	gen_list "$@" -O"unique package names = yes"
+	gen_list -O"unique package names = yes" "$@"
 }
-
-if [ "$1" = "poldek" ]; then
-	shift
-	poldek_server "$@"
-	exit $?
-fi
 
 t=$(mktemp)
 ftpdir=$HOME/ftp
================================================================

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



More information about the pld-cvs-commit mailing list