/[linux-patches]/hardened/scripts/trunk/dorelease
Gentoo

Contents of /hardened/scripts/trunk/dorelease

Parent Directory Parent Directory | Revision Log Revision Log


Revision 406 - (show annotations) (download)
Thu Apr 13 19:44:02 2006 UTC (8 years ago) by johnm
File size: 5448 byte(s)
mail isnt a directory f00!
1 #!/bin/bash
2 ##############################################
3 #
4 # John Mylchreest, 2006-04-13.
5 #
6 # The default settings expect CWD to be
7 # the branch root (directly below tags/trunk)
8 #
9 # Modified from Daniel Drakes original
10 # svn release script to suit my needs.
11 # This should also provide more flexibilty
12 #
13 ##############################################
14
15 # Get options
16 while getopts "f:t:d" opts; do
17 case ${opts} in
18 f) release_conf="${OPTARG}";;
19 t) target=${OPTARG};;
20 d) release_debug=1;;
21 esac
22 done
23 release_cwd=`pwd`
24
25 # Source config
26 release_conf="${release_conf:-".release"}"
27
28 if [[ ! -f "${release_conf}" ]]; then
29 echo "WARNING: Unable to find release config. Using defaults."
30 fi
31
32 # Setup Defaults
33 webuser=${GENTOO_USER:-${USER}}
34 webrelease=0
35 webpath="~${GENTOO_USER}/public_html/"
36 svntags=./tags/
37 svntrunk=./trunk/
38 branch_root=../
39 branch_prefix=
40 output_dir=/tmp/
41 announce_mailto=${webuser}@gentoo.org
42
43 # Source options
44 [[ -f ${release_conf} ]] && source ${release_conf}
45
46 # Sanitise as neccessary
47 if [[ -n "$(svn status ${svntrunk})" ]] ; then
48 echo "FATAL: There are files in conflict with SVN in ${svntrunk},"
49 echo "FATAL: Please make sure it is up to date, with no outstanding changes."
50 exit -1
51 fi
52
53 echo "ACTION: Performing svn up."
54 svn up ${svntags}/../ >/dev/null
55
56 # Compute targets
57 echo "ACTION: Tracing Previous Releases..."
58 # Sorry for all the pipes, its just easier to read :)
59 release_history="$(svn ls ${svntags} | sort -n | sed -e 's:/::g')"
60
61 # Find target
62 if [[ -z ${target} ]]; then
63 # Since all we need is the last release, lets do that.
64 for i in ${release_history}; do
65 target=${i%-*}
66 done
67 fi
68
69 # Set target release
70 for i in ${release_history}; do
71 if [[ -z ${i/*${target}*} ]]; then
72 lasttag=${i//*-}
73 target_release=${target}-$((${lasttag} + 1));
74 fi
75 done
76 [[ -z "${target_release}" ]] && target_release=${target}-1
77
78 # replace branch prefix?
79 if [[ -z "${branch_prefix}" ]]; then
80 pushd ${branch_root} >/dev/null
81 branch_prefix=`pwd`
82 branch_prefix=${branch_prefix/*\/}-patches
83 popd >/dev/null
84 fi
85
86 # Print Debug
87 if [[ ${release_debug} -gt 0 ]]; then
88 for var in \
89 release_conf \
90 release_cwd \
91 branch_root \
92 branch_prefix \
93 release_history \
94 target \
95 target_release \
96 output_dir \
97 svntags \
98 svntrunk \
99 webrelease \
100 webuser \
101 webpath; do
102
103 spacing=" "
104 len=$((${#spacing} - ${#var}))
105 spacing=${spacing:0:${len}}
106 echo -e "${var}${spacing}= ${!var}"
107 done
108 fi;
109
110 echo "ACTION: Rolling release tarballs..."
111 tarball_prefix="${output_dir}/${branch_prefix}-${target_release}"
112 if (ls ${svntrunk}/${target}/[123]* 1>/dev/null 2>&1); then
113 pushd ${svntrunk} >/dev/null
114 tar -cjf ${tarball_prefix}.base.tar.bz2 --exclude=".svn" ${target}
115 popd >/dev/null
116 echo "md5: $(md5sum ${tarball_prefix}.base.tar.bz2)"
117 fi
118
119 if (ls ${svntrunk}/${target}/[45]* 1>/dev/null 2>&1); then
120 pushd ${svntrunk} >/dev/null
121 tar -cjf ${tarball_prefix}.extras.tar.bz2 --exclude=".svn" ${target}
122 popd >/dev/null
123 echo "md5: $(md5sum ${tarball_prefix}.extras.tar.bz2)"
124 fi
125
126 cat << EOF
127
128 We have the tarballs, so we're ready to go.
129
130 I will now:
131
132 1. Tag a new ${target_release} branch
133 2. Upload the tarballs to d.g.o:/space/distfiles-local
134 EOF
135
136 if [[ ${webrelease} -gt 0 ]]; then
137 cat << EOF
138 3. Create a release shortlog
139 4. Upload the release shortlog to ${webpath}
140 5. Upload the broken-out patches and tarballs
141 to ${webpath}/{broken-out,releases}
142 EOF
143 fi
144
145 [[ -x /bin/mail ]] && echo "And then finally, send an email to ${announce_mailto}"
146
147 echo "To continue, Hit enter."
148 read
149
150 echo "ACTION: Tagging release in svn"
151 svn cp \
152 ${svntrunk}/${target} \
153 ${svntags}/${target_release} \
154 >/dev/null
155
156 echo "ACTION: Comitting release..."
157 svn ci ${svntags}/${target_release} -m "Releasing ${target_release}"
158
159 echo "ACTION: Uploading tarballs to distfiles"
160 scp ${tarball_prefix}* \
161 ${webuser}@dev.gentoo.org:/space/distfiles-local \
162 >/dev/null
163
164 if [[ ${webrelease} -gt 0 ]]; then
165 echo "ACTION: Creating Shortlog..."
166 shortlog=$(mktemp /tmp/myshortlog-XXXXXXX)
167 if [[ ${target_release//*-} == 1 ]]; then
168 echo "Initial Import" > ${shortlog}
169 else
170 checktag=$((${lasttag} - 1))
171 lastrev=$(svn info ${svntags}/${target}-${lasttag}/ \
172 | grep "Last Changed Rev")
173 lastrev=${lastrev//*:}
174
175 svn log -v -r ${lastrev}:HEAD \
176 ${svntrunk}/${target} \
177 > ${shortlog}
178 fi
179
180 #make directories
181 ssh ${webuser}@dev.gentoo.org \
182 mkdir -p ${webpath}/broken-out/ \
183 ${webpath}/releases \
184 ${webpath}/logs/ \
185 >/dev/null
186
187 echo "ACTION: Uploading Shortlog"
188 scp ${shortlog} \
189 ${webuser}@dev.gentoo.org:${webpath}/logs/shortlog-${target_release} \
190 >/dev/null
191 ssh ${webuser}@dev.gentoo.org chmod a+r \
192 ${webpath}/logs/shortlog-${target_release} \
193 >/dev/null
194
195 #upload broken patches
196 echo "ACTION: Uploading broken-out patches"
197 scp -r ${svntags}/${target_release} \
198 ${webuser}@dev.gentoo.org:${webpath}/broken-out/ \
199 >/dev/null
200
201 #upload release tarballs
202 echo "ACTION: Uploading release tarballs"
203 scp ${tarball_prefix}* \
204 ${webuser}@dev.gentoo.org:${webpath}/releases/ \
205 >/dev/null
206 fi
207
208 if [[ -x /bin/mail ]]; then
209 tmpfile=$(mktemp /tmp/myemail-XXXXXXX)
210 cat << EOF > ${tmpfile}
211 This is an automated email to say that ${branch_prefix}-${target_release}
212 has just been released.
213
214 Changes since ${target}-${lasttag} are as follows:
215
216 EOF
217 cat < ${shortlog} >> ${tmpfile}
218 cat ${tmpfile} | mail \
219 -s "${branch_prefix}-${target_release} Release" \
220 ${announce_mailto}
221 rm ${tmpfile}
222 fi
223 rm ${shortlog}

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20