1- #! /bin/sh
1+ #! /bin/bash
22
33if [ $# != 1 ]; then
44 echo " Usage: $0 <new version number>"
1414NEW_VERSION=$1
1515OLD_VERSION=$( cd src; python -c " from setup_common import *; print get_version();" )
1616
17+ # Prepare ChangeLog entry for the python-dmidecode.spec file
18+ TSTAMP=" $( date +%a\ %b\ %d\ %Y) "
19+ FNAME=" $( git config user.name) "
20+ EMAIL=" $( git config user.email) "
21+ CHLOG=" $TSTAMP $FNAME <$EMAIL > - ${NEW_VERSION} -1"
22+
23+ # Prepare regexp script to modify python-dmidecode.spec
24+ {
25+ cat << EOF2
26+ ,s/^Version: .*/Version: ${NEW_VERSION} /
27+ ,s/^Release: .*/Release: 1%{?dist}/
28+ ,s/%changelog/%changelog\\
29+ * ${CHLOG} \\
30+ - Update to new release\\
31+ /
32+ w
33+ EOF2
34+ } > .chversion
35+
36+ # Get confirmation of version change
1737cat << EOF
1838
1939 **
@@ -26,6 +46,7 @@ cat <<EOF
2646 To: ${NEW_VERSION}
2747
2848EOF
49+
2950echo -n " Please confirm: (yes/no) "
3051read conf
3152
@@ -35,15 +56,21 @@ case $conf in
3556 echo " ** Updating src/version.h"
3657 printf " ,s/^#define VERSION \" .*\" /#define VERSION \" ${NEW_VERSION} \" /\nw\n" | ed src/version.h 2> /dev/null
3758
38- echo " ** Updating redhat.spec"
39- printf " ,s/^Version: .*/Version: ${NEW_VERSION} /\nw\n" | ed contrib/python-dmidecode.spec 2> /dev/null
40-
59+ echo " ** Updating contrib/python-dmidecode.spec"
60+ cat .chversion | ed contrib/python-dmidecode.spec 2> /dev/null
61+ if [ $? = 0 ]; then
62+ rm -f .chversion
63+ fi
4164 echo
42- echo " ** git add src/version.h redhat .spec"
65+ echo " ** git add src/version.h contrib/python-dmidecode .spec"
4366 git add src/version.h contrib/python-dmidecode.spec
67+ echo " -----------------------------------------------------------------------------------"
4468 git diff --cached
69+ echo " -----------------------------------------------------------------------------------"
4570 echo
46- echo " REMEMBER to commit this change when you have validated the result"
71+ echo " ** **"
72+ echo " ** REMEMBER to COMMIT this change when you have validated the result **"
73+ echo " ** **"
4774 echo
4875 ;;
4976 * )
0 commit comments