-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-version
More file actions
executable file
·113 lines (93 loc) · 3.28 KB
/
update-version
File metadata and controls
executable file
·113 lines (93 loc) · 3.28 KB
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
#!/bin/bash
set -x
tag_prefix=`dpkg-parsechangelog -S Source | sed 's/linux-meta/linux/'`-
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <linux-source-directory>" 1>&2
exit 1
fi
master_dir="$1"
# Work out the master kernel version.
if [ -f "$master_dir/debian/debian.env" ]; then
branch=`sed -ne 's/DEBIAN=//p' <"$master_dir/debian/debian.env"`
changelog="-l$branch/changelog"
else
changelog=""
fi
master_version=`(cd "$master_dir" && LC_ALL=C dpkg-parsechangelog -S Version $changelog)`
# Work out our current version taking into account closed sections.
here_series=$( LC_ALL=C dpkg-parsechangelog -S Distribution )
if [ "$here_series" = "UNRELEASED" ]; then
here_version=$( LC_ALL=C dpkg-parsechangelog -o 1 -S Version )
here_series=$( LC_ALL=C dpkg-parsechangelog -c 1 -S Distribution )
else
here_version=$( LC_ALL=C dpkg-parsechangelog -S Version )
fi
# Ensure we have the appropriate tag.
here_tagversion=$( echo "$tag_prefix$here_version" | sed -e 's/~/_/g' )
count=$( git for-each-ref "refs/tags/$here_tagversion" | wc -l )
if [ "$count" != 1 ]; then
echo "$0: $here_tagversion: tag not found" 1>&2
exit 1
fi
# Update things from the primary package.
for thing in \
debian/dkms-versions \
debian/scripts/misc/git-ubuntu-log
do
from="$master_dir/$thing"
to="$thing"
if [ -f "$from" ]; then
cp -p "$from" "$to" || exit 1
git add "$to" || exit 1
else
rm -f "$to"
git rm --ignore-unmatch "$to" || exit 1
fi
if ! git diff --exit-code HEAD -- "$thing" >/dev/null; then
msg="UBUNTU: [Packaging] resync $thing from main package
BugLink: http://bugs.launchpad.net/bugs/1786013"
git commit -m "$msg" -s -- "$thing"
else
echo "$thing: no changes from master"
fi
done
# We need to ensure the ABI number matches our master source.
# extract both for comparison.
here_abi=${here_version%.*}
master_abi=$(echo ${master_version%.*} | sed -e 's/-/./g')
master_abi_human=${master_version%.*}
# Extract the upload number from the _previous_ upload and increment it.
here_upload=${here_version##*.}
here_upload=$(( $here_upload + 1 ))
here_newversion="$master_abi.$here_upload"
#echo "here_version<$here_version> here_abi<$here_abi> here_newversion<$here_newversion>"
#echo "master_version<$master_version> master_abi<$master_abi>"
# First insert any primary changes.
marker="__CHANGELOG_FRAGMENT_MARKER__"
dch --newversion "$here_newversion" "$marker"
# Prepare the the blank changelog.
tmp="/tmp/$$.msg"
# If the parent represents an ABI bump include that.
if dpkg --compare-versions "$here_abi" lt "$master_abi"; then
echo "Updated to ABI: $master_abi"
[ -f "$tmp" ] && echo "" >>"$tmp"
echo " * Bump ABI $master_abi_human" >>"$tmp"
fi
# Format any existing commits.
count=$( git log --oneline "$here_tagversion".. | wc -l )
if [ "$count" != 0 ]; then
[ -f "$tmp" ] && echo "" >>"$tmp"
git log "$here_tagversion".. | "debian/scripts/misc/git-ubuntu-log" >>"$tmp"
fi
# Insert official changelog fragment.
sed -i -e '/^ \* '"$marker"'/{
r '"$tmp"'
d
}' debian/changelog
rm -f "$tmp"
# Close this changelog entry.
dch --distribution "$here_series" --release ''
# Emit final closing commands.
echo "git commit -s -m 'feat: $tag_prefix$here_newversion' debian/changelog"
here_tagversion=$( echo "$tag_prefix$here_newversion" | sed -e 's/~/_/g' )
echo "git tag -s -m '$tag_prefix$here_newversion' '$here_tagversion'"