]> wimlib.net Git - wimlib/blob - tools/update-version
6a769a29e7b4193d6694aac5c7211f6809dae5b3
[wimlib] / tools / update-version
1 #!/bin/bash
2
3 set -eu
4
5 if [ $# -ne 1 ]; then
6         echo "Usage: $0 NEW_VERS" 1>&2
7         exit 1
8 fi
9
10 oldmonth=$(head -1 doc/man1/wimcapture.1 | cut -d' ' -f4 | tr -d '"')
11 oldyear=$(head -1 doc/man1/wimcapture.1 | cut -d' ' -f5 | tr -d '"')
12 oldver=$(grep 'the library interface of wimlib' include/wimlib.h \
13          | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
14
15 newver=$1
16 newmajor=$(echo "$newver" | cut -d'.' -f1)
17 newminor=$(echo "$newver" | cut -d'.' -f2)
18 newpatch=$(echo "$newver" | cut -d'.' -f3)
19 newmonth=$(date +%B)
20 newyear=$(date +%Y)
21
22 newver="${newmajor}.${newminor}.${newpatch}"
23 pat='This is wimlib version [^[:space:]]\+ ([^[:space:]]\+ [^[:space:]]\+)'
24 sed -i "s/$pat/This is wimlib version $newver ($newmonth $newyear)/" README
25
26 sed -i "s/$oldver/$newver/" configure.ac
27
28 sed -i -e 's/\(#define WIMLIB_MAJOR_VERSION[[:space:]]\+\)[[:digit:]]\+/\1'$newmajor'/' \
29        -e 's/\(#define WIMLIB_MINOR_VERSION[[:space:]]\+\)[[:digit:]]\+/\1'$newminor'/' \
30        -e 's/\(#define WIMLIB_PATCH_VERSION[[:space:]]\+\)[[:digit:]]\+/\1'$newpatch'/' \
31        -e 's/\(the library interface of wimlib \)'$oldver'/\1'$newver'/' \
32           include/wimlib.h
33
34 sed -i -e "1s/$oldmonth $oldyear/$newmonth $newyear/;1s/wimlib $oldver/wimlib $newver/" \
35           doc/man[1-9]/*.[1-9]
36
37 sed -i "1i\\
38 wimlib ($newver-1) unstable; urgency=low\\
39 \\
40   * Update to v$newver\\
41 \\
42  -- Eric Biggers <ebiggers3@gmail.com>  $(date -R)\\
43 " debian/changelog
44
45 sed -i 's/\(Version:[[:space:]]*\)[^[:space:]]\+/\1'"$newver"'/' \
46                 rpm/*.spec