r26950 - /scripts/qa/packagecheck

thialme-guest at users.alioth.debian.org thialme-guest at users.alioth.debian.org
Sun Nov 16 18:18:38 UTC 2008


Author: thialme-guest
Date: Sun Nov 16 18:18:35 2008
New Revision: 26950

URL: http://svn.debian.org/wsvn/?sc=1&rev=26950
Log:
+ Use of commands through the CMD_* variables 
+ Added option -R to the *less* command in order to be able to display
  colors with *svn diff*. (CMD_SVN_DIFF="svn diff --diff-cmd=colordiff")
+ Added the sanity_check function in order to prevent the script from
  runnning if:
      - the working directory does not exist
      - the realpath command is not available


Modified:
    scripts/qa/packagecheck

Modified: scripts/qa/packagecheck
URL: http://svn.debian.org/wsvn/scripts/qa/packagecheck?rev=26950&op=diff
==============================================================================
--- scripts/qa/packagecheck (original)
+++ scripts/qa/packagecheck Sun Nov 16 18:18:35 2008
@@ -8,6 +8,9 @@
 # To be run a directory above trunk/
 # (which name can be specified as the first argument)
 
+# List of commands used
+CMD_REALPATH="realpath";
+CMD_SVN_DIFF="svn diff";
 
 #############
 # functions #
@@ -45,6 +48,29 @@
 	exit 1
 }
 
+#
+# Check the environnement to make sure we can work
+#
+# It returns:
+#     0 if everything is fine
+#     1 if an error occured
+#
+sanity_check() {
+
+	local retval=0;
+
+	if [ ! -d "$WORK_DIR" ]; then
+		echo "[*] Error: Could not find working directory: $WORK_DIR !";
+		retval=1;
+
+	elif [ ! -x "`which $CMD_REALPATH 2>/dev/null`" ]; then
+		echo "[*] Error: Command $CMD_REALPATH not found!";
+		retval=1;
+	fi
+
+	return $retval;
+}
+
 # given source directory, try to find out the cannonical distribution name
 detect_dist() {
 	DIR=$1
@@ -68,7 +94,7 @@
 
 testvcs() {
 	DIR=$1
-	PKG=$(basename $(realpath $DIR))
+	PKG=$(basename $($CMD_REALPATH $DIR))
 	# check for and add missing Vcs-Svn field
 	if ! grep ^Vcs-Svn $DIR/debian/control > /dev/null; then
 		echo "$PKG: adding missing Vcs-Svn field"
@@ -104,7 +130,7 @@
 
 testhomepage() {
 	DIR=$1
-	PKG=$(basename $(realpath $DIR))
+	PKG=$(basename $($CMD_REALPATH $DIR))
 	# check for and remove old Homepage from long description
 	OLDHP=$(egrep "^  Homepage: " $DIR/debian/control | egrep -o "http.+")
 	if [ -n "$OLDHP" ] ; then
@@ -142,7 +168,7 @@
 
 testmaintainer() {
 	DIR=$1
-	PKG=$(basename $(realpath $DIR))
+	PKG=$(basename $($CMD_REALPATH $DIR))
 	# get Maintainer, check and change
 	OLDMAINT=$(grep ^Maintainer: $DIR/debian/control | cut -f2- -d" ")
 	if [ "$OLDMAINT" != "Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>" ] ; then
@@ -165,7 +191,7 @@
 
 testwatchdist() {
 	DIR=$1
-	PKG=$(basename $(realpath $DIR))
+	PKG=$(basename $($CMD_REALPATH $DIR))
 	# watchfile
 	if [ -e $DIR/debian/watch ] && ! grep search\.cpan\.org/dist/ $DIR/debian/watch >/dev/null; then
 		echo "$PKG: trying to change URL in debian/watch"
@@ -192,7 +218,7 @@
 
 testrmdir() {
 	DIR=$1
-	PKG=$(basename $(realpath $DIR))
+	PKG=$(basename $($CMD_REALPATH $DIR))
 	# handle rmdir /usr/{share,lib}/perl5
 	if egrep -m 1 -C 1 "(rmdir.*ignore-fail-on-non-empty|rm -r.*usr/(lib|share)(/perl5)?$)" $DIR/debian/rules | perl -pe 's/\n//g' | grep -v "\[ \! -d" > /dev/null ; then
 		ARCH=$(grep -m 1 -h "Architecture:" $DIR/debian/control | awk '{print $2;}')
@@ -224,7 +250,7 @@
 
 testreadmesource() {
 	DIR=$1
-	PKG=$(basename $(realpath $DIR))
+	PKG=$(basename $($CMD_REALPATH $DIR))
 	# add debian/README.source for quilt using packages
 	if grep --silent quilt $DIR/debian/control > /dev/null && [ ! -e $DIR/debian/README.source ] ; then
 		echo "$PKG: adding debian/README.source"
@@ -365,6 +391,9 @@
 	WORK_DIR=$TRUNK
 fi
 
+sanity_check;
+[ "$?" -ne "0" ] && exit 1;
+
 echo "Running svn up $WORK_DIR ..."
 svn up $WORK_DIR
 
@@ -398,7 +427,7 @@
 	read -p "Show svn diff $WORK_DIR (y|N)? " DIFF
 	case $DIFF in
 		y|Y)
-			svn diff $WORK_DIR | less
+			$CMD_SVN_DIFF $WORK_DIR | less -R
 			;;
 		*)
 			;;




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