]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - scripts/dorelease
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / scripts / dorelease
1 #!/bin/bash
2 # build -stable release from current -stable series
3 # Copyright (c) 2005 Chris Wright <chrisw@osdl.org>
4 # Copyright (c) 2006-2011 Greg Kroah-Hartman <greg@kroah.com>
5 #
6
7
8 if [ $# -ne 1 ]; then
9 KETCHUP=`which ketchup 2>/dev/null`
10 if [ -z "$KETCHUP" ]; then
11 echo -e "Usage:\t $0 release_number"
12 echo -e "e.g.\t $0 2.6.11.12"
13 echo -e "or install ketchup to automatically release the latest kernel version."
14 exit 1
15 fi
16 RELEASE=`ketchup -m`
17 else
18 RELEASE=$1
19 fi
20
21 REL_ARRAY=(${RELEASE//./ })
22 BASE=${REL_ARRAY[0]}.${REL_ARRAY[1]}.${REL_ARRAY[2]}
23 REL=${REL_ARRAY[3]}
24 MINOR=${REL_ARRAY[2]}
25
26 LONGTERM=0
27 # see if this is a "longterm" kernel or not
28 if [ $MINOR == "27" ]; then
29 LONGTERM=1
30 fi
31 if [ $MINOR == "32" ]; then
32 LONGTERM=1
33 fi
34 if [ $MINOR == "33" ]; then
35 LONGTERM=1
36 fi
37 if [ $MINOR == "34" ]; then
38 LONGTERM=1
39 fi
40 if [ $MINOR == "35" ]; then
41 LONGTERM=1
42 fi
43 #echo "longterm = $LONGTERM"
44
45 # 3.0 or 2.6?
46 VER="2.6"
47 if [ ${REL_ARRAY[0]} == "3" ] ; then
48 # 3.x series
49 VER="3.0"
50 BASE=${REL_ARRAY[0]}.${REL_ARRAY[1]}
51 REL=${REL_ARRAY[2]}
52 MINOR=${REL_ARRAY[1]}
53 fi
54
55
56 LAST=$(($REL - 1))
57 INCREMENTAL=1
58 if [ $LAST -eq 0 ]; then
59 LAST_REL=${BASE}
60 INCREMENTAL=0
61 else
62 LAST_REL=${BASE}.${LAST}
63 fi
64 echo "# About to create stable release $RELEASE (base $BASE last version $LAST_REL)"
65 echo "# "
66
67 BASE_COMMIT="$(git cat-file tag v${BASE} | grep object | cut -d" " -f2)"
68 LAST_COMMIT="$(git cat-file tag v${LAST_REL} | grep object | cut -d" " -f2)"
69 RELEASE_COMMIT="$(git cat-file tag v${RELEASE} | grep object | cut -d" " -f2)"
70 #echo "# BASE_COMMIT=$BASE_COMMIT"
71 #echo "# LAST_COMMIT=$LAST_COMMIT"
72 #echo "# RELEASE_COMMIT=$RELEASE_COMMIT"
73 #echo "#"
74
75 echo -n "# [ret] to continue"
76 read
77
78 RELDIR="../release-$RELEASE"
79 mkdir $RELDIR
80
81 echo "# building tree in $RELDIR"
82
83 # build release materials, tarball, base patch, incr patch, changelog
84 #git archive --format=tar --prefix=linux-$RELEASE/ HEAD | gzip -9 > $RELDIR/linux-${RELEASE}.tar.gz
85 #git diff-tree -p $BASE_COMMIT $RELEASE_COMMIT | gzip -9 > $RELDIR/patch-${RELEASE}.gz
86 #if [ $INCREMENTAL -ne 0 ]; then
87 # git diff-tree -p $LAST_COMMIT $RELEASE_COMMIT | gzip -9 > $RELDIR/patch-${LAST_REL}-${REL}.gz
88 #fi
89 #zcat $RELDIR/patch-${LAST_REL}-${REL}.gz | diffstat -p1 > $RELDIR/diffstat-${LAST_REL}-${REL} 2>/dev/null
90
91 git archive --format=tar --prefix=linux-$RELEASE/ $RELEASE_COMMIT > $RELDIR/linux-${RELEASE}.tar
92 git diff-tree -p $BASE_COMMIT $RELEASE_COMMIT > $RELDIR/patch-${RELEASE}
93 if [ $INCREMENTAL -ne 0 ]; then
94 git diff-tree -p $LAST_COMMIT $RELEASE_COMMIT > $RELDIR/patch-${LAST_REL}-${REL}
95 fi
96 cat $RELDIR/patch-${LAST_REL}-${REL} | diffstat -p1 > $RELDIR/diffstat-${LAST_REL}-${REL} 2>/dev/null
97 git log ${LAST_COMMIT}..${RELEASE_COMMIT} > $RELDIR/ChangeLog-$RELEASE
98 < $RELDIR/ChangeLog-$RELEASE git shortlog > $RELDIR/shortlog-$RELEASE
99
100 # sign all the needed files
101 gpg -a -b ${RELDIR}/linux-${RELEASE}.tar
102 gpg -a -b ${RELDIR}/patch-${RELEASE}
103 gpg -a -b ${RELDIR}/ChangeLog-${RELEASE}
104 if [ $INCREMENTAL -ne 0 ]; then
105 gpg -a -b ${RELDIR}/patch-${LAST_REL}-${REL}
106 fi
107
108
109 echo "# "
110 HOST="gregkh@geb.kernel.org"
111 SCRIPT="${RELDIR}/upload_v${RELEASE}"
112 touch ${SCRIPT}
113
114 if [ $LONGTERM -eq 1 ]; then
115 echo "# This is a longterm release"
116 echo "# finalize the release:"
117 echo "cd ${RELDIR}"
118 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}
119 echo "kup --host=${HOST} put ChangeLog-${RELEASE} ChangeLog-${RELEASE}.asc /pub/linux/kernel/v${VER}/longterm/v${BASE}/" | tee -a ${SCRIPT}
120 echo "kup --host=${HOST} put patch-${RELEASE} patch-${RELEASE}.asc /pub/linux/kernel/v${VER}/longterm/v${BASE}/patch-${RELEASE}.gz" | tee -a ${SCRIPT}
121 if [ $INCREMENTAL -ne 0 ]; then
122 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}
123 fi
124 # echo "mv $RELDIR/linux-${RELEASE}.tar.gz ~/v2.6/longterm/v${BASE}/"
125 # echo "mv $RELDIR/ChangeLog-${RELEASE} ~/v2.6/longterm/v${BASE}/"
126 # echo "mv $RELDIR/patch-${RELEASE}.gz ~/v2.6/longterm/v${BASE}/"
127 # echo "cp $RELDIR/patch-${LAST_REL}-${REL}.gz ~/v2.6/longterm/v${BASE}/incr/"
128 # echo "mv $RELDIR/patch-${LAST_REL}-${REL}.gz ~"
129 # echo "mv $RELDIR/diffstat-${LAST_REL}-${REL} ~"
130 # echo "mv $RELDIR/shortlog-${RELEASE} ~"
131 else
132 echo "# This is a stable release"
133 echo "# finalize it:"
134 echo "cd ${RELDIR}"
135 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}
136 echo "kup --host=${HOST} put ChangeLog-${RELEASE} ChangeLog-${RELEASE}.asc /pub/linux/kernel/v${VER}/" | tee -a ${SCRIPT}
137 echo "kup --host=${HOST} put patch-${RELEASE} patch-${RELEASE}.asc /pub/linux/kernel/v${VER}/patch-${RELEASE}.gz" | tee -a ${SCRIPT}
138 if [ $INCREMENTAL -ne 0 ]; then
139 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}
140 fi
141 # echo "mv $RELDIR/patch-${LAST_REL}-${REL}.gz ~"
142 # echo "mv $RELDIR/diffstat-${LAST_REL}-${REL} ~"
143 # echo "mv $RELDIR/shortlog-${RELEASE} ~"
144 # LATEST=`ls ~/v${VER}/LATEST-IS*`
145 # LATEST=`basename $LATEST`
146 # echo "# current LATEST-IS is '$LATEST' is that what it should be?"
147 # echo "# mv ~/v${VER}/${LATEST} ~/v${VER}/LATEST-IS-${RELEASE}"
148 fi