X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=update.sh;h=662b0b635ca52cf4b2c80504fefbae804602c79d;hb=8510980ad27f394a698dd0eb1d14105549a11ee3;hp=a56334adc232da442f8045170caf03762b26ff8a;hpb=8f234e8bcb7d29c4939d282f3f7c57000c2e5d8b;p=packages%2Frpm-build-tools.git diff --git a/update.sh b/update.sh index a56334a..662b0b6 100644 --- 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