pld-ftp-admin: wwwbin/consistency-check.sh - more deeper hacks: run poldek ...
glen
glen at pld-linux.org
Wed Aug 1 21:58:49 CEST 2012
Author: glen Date: Wed Aug 1 19:58:49 2012 GMT
Module: pld-ftp-admin Tag: HEAD
---- Log message:
- more deeper hacks: run poldek via tmux to get terminal from cron
---- Files affected:
pld-ftp-admin/wwwbin:
consistency-check.sh (1.3 -> 1.4)
---- Diffs:
================================================================
Index: pld-ftp-admin/wwwbin/consistency-check.sh
diff -u pld-ftp-admin/wwwbin/consistency-check.sh:1.3 pld-ftp-admin/wwwbin/consistency-check.sh:1.4
--- pld-ftp-admin/wwwbin/consistency-check.sh:1.3 Wed Aug 1 17:28:34 2012
+++ pld-ftp-admin/wwwbin/consistency-check.sh Wed Aug 1 21:58:44 2012
@@ -18,6 +18,31 @@
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:
@@ -44,23 +69,15 @@
# 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
+ tmux new-session -d "echo 'ls -s' | $0 poldek -q -Q --noignore ${args%-O*} > $t2"
- # now poll until poldek command runs in this tty
- local stat lstat tty=$(tty < /proc/self/fd/2)
+ # poll until there is output
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
+ break
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
@@ -102,6 +119,12 @@
gen_list_uniq() {
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.3&r2=1.4
More information about the pld-cvs-commit
mailing list