Skip to content

Commit 4872533

Browse files
author
David Sommerseth
committed
Added utility to simply change the version number
This script will update all needed files at once
1 parent 2a5a2f6 commit 4872533

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

utils/set_version

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/sh
2+
3+
if [ $# != 1 ]; then
4+
echo "Usage: $0 <new version number>"
5+
exit 1
6+
fi
7+
8+
if [ ! -d ./src -a ! -f redhat.spec ]; then
9+
echo "Cannot find the ./src directory or the ./redhat.spec file"
10+
echo "Are you in the project root directory?"
11+
exit 2
12+
fi
13+
14+
NEW_VERSION=$1
15+
OLD_VERSION=$(cd src;python -c "from setup_common import *; print get_version();")
16+
17+
cat <<EOF
18+
19+
**
20+
** Changing version number
21+
**
22+
23+
Are you sure you want to change the version number?
24+
25+
From: ${OLD_VERSION}
26+
To: ${NEW_VERSION}
27+
28+
EOF
29+
echo -n " Please confirm: (yes/no) "
30+
read conf
31+
32+
case $conf in
33+
yes|YES)
34+
echo
35+
echo " ** Updating src/version.h"
36+
printf ",s/^#define VERSION \".*\"/#define VERSION \"${NEW_VERSION}\"/\nw\n" | ed src/version.h 2>/dev/null
37+
38+
echo " ** Updating redhat.spec"
39+
printf ",s/^Version: .*/Version: ${NEW_VERSION}/\nw\n" | ed redhat.spec 2>/dev/null
40+
41+
echo
42+
echo " ** git add src/version.h redhat.spec"
43+
git add src/version.h redhat.spec
44+
echo
45+
;;
46+
*)
47+
echo
48+
echo
49+
echo " ** Not confirmed. Aborting."
50+
echo
51+
;;
52+
esac
53+

0 commit comments

Comments
 (0)