4 # Just run this script in your rpm/packages/rpm-build-tools directory with
5 # no arguments to release new version of rpm-build-tools.
6 # Run "update.sh clean" to clean all local modifications.
9 # shebang is /bin/ksh, because arrays are non-posix bash/ksh extension.
12 >&2 printf '*** '${1:+"$@\n"}
17 printf ' '${1:+"$@\n"}
20 [ -f "/etc/shrc.d/rpm-build.sh" ] || die "Install rpm-build-macros package"
21 . /etc/shrc.d/rpm-build.sh
27 src[4]=rpm-build-tools.spec
39 if [ "$1" = "clean" ]; then
46 # Checkout on involved files and check for local modifications.
50 msg "Checking out packages/rpm-build-tools/${dst[$I]} file."
51 rs=$(cvs up ${dst[$I]})
53 "M "*) die "You have local modifications in packages/rpm-build-tools/${dst[$I]} file.\nCommit it first." ;;
58 msg "Checking out packages/${src[$I]} file."
59 rs=$(cvs up ${src[$I]})
61 "M "*) die "You have local modifications in packages/${src[$I]} file.\nCommit it first." ;;
66 # Check working revisions of src files
69 msg "Checking revisions."
71 rev[$I]=$(cvs stat ${src[$I]} \
72 | sed -ne 's/^[[:blank:]]*Working revision:[[:blank:]]*\([[:digit:]]\.[[:digit:]]\+\).*/\1/p')
78 # Check wich dst files need updating, update them and prepare msglog
82 msg "Checking wich files need update."
84 if [ "$(diff -I'$Id[:] ' -I'$Revision[:] ' ../${src[$I]} ${dst[$I]})" ]; then
85 cat ../${src[$I]} > ${dst[$I]}
86 LOG="$LOG- ${dst[$I]} up to ${rev[$I]}\n"
90 [ "$LOG" ] || die "Nothing to update!"
92 minor_ver=$(sed -n 's/^\Version:.*\.\([[:digit:]]\+\)/\1/p' rpm-build-tools.spec)
93 minor_ver=$(($minor_ver + 1))
94 sed -i 's/^\(Version:.*\.\)\([[:digit:]]\+\)$/\1'$minor_ver'/' rpm-build-tools.spec
95 sed -i 's/^Release:.*$/Release: 1/' rpm-build-tools.spec
96 ver=$(sed -n 's/^\Version:[[:blank:]]\(.*\)$/\1/p' rpm-build-tools.spec)
97 LOG="- up to $ver\n$LOG"
100 # Show changes and ask user for confirmation.
103 cvs di -u ${dst[@]} | diffcol | ${PAGER:-'less -r'}
105 printf "Commit log:\n$LOG\nCommit (Yes, No)? "
109 cvs ci -m "$(printf "$LOG")" ${dst[@]} ;;