]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - update.sh
- escape some regexp characters in file name, so grep has a chance to find line with...
[packages/rpm-build-tools.git] / update.sh
index a56334adc232da442f8045170caf03762b26ff8a..662b0b635ca52cf4b2c80504fefbae804602c79d 100644 (file)
--- a/update.sh
+++ b/update.sh
@@ -1,7 +1,12 @@
-#!/bin/sh -e
+#!/bin/ksh -e
 
 # Usage:
-#   Just run this script in your rpm/packages/rpm-build-tools directory.
+#   Just run this script in your rpm/packages/rpm-build-tools directory with
+#   no arguments to release new version of rpm-build-tools.
+#   Run "update.sh clean" to clean all local modifications.
+
+# Note:
+#   shebang is /bin/ksh, because arrays are non-posix bash/ksh extension.
 
 die() {
        >&2 printf '*** '${1:+"$@\n"}
@@ -25,6 +30,17 @@ dst[0]=adapter.sh
 dst[1]=${src[1]}
 dst[2]=builder.sh
 dst[3]=${src[3]}
+dst[4]=${src[4]}
+
+#
+# parse args
+#
+
+if [ "$1" = "clean" ]; then
+               rm ${dst[@]}
+               cvs up ${dst[@]}
+               exit 0
+fi
 
 #
 # Checkout on involved files and check for local modifications.
@@ -65,7 +81,7 @@ done
 LOG=""
 msg "Checking wich files need update."
 for I in 0 1 2 3; do
-       if [ "$(diff -q ../${src[$I]} ${dst[$I]})" ]; then
+       if [ "$(diff -I'$Id[:] ' -I'$Revision[:] ' ../${src[$I]} ${dst[$I]})" ]; then
          cat ../${src[$I]} > ${dst[$I]}
                LOG="$LOG- ${dst[$I]} up to ${rev[$I]}\n"
        fi
@@ -84,13 +100,13 @@ LOG="- up to $ver\n$LOG"
 # Show changes and ask user for confirmation.
 #
 
-cvs di -u | diffcol | ${PAGER:-'less -r'}
+cvs di -u ${dst[@]} | diffcol | ${PAGER:-'less -r'}
 
 printf "Commit log:\n$LOG\nCommit (Yes, No)? "
 read ans
 case "$ans" in
        [yY])
-               cvs ci -m "$(printf $LOG)" ${dst[0]} ${dst[1]} ${dst[2]} ${dst[3]} ;;
+               cvs ci -m "$(printf "$LOG")" ${dst[@]} ;;
        *)
                msg ":(" ;;
 esac
This page took 0.07031 seconds and 4 git commands to generate.