SPECS: relup.sh - add -t (test) and -i (try to increase rel)

glen glen at pld-linux.org
Mon Nov 5 15:58:46 CET 2007


Author: glen                         Date: Mon Nov  5 14:58:46 2007 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- add -t (test) and -i (try to increase rel)

---- Files affected:
SPECS:
   relup.sh (1.11 -> 1.12) 

---- Diffs:

================================================================
Index: SPECS/relup.sh
diff -u SPECS/relup.sh:1.11 SPECS/relup.sh:1.12
--- SPECS/relup.sh:1.11	Mon Mar 12 00:16:51 2007
+++ SPECS/relup.sh	Mon Nov  5 15:58:41 2007
@@ -29,17 +29,31 @@
 	echo $rel
 }
 
+set_release() {
+	local specfile="$1"
+	local rel="$2"
+	sed -i -e "
+		s/^\(%define[ \t]\+_rel[ \t]\+\).\+/\1$rel/
+	" $specfile
+}
+
 if [ ! -x /usr/bin/getopt ]; then
 	echo >&1 "You need to install util-linux to use relup.sh"
 	exit 1
 fi
 
-t=`getopt -o 'm:' -n $(dirname "$0") -- "$@"` || exit $?
-# Note the quotes around `$TEMP': they are essential!
+t=$(getopt -o 'm:it' -n $(dirname "$0") -- "$@") || exit $?
+# Note the quotes around `$t': they are essential!
 eval set -- "$t"
 
 while true; do
 	case "$1" in
+	-t)
+		test=1
+		;;
+	-i)
+		inc=1
+		;;
 	-m)
 		shift
 		message="${1#- }"
@@ -60,6 +74,13 @@
 for spec in "$@"; do
 	spec=${spec%.spec}.spec
 	rel=$(get_release "$spec")
+	if [ "$inc" = 1 ]; then
+		rel=$(expr $rel + 1)
+		set_release "$spec" $rel
+
+		# refetch release
+		rel=$(get_release "$spec")
+	fi
 	echo "$spec" >> "$tmpd/$rel"
 done
 
@@ -68,6 +89,8 @@
 	rel=$(basename "$file")
 	msg="- rel $rel${message:+ ($message)}"
 	echo cvs ci -m "'$msg'"
-	cvs ci -m "$msg" $files
+	if [ "$test" != 1 ]; then
+		cvs ci -m "$msg" $files
+	fi
 done
 rm -rf $tmpd
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/relup.sh?r1=1.11&r2=1.12&f=u



More information about the pld-cvs-commit mailing list