SPECS: adapter - make it work with specs not in current dir - make...

glen glen at pld-linux.org
Tue Nov 6 15:59:52 CET 2007


Author: glen                         Date: Tue Nov  6 14:59:52 2007 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- make it work with specs not in current dir
- make it work adapter.awk not in current dir

---- Files affected:
SPECS:
   adapter (1.21 -> 1.22) 

---- Diffs:

================================================================
Index: SPECS/adapter
diff -u SPECS/adapter:1.21 SPECS/adapter:1.22
--- SPECS/adapter:1.21	Tue Nov  6 15:56:07 2007
+++ SPECS/adapter	Tue Nov  6 15:59:47 2007
@@ -16,6 +16,7 @@
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 self=$(basename "$0")
+dir=$(dirname "$0")
 usage="Usage: $self [FLAGS] SPECFILE
 
 -s|--no-sort|--skip-sort
@@ -138,24 +139,25 @@
 	else
 		awk=awk
 	fi
-	$awk -f adapter.awk $SPECFILE > $tmpdir/$SPECFILE || exit
+	local diff=$tmpdir/$(basename SPECFILE) || exit
+	$awk -f $dir/adapter.awk $SPECFILE > $diff || exit
 
-	if [ "`diff --brief $SPECFILE $tmpdir/$SPECFILE`" ]; then
-		diff -u $SPECFILE $tmpdir/$SPECFILE > $tmpdir/$SPECFILE.diff
+	if [ "$(diff --brief $SPECFILE $diff)" ]; then
+		diff -u $SPECFILE $diff > $diff.diff
 		if [ -t 1 ]; then
-				diffcol $tmpdir/$SPECFILE.diff | less -r
+				diffcol $diff.diff | less -r
 				while : ; do
 					echo -n "Accept? (Yes, No, Confirm each chunk)? "
 					read ans
 					case "$ans" in
 					[yYoO]) # y0 mama
-						mv -f $tmpdir/$SPECFILE $SPECFILE
+						mv -f $diff $SPECFILE
 						echo "Ok, adapterized."
 						break
 					;;
 					[cC]) # confirm each chunk
-						diff2hunks $tmpdir/$SPECFILE.diff
-						for t in $(ls $tmpdir/$SPECFILE-*.diff); do
+						diff2hunks $diff.diff
+						for t in $(ls $diff-*.diff); do
 								diffcol $t | less -r
 								echo -n "Accept? (Yes, [N]o, Quit)? "
 								read ans
@@ -177,7 +179,7 @@
 					esac
 				done
 		else
-				cat $tmpdir/$SPECFILE.diff
+				cat $diff.diff
 		fi
 	else
 		echo "The SPEC is perfect ;)"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/adapter?r1=1.21&r2=1.22&f=u



More information about the pld-cvs-commit mailing list