exit 1
fi
+if [ ! -x "$PWD/civim" ]; then
+ echo "civim missing"
+ exit 1
+fi
+
diffcol()
{
# vim like diff colourization
' "$@"
}
-cvs -z9 diff -u $SPECFILE | diffcol
+pause()
+{
+ echo "$*"
+ echo -n "[Press ENTER to continue, ^C to abort] "
+ read ans
+}
-echo -n "Proceed ? "
-read ans
+cvs -z9 diff -u $SPECFILE | diffcol
-if [ "$ans" != "y" ]; then
- exit
-fi
+pause "Proceed ?"
sed '/^# AUTO: /d' -i "$SPEC"
SIMPLE_DIFF="$(cvs -z9 diff "$SPEC")"
echo "$diff" | diffcol
-ver=$(echo "$diff" | awk '/^\+Version/ { ver = $2 } /^\+%define[ \t]+[_a-zA-Z0-9]*ver/ { ver = $3 }
- END { print ver }')
-rel=$(echo "$diff" | awk '/^\+Release/ { rel = $2 } /^\+%define[ \t]+_?rel/ { rel = $3 }
- END { print rel }')
-
-add=$(echo "$diff" | awk '/^\+BuildRequires/ { add[ $2 ] = 1; }; /^-BuildRequires/ { del[ $2 ] = 1; };
+ver=$(echo "$diff" | awk '
+ /^\+Version/ { ver = $2 }
+ /^\+%define[ \t]+[_a-zA-Z0-9]*ver/ { ver = $3 }
+ END { print ver }
+')
+rel=$(echo "$diff" | awk '
+ /^\+Release/ { rel = $2 }
+ /^\+%define[ \t]+_?rel/ { rel = $3 }
+ END { print rel }
+')
+
+add=$(echo "$diff" | awk '
+ function s( n ) { sub(/}/,"",n); return n; }
+ /^\+(%{[a-zA-Z0-9_]+:)?BuildRequires/ { add[ s( $2 ) ] = 1; };
+ /^-(%{[a-zA-Z0-9_]+:)?BuildRequires/ { del[ s( $2 ) ] = 1; };
END { for ( n in add ) { if ( !del[ n ] ) print n; } }' |
- perl -p -e 'chomp; push @a, $_; undef $_; END { print join ", ", sort @a }')
+ perl -p -e 'chomp; push @a, $_; undef $_; END { print join ", ", sort @a }
+')
-del=$(echo "$diff" | awk '/^\+BuildRequires/ { add[ $2 ] = 1; }; /^-BuildRequires/ { del[ $2 ] = 1; };
+del=$(echo "$diff" | awk '
+ function s( n ) { sub(/}/,"",n); return n; }
+ /^\+(%{[a-zA-Z0-9_]+:)?BuildRequires/ { add[ s( $2 ) ] = 1; };
+ /^-(%{[a-zA-Z0-9_]+:)?BuildRequires/ { del[ s( $2 ) ] = 1; };
END { for ( n in del ) { if ( !add[ n ] ) print n; } }' |
- perl -p -e 'chomp; push @a, $_; undef $_; END { print join ", ", sort @a }')
+ perl -p -e 'chomp; push @a, $_; undef $_; END { print join ", ", sort @a }
+')
n="$(echo -e '\nn')"
n="${n%%n}"
echo
echo "Message:"
echo "$msg"
-echo -n "Commit ? "
-read ans
-if [ "$ans" != "y" ]; then
- exit
-fi
+pause "Commit ?"
export COMMIT_MESSAGE="$msg"
export COMMIT_PACKAGES="$SPECFILE"