r13849 - /scripts/qa/packagecheck
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Tue Jan 29 21:37:03 UTC 2008
Author: dmn
Date: Tue Jan 29 21:37:03 2008
New Revision: 13849
URL: http://svn.debian.org/wsvn/?sc=1&rev=13849
Log:
* moved distribution name heuristics in detect_dist()
* changed homepage checks to use detect_dist() when creating Homepage header anew
* added -C parameter, creating debian/watch if -W (or -A) is also given. uses detect_dist()
Modified:
scripts/qa/packagecheck
Modified: scripts/qa/packagecheck
URL: http://svn.debian.org/wsvn/scripts/qa/packagecheck?rev=13849&op=diff
==============================================================================
--- scripts/qa/packagecheck (original)
+++ scripts/qa/packagecheck Tue Jan 29 21:37:03 2008
@@ -33,11 +33,34 @@
echo " -R - debian/rules: _r_mdir /usr/\{lib,share\}/perl5"
echo " only if they exist"
echo " -A - all checks"
+ echo " -C - if -W is given, create debian/watch if it does not"
+ echo " exist"
echo " -h - this help"
echo " -p PKG - test only this one package"
echo " -c - test only the package that is checked out in the"
echo " current working directory"
exit 1
+}
+
+# given source directory, try to find out the cannonical distribution name
+detect_dist() {
+ dir=$1
+ local PERLNAME
+ PERLNAME=''
+ if [ -s $dir/Build.PL ]; then
+ PERLNAME=$(perl -n -e "print if s;^.*module_name.*=>.*['\"[]([a-zA-Z0-9:_-]+)[]'\"].*\$;\$1;" $dir/Build.PL | sed -e 's/::/-/g' | head -n 1)
+ fi
+ if [ -s $dir/Makefile.PL ]; then
+ PERLNAME=$(perl -n -e "print if s;^.*(?:DIST)?NAME.*=>.*['\"[]([a-zA-Z0-9:_-]+)[]'\"].*\$;\$1;" $dir/Makefile.PL | sed -e 's/::/-/g' | head -n 1)
+ fi
+ if [ -s $dir/META.yml ]; then
+ PERLNAME=$(perl -n -e "print if s;^name:.* ([a-zA-Z0-9:_-]+).*\$;\$1;" $dir/META.yml | head -n 1)
+ fi
+ if [ -n "$PERLNAME" ]; then
+ if curl --silent http://search.cpan.org/dist/$PERLNAME/ | grep '<title>.*</title>' | grep --silent $PERLNAME; then
+ echo $PERLNAME
+ fi
+ fi
}
testvcs() {
@@ -88,20 +111,9 @@
# only construct new URL if we don't have a "real one"
if [ -z "$NEWHP" ] || echo "$NEWHP" | grep cpan\.org > /dev/null; then
- # try to construct canonical URL
- if [ -s $dir/Build.PL ]; then
- PERLNAME=$(perl -n -e "print if s;^.*module_name.*=>.*['\"[]([a-zA-Z0-9:_-]+)[]'\"].*\$;\$1;" $dir/Build.PL | sed -e 's/::/-/g' | head -n 1)
- fi
- if [ -s $dir/Makefile.PL ]; then
- PERLNAME=$(perl -n -e "print if s;^.*(?:DIST)?NAME.*=>.*['\"[]([a-zA-Z0-9:_-]+)[]'\"].*\$;\$1;" $dir/Makefile.PL | sed -e 's/::/-/g' | head -n 1)
- fi
- if [ -s $dir/META.yml ]; then
- PERLNAME=$(perl -n -e "print if s;^name:.* ([a-zA-Z0-9:_-]+).*\$;\$1;" $dir/META.yml | head -n 1)
- fi
+ PERLNAME=`detect_dist`
if [ -n "$PERLNAME" ]; then
- if curl --silent http://search.cpan.org/dist/$PERLNAME/ | grep '<title>.*</title>' | grep --silent $PERLNAME; then
- NEWHP="http://search.cpan.org/dist/$PERLNAME/"
- fi
+ NEWHP="http://search.cpan.org/dist/$PERLNAME/"
fi
# get NEWHP from somewhere else? debian/watch? debian/copyright?
@@ -151,6 +163,19 @@
MSG_WATCH="debian/watch: use dist-based URL."
CHANGED=1
fi
+ elif [ ! -e $dir/debian/watch ] && [ -n "$CREATE_WATCH" ]; then
+ echo "$pkg: creating debian/watch"
+ if dist_name=`detect_dist $dir`; then
+ version_re='v?(\d[\d_.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)'
+ echo "version=3" > $dir/debian/watch
+ echo "http://search.cpan.org/dist/$dist_name/ .+/$dist_name-$version_re\$" >> $dir/debian/watch
+ svn add $dir/debian/watch
+
+ MSG_WATCH="added debian/watch"
+ CHANGED=1
+ else
+ echo "ERROR: unable to find distribution name"
+ fi
fi
}
@@ -197,7 +222,7 @@
ONLY_CURDIR=""
-while getopts p:cVHMWRAh O; do
+while getopts p:cVHMWCRAh O; do
case "$O" in
p)
PKG=$OPTARG
@@ -216,6 +241,9 @@
;;
W)
TESTWATCHDIST=1
+ ;;
+ C)
+ CREATE_WATCH=1
;;
R)
TESTRMDIR=1
More information about the Pkg-perl-cvs-commits
mailing list