r5866 - /scripts/qa/versioncheck-html

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Thu Jul 19 08:22:55 UTC 2007


Author: dmn
Date: Thu Jul 19 08:22:54 2007
New Revision: 5866

URL: http://svn.debian.org/wsvn/?sc=1&rev=5866
Log:
Replace check for CPAN-hosted modules by parsing modules/01modules.index.html
from a nearby CPAN mirror. Speeds up things great deal.

Many chacks on every stage - extracting the version regex from debian/watch, etc

Use $DIR/watch for the watch file to avoid mktemp on every package

Modified:
    scripts/qa/versioncheck-html

Modified: scripts/qa/versioncheck-html
URL: http://svn.debian.org/wsvn/scripts/qa/versioncheck-html?rev=5866&op=diff
==============================================================================
--- scripts/qa/versioncheck-html (original)
+++ scripts/qa/versioncheck-html Thu Jul 19 08:22:54 2007
@@ -4,6 +4,8 @@
 # Released under the terms of the GNU GPL 2
 
 . $(dirname $0)/commoncheck
+
+set -u
 
 # get basic info
 DIR=$(mktemp -d)
@@ -14,6 +16,7 @@
 
 wget -q -O- http://incoming.debian.org | html2text -nobs -width 255 > $DIR/incoming
 wget -q -O- http://ftp-master.debian.org/new.html | html2text -nobs -width 255 > $DIR/newqueue
+wget -q -O- $CPAN/modules/01modules.index.html | html2text -nobs -width 500 > $DIR/cpan
 
 echo "<html>"
 echo "<body>"
@@ -30,10 +33,27 @@
 		RE=$(svn cat $REPO/$SECTION/${P}/trunk/debian/changelog | grep -m 1 "$P.*unstable;" | perl -pe 's/.*\((.+)\).*/$1/')
 		IN=$(grep "$P.*\.dsc" $DIR/incoming | perl -pe 's/.*_(.+)\.dsc.*/\1/')
 		NE=$(grep $P $DIR/newqueue | perl -pe "s/.*$P\s+([^\s]+)\s+source.*/\1/g")
-		WATCH=$(mktemp -t watch.XXXXXXXXXX)
-		svn cat $REPO/$SECTION/${P}/trunk/debian/watch > $WATCH
+
+		cat /dev/null > /$DIR/watch
+		svn cat $REPO/$SECTION/${P}/trunk/debian/watch > $DIR/watch
 		UPCUR=$(echo $PA | perl -pe 's/^(?:\d:)?(.+)-[^-]+$/\1/')
-		UPNEW=$(uscan --watchfile $WATCH --upstream-version $UPCUR --package $P --report-status | perl -ne 'print if s/Newest version on remote site is (.+),.*/\1/')
+		if [ -s $DIR/watch ]; then
+			if egrep -q '^(ftp|http).+cpan' $DIR/watch; then
+				VER_REGEX=$(egrep '^http|^ftp' $DIR/watch | perl -pe 's{.+/}{}; s/\s.*$//')
+				if [ -n "$VER_REGEX" ]; then
+					UPNEW=$(perl -ne "if(/${VER_REGEX}/){ print \$1; last }" $DIR/cpan)
+					if [ -z "$UPNEW" ]; then
+						UPNEW="CPAN contains no /$VER_REGEX/"
+					fi
+				else
+					UPNEW="Invalid debian/watch"
+				fi
+			else
+				UPNEW=$(uscan --watchfile $DIR/watch --upstream-version $UPCUR --package $P --report-status | perl -ne 'print if s/Newest version on remote site is (.+),.*/\1/')
+			fi
+		else
+			UPNEW="no debian/watch"
+		fi
 
 		if [ "$UPCUR" != "$UPNEW" -o "$RE" != "$PA" -a "$RE" != "$IN" -a "$RE" != "$NE" ]; then
 			echo "<tr>"
@@ -43,14 +63,12 @@
 			echo "<td>${IN:-&nbsp;}</td>"
 			echo "<td>${NE:-&nbsp;}</td>"
 			if [ "$UPCUR" != "$UPNEW" ] ; then 
-				echo "<td>$UPNEW</td>"
+				echo "<td>${UPNEW:-???}</td>"
 			else
 				echo "<td>&nbsp;</td>"
 			fi
 			echo "</tr>"
 		fi
-		
-		rm $WATCH
 		
 	done
 done




More information about the Pkg-perl-cvs-commits mailing list