blob: c08c8344d20c469c8446422726aa04abd1a12efe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#!/bin/bash
set -e
usage() {
cat <<EOF
Usage: ${0##*/} <new_version>
<new_version> - release version to create in X.Y.Z format
EOF
exit 0
}
fatal() {
printf "Error: %s\n" "$1" >&2
exit 1
}
askyesno() {
local question="$1"
local choice=""
read -p "$question [y/N]? " choice
case "$choice" in
y|Y)
echo "yes"
;;
*)
;;
esac
return 0
}
##### get the command line arguments
[ $# -eq 0 ] && usage
[ $# -eq 1 ] || fatal "Insufficient or too many argumetns"
new_ver="$1"; shift
VER_REGEX="\([0-9]\+.[0-9]\+.[0-9]\+\)"
echo "$new_ver" | grep -q -x "$VER_REGEX" ||
fatal "please, provide new version in X.Y.Z format"
##### parse the old version information
old_ver="$(grep AC_INIT configure.ac | grep -o \\[[0-9.]*\\] | tr -d [])"
old_so_ver="$(grep LIBSQUASHFS_SO_VERSION configure.ac | \
grep -o \\[[0-9:]*\\] | tr -d [])"
current=$(echo "${old_so_ver}" | cut -d: -f1)
revision=$(echo "${old_so_ver}" | cut -d: -f2)
age=$(echo "${old_so_ver}" | cut -d: -f3)
echo "$old_ver" | grep -q -x "$VER_REGEX" ||
fatal "error reading old version number"
VER_REGEX="\([0-9]\+:[0-9]\+:[0-9]\+\)"
echo "$old_so_ver" | grep -q -x "$VER_REGEX" ||
fatal "error reading old so version"
[ "x$current:$revision:$age" = "x$old_so_ver" ] || \
fatal "Error parsing old so version"
##### generate new library SO version
libchanges=$(git diff --numstat v${old_ver}..HEAD lib/sqfs/ | wc -l)
if [ $libchanges -gt 0 ]; then
echo "Detected changes to library code, updating so version"
changed=$(askyesno "Have any public interfaces been changed")
added=$(askyesno "Have any public interfaces been added")
removed=$(askyesno "Have any public interfaces been removed")
revision=$((revision+1))
if [ -n "$added" -o -n "$removed" -o -n "$changed" ]; then
current=$((current+1))
revision=0
fi
if [ -n "$added" ]; then
age=$((age+1))
fi
if [ -n "$removed" -o -n "$changed" ]; then
age=0
fi
else
echo "No changes to library code detected, keeping old so version"
fi
new_so_ver="${current}:${revision}:${age}"
echo ""
echo "current package version: $old_ver"
echo "current library so-version: $old_so_ver"
echo ""
echo "creating package version: $new_ver"
echo "With library so-version: $new_so_ver"
echo ""
if [ "x$(askyesno "Is this ok")" != "xyes" ]; then
echo "Aborting"
exit
fi
tag_name="v$new_ver"
release_name="squashfs-tools-ng-${new_ver}"
# Make sure the git index is up-to-date
[ -z "$(git status --porcelain)" ] || fatal "Git index is not up-to-date"
# Make sure the tag does not exist
[ -z "$(git tag -l "$tag_name")" ] || fatal "Tag $tag_name already exists"
# Change the version in the configure.ac
sed -i -e "s/$old_ver/$new_ver/g" configure.ac
sed -i -e "s/$old_so_ver/$new_so_ver/g" configure.ac
# Commit the change, create new signed tag
echo "Generating signed release commit tag $tag_name"
git commit -s -m "Release version $new_ver" configure.ac
git tag -m "Release $new_ver" -s "$tag_name"
# Prepare signed tarball
./autogen.sh
./configure
make -j distcheck
echo "Signing the tarball"
gpg -o "$release_name.tar.gz.asc" --detach-sign \
-a "$release_name.tar.gz"
gpg -o "$release_name.tar.xz.asc" --detach-sign \
-a "$release_name.tar.xz"
echo "Generating doxygen documentation"
make doxygen-doc
tar czf "doxydoc-$new_ver.tar.gz" -C doxygen-doc/html .
|