summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2009-12-14 20:00:11 +0100
committerDavid Sommerseth <davids@redhat.com>2009-12-14 20:00:11 +0100
commit616b584fce9116d34ce7aa3fe0b41ea0033581dc (patch)
tree975174e51f64fb1e18c1908ae91915cc58a08a1c /utils
parent1a576387020480c3b5eb25c4c1d605181df0c315 (diff)
downloadpython-dmidecode-616b584fce9116d34ce7aa3fe0b41ea0033581dc.tar.gz
python-dmidecode-616b584fce9116d34ce7aa3fe0b41ea0033581dc.tar.xz
python-dmidecode-616b584fce9116d34ce7aa3fe0b41ea0033581dc.zip
Updated utils/set_version to be more intelligent with the .spec file
- Reset the Release variable in the .spec file to 1 - Add a changelog entry with the new version
Diffstat (limited to 'utils')
-rwxr-xr-xutils/set_version39
1 files changed, 33 insertions, 6 deletions
diff --git a/utils/set_version b/utils/set_version
index c42f6d6..97c18c9 100755
--- a/utils/set_version
+++ b/utils/set_version
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
if [ $# != 1 ]; then
echo "Usage: $0 <new version number>"
@@ -14,6 +14,26 @@ fi
NEW_VERSION=$1
OLD_VERSION=$(cd src;python -c "from setup_common import *; print get_version();")
+# Prepare ChangeLog entry for the python-dmidecode.spec file
+TSTAMP="$(date +%a\ %b\ %d\ %Y)"
+FNAME="$(git config user.name)"
+EMAIL="$(git config user.email)"
+CHLOG="$TSTAMP $FNAME <$EMAIL> - ${NEW_VERSION}-1"
+
+# Prepare regexp script to modify python-dmidecode.spec
+{
+cat <<EOF2
+,s/^Version: .*/Version: ${NEW_VERSION}/
+,s/^Release: .*/Release: 1%{?dist}/
+,s/%changelog/%changelog\\
+* ${CHLOG}\\
+- Update to new release\\
+/
+w
+EOF2
+} > .chversion
+
+# Get confirmation of version change
cat <<EOF
**
@@ -26,6 +46,7 @@ cat <<EOF
To: ${NEW_VERSION}
EOF
+
echo -n " Please confirm: (yes/no) "
read conf
@@ -35,15 +56,21 @@ case $conf in
echo " ** Updating src/version.h"
printf ",s/^#define VERSION \".*\"/#define VERSION \"${NEW_VERSION}\"/\nw\n" | ed src/version.h 2>/dev/null
- echo " ** Updating redhat.spec"
- printf ",s/^Version: .*/Version: ${NEW_VERSION}/\nw\n" | ed contrib/python-dmidecode.spec 2>/dev/null
-
+ echo " ** Updating contrib/python-dmidecode.spec"
+ cat .chversion | ed contrib/python-dmidecode.spec 2> /dev/null
+ if [ $? = 0 ]; then
+ rm -f .chversion
+ fi
echo
- echo " ** git add src/version.h redhat.spec"
+ echo " ** git add src/version.h contrib/python-dmidecode.spec"
git add src/version.h contrib/python-dmidecode.spec
+ echo "-----------------------------------------------------------------------------------"
git diff --cached
+ echo "-----------------------------------------------------------------------------------"
echo
- echo " REMEMBER to commit this change when you have validated the result"
+ echo " ** **"
+ echo " ** REMEMBER to COMMIT this change when you have validated the result **"
+ echo " ** **"
echo
;;
*)