[m-rev.] commit server

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Sep 20 16:00:48 AEST 2002


On 19-Sep-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> tools/check_patch:

I realized that the name `check_patch' is a bit misleading,
since the script also commits the patch, rather than just
testing it.  `check_and_commit_patch' seemed a bit too
verbose, so I decided to rename this as `submit_patch'.

I've fixed a bug: it wasn't doing `cvs add'
or `cvs remove' for any added/removed files.

I've also added a `--title' option, so that you can
give the patch a title which will be used for the
test sub-directory name and which will be included in
the email response that the script sends you.

The interdiff for these changes (except the renaming)
is below.  I will go ahead and commit it, if it works --
using the script itself to do the commit, of course ;-)

diff -u tools/check_patch tools/check_patch
--- tools/check_patch	19 Sep 2002 08:17:52 -0000
+++ tools/check_patch	19 Sep 2002 15:58:00 -0000
@@ -46,6 +46,9 @@
 
 # Default option settings
 
+# Name of this patch
+title=$$
+
 # User to mail results to
 user=`whoami`
 
@@ -95,7 +98,7 @@
 You must to remove this directory when you have finished with it.
 "
 	echo "$msg" 1>&2
-	echo "$msg" | mail -s "auto-test ($$) failed" $user
+	echo "$msg" | mail -s "auto-test ($title) failed" $user
 	release_lock
 	exit 1
 }
@@ -111,7 +114,7 @@
 You must to remove this directory when you have finished with it.
 "
 	echo "$msg" 1>&2
-	echo "$msg" | mail -s "auto-test ($$) succeeded" $user
+	echo "$msg" | mail -s "auto-test ($title) succeeded" $user
 }
 
 #-----------------------------------------------------------------------------#
@@ -122,6 +125,11 @@
 parse_options() {
     while [ $# -gt 0 ]; do
 	case "$1" in
+	-t|--title)
+		title="$2"; shift ;;
+	-t*)
+		title="` expr $1 : '-t\(.*\)' `"; ;;
+
 	-d|--directory)
 		test_root="$2"; shift ;;
 	-d*)
@@ -181,7 +189,7 @@
     fi
     logmessage=$1
     patchfile=$2
-    test_dir=$test_root/test$$
+    test_dir=$test_root/test_$title
 }
 
 #-----------------------------------------------------------------------------#
@@ -202,6 +210,20 @@
 
 #-----------------------------------------------------------------------------#
 
+do_cvs_add_remove() {
+	comm -13 ../FILES.old ../FILES.new > ../FILES.added   || die "comm"
+	comm -23 ../FILES.old ../FILES.new > ../FILES.removed || die "comm"
+	if [ -s ../FILES.added ]; then
+		cvs add `cat ../FILES.added` || die "cvs add failed"
+	fi
+	if [ -s ../FILES.removed ]; then
+		cvs remove `cat ../FILES.removed` || die "cvs remove failed"
+	fi
+	return 0
+}
+
+#-----------------------------------------------------------------------------#
+
 do_bootchecks() {
 	old_IFS=$IFS
 	IFS=#
@@ -223,20 +245,23 @@
     obtain_lock				|| die "can't obtain lock"
     trap 'die "interrupted"' 1 2 3 13 15
     check_disk_space			|| die "insufficient disk space"
-    mkdir $test_dir			|| die "mkdir $test_root/test$$ failed"
+    mkdir $test_dir			|| die "mkdir $test_dir failed"
+    echo "Testing in directory $test_dir"
     {
 	cp $patchfile $test_dir/PATCH	|| die "error copying $patchfile"
 	cp $logmessage $test_dir/CVSLOG	|| die "error copying $logmessage"
-	cd $test_dir			|| die "cd $test_root/test$$ failed"
+	cd $test_dir			|| die "cd $test_dir failed"
         CVSROOT=$mercury_cvsroot
 	export CVSROOT
 	cvs checkout mercury		|| die "cvs checkout mercury failed"
 	cd mercury			|| die "cd mercury failed"
 	cvs checkout tests		|| die "cvs checkout tests failed"
+	find . | sort > ../FILES.old
 	patch -p0 < ../PATCH		|| die "applying patch failed"
+	find . | sort > ../FILES.new
+	do_cvs_add_remove		|| die "do_cvs_add_remove failed"
 	autoconf			|| die "autoconf failed"
-	sh configure --prefix=$test_root/test$$/install ||
-					   die "configure failed"
+	sh configure --prefix=$test_dir/install || die "configure failed"
 	make				|| die "make failed"
 	do_bootchecks			|| die "do_bootchecks failed"
 	cvs commit -m"`cat ../CVSLOG`"	|| die "cvs commit failed"

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list