[svn-commits] tzafrir: branch 1.4 r3580 - /branches/1.4/build_tools/test_kernel_git

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Dec 29 17:34:16 CST 2007


Author: tzafrir
Date: Sat Dec 29 17:34:16 2007
New Revision: 3580

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3580
Log:
The script now will not require unnecessary parameters: it saves them in 
build_tools/git_test.conf

Modified:
    branches/1.4/build_tools/test_kernel_git

Modified: branches/1.4/build_tools/test_kernel_git
URL: http://svn.digium.com/view/zaptel/branches/1.4/build_tools/test_kernel_git?view=diff&rev=3580&r1=3579&r2=3580
==============================================================================
--- branches/1.4/build_tools/test_kernel_git (original)
+++ branches/1.4/build_tools/test_kernel_git Sat Dec 29 17:34:16 2007
@@ -3,46 +3,57 @@
 set -e
 
 GIT_URL=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
+CONF_FILE=build_tools/git_test.conf
 
 usage() {
-	echo "$0: -k kernel_dir setup"
-	echo "$0: -k kernel_dir test <kernel_version>"
-	echo "$0: -k kernel_dir test-cur <kernel_version>"
+	echo "$0: test building Zaptel vs. kernel from git"
+	echo "Usage:"
+	echo "  $0 checkout <kerneldir>        Pull a kernel version into <kerneldir>"
+	echo "  $0 setver <kernel_version>     Set the kernel version"
+	echo "  $0 test                        test-build"
 }
 
-while getopts 'hk:' arg; do
-	case "$arg" in
-		k) kernel_dir="$OPTARG";;
-		h) usage; exit 0;;
-		*) usage; exit 1;;
-	esac
-done
+# Set a variable in $CONF_FILE
+# The format of CONF_FILE is assumed to be:
+# VAR=value
+# in shell syntax. "value" may be quoted.
+# "value should not contain a '|' character.
+set_var() {
+	var="$1"
+	val="$2"
+	if grep -q "^$var=" $CONF_FILE 2>/dev/null; then
+		sed -i -e "s|^$var=.*|$var=\"$val\"|" $CONF_FILE
+	else
+		echo "$var=\"$value\"" >>$CONF_FILE
+	fi
+}
 
-shift $(( $OPTIND - 1 ))
+if [ -r "$CONF_FILE" ]; then . "$CONF_FILE"; fi
+
+if echo "$CONF_FILE" | grep -qv '^/'; then
+	# make CONF_FILE an absolute path:
+	CONF_FILE="$PWD/$CONF_FILE"
+fi
 
 command="$1"
 
 case "$command" in
-	setup) 
-		# Note: this creates the directory linux-2.6 under
-		# $kernel_dir . You should run 
-		# "-k $kernel_dir/linux-2.6 test SOMEVERSION"
-		cd $kernel_dir
+	checkout) 
+		kernel_dir="$2"
+		cd "$kernel_dir"
 		git clone $GIT_URL
+		set_ver kernel_dir "$kernel_dir/linux-2.6"
 		;;
-	test-cur)
-		ver="$2"
-		make KSRC="$kernel_dir" KVERS=$ver
-		;;
-	test)
-		ver="$2"
-		tag="v$ver"
-		curdir="$PWD"
+	setver)
+		kernel_ver="$2"
+		tag="v$kernel_ver"
 		cd "$kernel_dir"
 		git-checkout $tag .
 		make prepare
-		cd "$curdir"
-		make KSRC="$kernel_dir" KVERS=$ver
+		set_var kernel_ver "$kernel_ver"
+		;;
+	test)
+		make KSRC="$kernel_dir" KVERS=$kernel_ver
 		;;
 	*)
 		echo "$0: no such command $command. Aborting."




More information about the svn-commits mailing list