-
Notifications
You must be signed in to change notification settings - Fork 16
/
dorelease
executable file
·198 lines (168 loc) · 6.52 KB
/
dorelease
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/bash
# build -stable release from current -stable series
# Copyright (c) 2005 Chris Wright <chrisw@osdl.org>
# Copyright (c) 2006-2011 Greg Kroah-Hartman <greg@kroah.com>
#
if [ $# -ne 1 ]; then
KETCHUP=`which kv 2>/dev/null`
if [ -z "$KETCHUP" ]; then
echo -e "Usage:\t $0 release_number"
echo -e "e.g.\t $0 2.6.11.12"
echo -e "or install ketchup to automatically release the latest kernel version."
exit 1
fi
RELEASE=`kv`
else
RELEASE=$1
fi
REL_ARRAY=(${RELEASE//./ })
BASE=${REL_ARRAY[0]}.${REL_ARRAY[1]}.${REL_ARRAY[2]}
REL=${REL_ARRAY[3]}
MAJOR=${REL_ARRAY[0]}
MINOR=${REL_ARRAY[2]}
LONGTERM=0
# see if this is a "longterm" kernel or not
if [ $MAJOR == "2" ]; then
if [ $MINOR == "27" ]; then
LONGTERM=1
fi
if [ $MINOR == "32" ]; then
LONGTERM=1
fi
if [ $MINOR == "33" ]; then
LONGTERM=1
fi
if [ $MINOR == "34" ]; then
LONGTERM=1
fi
if [ $MINOR == "35" ]; then
LONGTERM=1
fi
fi
#echo "major = $MAJOR, minor = $MINOR, longterm = $LONGTERM"
# 4.x or 3.x or 2.6?
VER="2.6"
if [ ${MAJOR} == "3" ] ; then
# 3.x series
VER="3.0"
BASE=${REL_ARRAY[0]}.${REL_ARRAY[1]}
REL=${REL_ARRAY[2]}
MINOR=${REL_ARRAY[1]}
fi
if [ ${MAJOR} == "4" ] ; then
# 4.x series
VER="4.x"
BASE=${REL_ARRAY[0]}.${REL_ARRAY[1]}
REL=${REL_ARRAY[2]}
MINOR=${REL_ARRAY[1]}
fi
LAST=$(($REL - 1))
INCREMENTAL=1
if [ $LAST -eq 0 ]; then
LAST_REL=${BASE}
INCREMENTAL=0
else
LAST_REL=${BASE}.${LAST}
fi
echo "# About to create stable release $RELEASE (base $BASE last version $LAST_REL)"
echo "# "
BASE_COMMIT="$(git cat-file tag v${BASE} | grep object | cut -d" " -f2)"
LAST_COMMIT="$(git cat-file tag v${LAST_REL} | grep object | cut -d" " -f2)"
RELEASE_COMMIT="$(git cat-file tag v${RELEASE} | grep object | cut -d" " -f2)"
#echo "# BASE_COMMIT=$BASE_COMMIT"
#echo "# LAST_COMMIT=$LAST_COMMIT"
#echo "# RELEASE_COMMIT=$RELEASE_COMMIT"
#echo "#"
echo -n "# [ret] to continue"
read
RELDIR="../release-$RELEASE"
if [ -d ${RELDIR} ] ; then
rm ${RELDIR}/*
else
mkdir ${RELDIR}
fi
echo "# building tree in ${RELDIR}"
# build release materials, tarball, base patch, incr patch, changelog
#git archive --format=tar --prefix=linux-$RELEASE/ HEAD | gzip -9 > $RELDIR/linux-${RELEASE}.tar.gz
#git diff-tree -p $BASE_COMMIT $RELEASE_COMMIT | gzip -9 > $RELDIR/patch-${RELEASE}.gz
#if [ $INCREMENTAL -ne 0 ]; then
# git diff-tree -p $LAST_COMMIT $RELEASE_COMMIT | gzip -9 > $RELDIR/patch-${LAST_REL}-${REL}.gz
#fi
#zcat $RELDIR/patch-${LAST_REL}-${REL}.gz | diffstat -p1 > $RELDIR/diffstat-${LAST_REL}-${REL} 2>/dev/null
git archive --format=tar --prefix=linux-$RELEASE/ $RELEASE_COMMIT > $RELDIR/linux-${RELEASE}.tar
git diff-tree -p $BASE_COMMIT $RELEASE_COMMIT > $RELDIR/patch-${RELEASE}
if [ $INCREMENTAL -ne 0 ]; then
git diff-tree -p $LAST_COMMIT $RELEASE_COMMIT > $RELDIR/patch-${LAST_REL}-${REL}
cat $RELDIR/patch-${LAST_REL}-${REL} | diffstat -p1 > $RELDIR/diffstat-${LAST_REL}-${REL} 2>/dev/null
else
cat $RELDIR/patch-${RELEASE} | diffstat -p1 > $RELDIR/diffstat-${RELEASE} 2>/dev/null
fi
git log ${LAST_COMMIT}..${RELEASE_COMMIT} > $RELDIR/ChangeLog-$RELEASE
< $RELDIR/ChangeLog-$RELEASE git shortlog > $RELDIR/shortlog-$RELEASE
# sign all the needed files
gpg -a -b ${RELDIR}/linux-${RELEASE}.tar
gpg -a -b ${RELDIR}/patch-${RELEASE}
gpg -a -b ${RELDIR}/ChangeLog-${RELEASE}
if [ $INCREMENTAL -ne 0 ]; then
gpg -a -b ${RELDIR}/patch-${LAST_REL}-${REL}
fi
echo "# "
HOST="gregkh@geb.kernel.org"
SCRIPT="${RELDIR}/upload_v${RELEASE}"
touch ${SCRIPT}
chmod 755 ${SCRIPT}
if [ $LONGTERM -eq 1 ]; then
echo "# This is a longterm release"
echo "# finalize the release:"
echo "cd ${RELDIR}"
echo "kup --host=${HOST} put --tar --prefix=linux-${RELEASE}/ /pub/scm/linux/kernel/git/stable/linux-stable.git v${RELEASE} linux-${RELEASE}.tar.asc /pub/linux/kernel/v${VER}/longterm/v${BASE}/linux-${RELEASE}.tar.gz" | tee -a ${SCRIPT}
echo "kup --host=${HOST} put ChangeLog-${RELEASE} ChangeLog-${RELEASE}.asc /pub/linux/kernel/v${VER}/longterm/v${BASE}/" | tee -a ${SCRIPT}
echo "kup --host=${HOST} put patch-${RELEASE} patch-${RELEASE}.asc /pub/linux/kernel/v${VER}/longterm/v${BASE}/patch-${RELEASE}.gz" | tee -a ${SCRIPT}
if [ $INCREMENTAL -ne 0 ]; then
echo "kup --host=${HOST} put patch-${LAST_REL}-${REL} patch-${LAST_REL}-${REL}.asc /pub/linux/kernel/v${VER}/longterm/v${BASE}/incr/patch-${LAST_REL}-${REL}.gz" | tee -a ${SCRIPT}
fi
# echo "mv $RELDIR/linux-${RELEASE}.tar.gz ~/v2.6/longterm/v${BASE}/"
# echo "mv $RELDIR/ChangeLog-${RELEASE} ~/v2.6/longterm/v${BASE}/"
# echo "mv $RELDIR/patch-${RELEASE}.gz ~/v2.6/longterm/v${BASE}/"
# echo "cp $RELDIR/patch-${LAST_REL}-${REL}.gz ~/v2.6/longterm/v${BASE}/incr/"
# echo "mv $RELDIR/patch-${LAST_REL}-${REL}.gz ~"
# echo "mv $RELDIR/diffstat-${LAST_REL}-${REL} ~"
# echo "mv $RELDIR/shortlog-${RELEASE} ~"
else
echo "# This is a stable release"
echo "# finalize it:"
echo "cd ${RELDIR}"
echo "kup --host=${HOST} put --tar --prefix=linux-${RELEASE}/ /pub/scm/linux/kernel/git/stable/linux-stable.git v${RELEASE} linux-${RELEASE}.tar.asc /pub/linux/kernel/v${VER}/linux-${RELEASE}.tar.gz" | tee -a ${SCRIPT}
echo "kup --host=${HOST} put ChangeLog-${RELEASE} ChangeLog-${RELEASE}.asc /pub/linux/kernel/v${VER}/" | tee -a ${SCRIPT}
echo "kup --host=${HOST} put patch-${RELEASE} patch-${RELEASE}.asc /pub/linux/kernel/v${VER}/patch-${RELEASE}.gz" | tee -a ${SCRIPT}
if [ $INCREMENTAL -ne 0 ]; then
echo "kup --host=${HOST} put patch-${LAST_REL}-${REL} patch-${LAST_REL}-${REL}.asc /pub/linux/kernel/v${VER}/incr/patch-${LAST_REL}-${REL}.gz" | tee -a ${SCRIPT}
fi
# echo "mv $RELDIR/patch-${LAST_REL}-${REL}.gz ~"
# echo "mv $RELDIR/diffstat-${LAST_REL}-${REL} ~"
# echo "mv $RELDIR/shortlog-${RELEASE} ~"
# LATEST=`ls ~/v${VER}/LATEST-IS*`
# LATEST=`basename $LATEST`
# echo "# current LATEST-IS is '$LATEST' is that what it should be?"
# echo "# mv ~/v${VER}/${LATEST} ~/v${VER}/LATEST-IS-${RELEASE}"
fi
# create the email
cat << __EOF__ > ${RELDIR}/email
Subject: Linux ${RELEASE}
I'm announcing the release of the ${RELEASE} kernel.
All users of the ${BASE} kernel series must upgrade.
The updated ${BASE}.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-${BASE}.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
__EOF__
if [ $INCREMENTAL -ne 0 ]; then
cat ${RELDIR}/diffstat-${LAST_REL}-${REL} >> ${RELDIR}/email
else
cat ${RELDIR}/diffstat-${RELEASE} >> ${RELDIR}/email
fi
echo "" >> ${RELDIR}/email
cat $RELDIR/shortlog-$RELEASE >> ${RELDIR}/email