]>
Commit | Line | Data |
---|---|---|
b4075f6b JM |
1 | #! /bin/sh |
2 | ||
3 | ######################################################################## | |
4 | # | |
5 | # File: gcc_release | |
6 | # Author: Jeffrey Law, Bernd Schmidt, Mark Mitchell | |
7 | # Date: 2001-05-25 | |
8 | # | |
9 | # Contents: | |
10 | # Script to create a GCC release. | |
11 | # | |
fad257c3 | 12 | # Copyright (c) 2001, 2002, 2006 Free Software Foundation. |
b4075f6b | 13 | # |
567bfee8 | 14 | # This file is part of GCC. |
b4075f6b | 15 | # |
567bfee8 | 16 | # GCC is free software; you can redistribute it and/or modify |
b4075f6b JM |
17 | # it under the terms of the GNU General Public License as published by |
18 | # the Free Software Foundation; either version 2, or (at your option) | |
19 | # any later version. | |
20 | # | |
567bfee8 | 21 | # GCC is distributed in the hope that it will be useful, |
b4075f6b JM |
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 | # GNU General Public License for more details. | |
25 | # | |
26 | # You should have received a copy of the GNU General Public License | |
567bfee8 | 27 | # along with GCC; see the file COPYING. If not, write to |
e252987e KC |
28 | # the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
29 | # Boston, MA 02110-1301, USA. | |
b4075f6b JM |
30 | # |
31 | ######################################################################## | |
32 | ||
33 | ######################################################################## | |
34 | # Notes | |
35 | ######################################################################## | |
36 | ||
37 | # Here is an example usage of this script, to create a GCC 3.0.2 | |
38 | # prerelease: | |
39 | # | |
40 | # gcc_release -r 3.0.2 | |
41 | # | |
42 | # This script will automatically use the head of the release branch | |
43 | # to generate the release. | |
44 | ||
45 | ######################################################################## | |
46 | # Functions | |
47 | ######################################################################## | |
48 | ||
49 | # Issue the error message given by $1 and exit with a non-zero | |
50 | # exit code. | |
51 | ||
52 | error() { | |
53 | echo "gcc_release: error: $1" | |
54 | exit 1 | |
55 | } | |
56 | ||
57 | # Issue the informational message given by $1. | |
58 | ||
59 | inform() { | |
60 | echo "gcc_release: $1" | |
61 | } | |
62 | ||
63 | # Issue a usage message explaining how to use this script. | |
64 | ||
65 | usage() { | |
66 | cat <<EOF | |
1f9d6256 | 67 | gcc_release -r release [-f] [further options] |
a39d2742 | 68 | gcc_release -s name:svnbranch [further options] |
c627639b GP |
69 | |
70 | Options: | |
71 | ||
72 | -r release Version of the form X.Y or X.Y.Z. | |
a39d2742 | 73 | -s name:svnbranch Create a snapshot, not a real release. |
c627639b GP |
74 | |
75 | -d destination Local working directory where we will build the release | |
76 | (default=${HOME}). | |
77 | -f Create a final release (and update ChangeLogs,...). | |
78 | -l Indicate that we are running on gcc.gnu.org. | |
79 | -p previous-tarball Location of a previous tarball (to generate diff files). | |
a39d2742 | 80 | -t tag Tag to mark the release in SVN. |
c627639b | 81 | -u username Username for upload operations. |
b4075f6b JM |
82 | EOF |
83 | exit 1 | |
84 | } | |
85 | ||
86 | # Change to the directory given by $1. | |
87 | ||
88 | changedir() { | |
89 | cd $1 || \ | |
90 | error "Could not change directory to $1" | |
91 | } | |
92 | ||
93 | # Each of the arguments is a directory name, relative to the top | |
94 | # of the source tree. Return another name for that directory, relative | |
95 | # to the working directory. | |
96 | ||
97 | adjust_dirs() { | |
98 | for x in $@; do | |
99 | echo `basename ${SOURCE_DIRECTORY}`/$x | |
100 | done | |
101 | } | |
102 | ||
103 | # Build the source tree that will be the basis for the release | |
104 | # in ${WORKING_DIRECTORY}/gcc-${RELEASE}. | |
105 | ||
106 | build_sources() { | |
107 | # If the WORKING_DIRECTORY already exists, do not risk destroying it. | |
108 | if [ -r ${WORKING_DIRECTORY} ]; then | |
109 | error "\`${WORKING_DIRECTORY}' already exists" | |
110 | fi | |
111 | # Create the WORKING_DIRECTORY. | |
112 | mkdir "${WORKING_DIRECTORY}" \ | |
113 | || error "Could not create \`${WORKING_DIRECTORY}'" | |
114 | changedir "${WORKING_DIRECTORY}" | |
115 | ||
116 | # If this is a final release, make sure that the ChangeLogs | |
117 | # and version strings are updated. | |
118 | if [ ${FINAL} -ne 0 ]; then | |
119 | inform "Updating ChangeLogs and version files" | |
120 | ||
bb54fdfd | 121 | ${SVN} -q co "${SVNROOT}/${SVNBRANCH}" "`basename ${SOURCE_DIRECTORY}`" ||\ |
b4075f6b JM |
122 | error "Could not check out release sources" |
123 | for x in `find ${SOURCE_DIRECTORY} -name ChangeLog`; do | |
4494cdde GP |
124 | # Update this ChangeLog file only if it does not yet contain the |
125 | # entry we are going to add. (This is a safety net for repeated | |
126 | # runs of this script for the same release.) | |
127 | if ! grep "GCC ${RELEASE} released." ${x} > /dev/null ; then | |
128 | cat - ${x} > ${x}.new <<EOF | |
b4075f6b JM |
129 | ${LONG_DATE} Release Manager |
130 | ||
4494cdde | 131 | * GCC ${RELEASE} released. |
b4075f6b JM |
132 | |
133 | EOF | |
4494cdde GP |
134 | mv ${x}.new ${x} || \ |
135 | error "Could not update ${x}" | |
136 | (changedir `dirname ${x}` && \ | |
bb54fdfd | 137 | ${SVN} -q ci -m 'Mark ChangeLog' `basename ${x}`) || \ |
4494cdde GP |
138 | error "Could not commit ${x}" |
139 | fi | |
b4075f6b JM |
140 | done |
141 | ||
f47687a1 JM |
142 | # Update gcc/DEV-PHASE. |
143 | ||
144 | [ `cat ${SOURCE_DIRECTORY}/gcc/BASE-VER` = ${RELEASE} ] || \ | |
145 | error "Release number ${RELEASE} does not match BASE-VER" | |
146 | (changedir ${SOURCE_DIRECTORY}/gcc && \ | |
147 | : > DEV-PHASE && \ | |
148 | ${SVN} -q ci -m 'Mark as release' DEV-PHASE) || \ | |
149 | error "Could not update DEV-PHASE" | |
b4075f6b JM |
150 | |
151 | # Make sure we tag the sources for a final release. | |
d492addc | 152 | TAG="tags/gcc_`echo ${RELEASE} | tr . _`_release" |
b4075f6b JM |
153 | |
154 | rm -rf ${SOURCE_DIRECTORY} | |
155 | fi | |
156 | ||
157 | # Tag the sources. | |
158 | if [ -n "${TAG}" ]; then | |
6124d3bd | 159 | inform "Tagging sources as ${TAG}" |
a39d2742 JM |
160 | # We don't want to overwrite an existing tag. So, if the tag |
161 | # already exists, issue an error message; the release manager can | |
162 | # manually remove the tag if appropriate. | |
163 | echo "${SVN} ls ${SVNROOT}/${TAG}/ChangeLog" | |
164 | if ${SVN} ls "${SVNROOT}/${TAG}/ChangeLog"; then | |
fdf84417 MM |
165 | error "Tag ${TAG} already exists" |
166 | fi | |
d492addc | 167 | ${SVN} -m "Tagging source as ${TAG}" cp "${SVNROOT}/${SVNBRANCH}" "${SVNROOT}/${TAG}" || \ |
d4a43a05 | 168 | error "Could not tag sources" |
a39d2742 | 169 | SVNBRANCH=${TAG} |
b4075f6b | 170 | fi |
a39d2742 | 171 | SVNREV=`${SVN} info "${SVNROOT}/${SVNBRANCH}"|awk '/Revision:/ {print $2}'` |
b4075f6b JM |
172 | |
173 | # Export the current sources. | |
a39d2742 | 174 | inform "Retrieving sources (svn export -r ${SVNREV} ${SVNROOT}/${SVNBRANCH})" |
d4a43a05 DB |
175 | |
176 | ${SVN} -q export -r${SVNREV} "${SVNROOT}/${SVNBRANCH}" "`basename ${SOURCE_DIRECTORY}`" ||\ | |
177 | error "Could not retrieve sources" | |
b4075f6b | 178 | |
4fdbb1de | 179 | # Run gcc_update on them to set up the timestamps nicely, and (re)write |
a39d2742 | 180 | # the LAST_UPDATED file containing the SVN tag/revision used. |
b4075f6b JM |
181 | changedir "gcc-${RELEASE}" |
182 | contrib/gcc_update --touch | |
a39d2742 | 183 | echo "Obtained from SVN: ${SVNBRANCH} revision ${SVNREV}" > LAST_UPDATED |
b4075f6b | 184 | |
b4075f6b | 185 | # For a prerelease or real release, we need to generate additional |
bb54fdfd | 186 | # files not present in SVN. |
b4075f6b JM |
187 | changedir "${SOURCE_DIRECTORY}" |
188 | if [ $SNAPSHOT -ne 1 ]; then | |
189 | # Generate the documentation. | |
190 | inform "Building install docs" | |
191 | SOURCEDIR=${SOURCE_DIRECTORY}/gcc/doc | |
192 | DESTDIR=${SOURCE_DIRECTORY}/INSTALL | |
193 | export SOURCEDIR | |
194 | export DESTDIR | |
195 | ${SOURCE_DIRECTORY}/gcc/doc/install.texi2html | |
196 | ||
197 | # Regenerate the NEWS file. | |
722962a6 | 198 | contrib/gennews > NEWS || \ |
b4075f6b JM |
199 | error "Could not regenerate NEWS files" |
200 | ||
201 | # Now, we must build the compiler in order to create any generated | |
202 | # files that are supposed to go in the source directory. This is | |
203 | # also a good sanity check to make sure that the release builds | |
204 | # on at least one platform. | |
205 | inform "Building compiler" | |
206 | OBJECT_DIRECTORY=../objdir | |
e9b3872d | 207 | contrib/gcc_build -d ${SOURCE_DIRECTORY} -o ${OBJECT_DIRECTORY} \ |
7444c871 | 208 | -c "--enable-generated-files-in-srcdir --disable-multilib" build || \ |
b4075f6b | 209 | error "Could not rebuild GCC" |
b4075f6b JM |
210 | fi |
211 | ||
212 | # Move message catalogs to source directory. | |
213 | mv ../objdir/gcc/po/*.gmo gcc/po/ | |
0ca8e815 | 214 | [ -f libcpp/po/cpplib.pot ] && mv ../objdir/libcpp/po/*.gmo libcpp/po/ |
b4075f6b | 215 | |
2f701185 | 216 | # Create a "MD5SUMS" file to use for checking the validity of the release. |
f120a34c KC |
217 | echo \ |
218 | "# This file contains the MD5 checksums of the files in the | |
219 | # gcc-"${RELEASE}".tar.bz2 tarball. | |
220 | # | |
221 | # Besides verifying that all files in the tarball were correctly expanded, | |
222 | # it also can be used to determine if any files have changed since the | |
223 | # tarball was expanded or to verify that a patchfile was correctly applied. | |
224 | # | |
225 | # Suggested usage: | |
226 | # md5sum -c MD5SUMS | grep -v \"OK$\" | |
227 | " > MD5SUMS | |
228 | ||
229 | find . -type f | | |
230 | sed -e 's:^\./::' -e '/MD5SUMS/d' | | |
231 | sort | | |
232 | xargs md5sum >>MD5SUMS | |
b4075f6b JM |
233 | } |
234 | ||
f913dcd6 GP |
235 | # Build a single tarfile. The first argument is the name of the tarfile |
236 | # to build, without any suffixes. They will be added automatically. The | |
237 | # rest of the arguments are files or directories to include, and possibly | |
238 | # other arguments to tar. | |
b4075f6b JM |
239 | |
240 | build_tarfile() { | |
241 | # Get the name of the destination tar file. | |
44d952b3 | 242 | TARFILE="$1.tar.bz2" |
b4075f6b JM |
243 | shift |
244 | ||
245 | # Build the tar file itself. | |
44d952b3 | 246 | (${TAR} cf - "$@" | ${BZIP2} > ${TARFILE}) || \ |
b4075f6b JM |
247 | error "Could not build tarfile" |
248 | FILE_LIST="${FILE_LIST} ${TARFILE}" | |
249 | } | |
250 | ||
d6f3f261 JM |
251 | # Build a single tarfile if any of the directories listed exist, |
252 | # but not if none of them do (because that component doesn't exist | |
253 | # on this branch). | |
254 | maybe_build_tarfile() { | |
255 | dest=$1 | |
256 | shift | |
257 | dir_exists=0 | |
258 | for maybe_dir in "$@"; do | |
259 | if [ -d "$maybe_dir" ]; then | |
260 | dir_exists=1 | |
261 | fi | |
262 | done | |
263 | if [ $dir_exists = 1 ]; then | |
264 | build_tarfile "$dest" "$@" | |
265 | else | |
266 | echo "Not building $dest tarfile" | |
267 | fi | |
268 | } | |
269 | ||
b4075f6b JM |
270 | # Build the various tar files for the release. |
271 | ||
272 | build_tarfiles() { | |
273 | inform "Building tarfiles" | |
274 | ||
275 | changedir "${WORKING_DIRECTORY}" | |
276 | ||
277 | # The GNU Coding Standards specify that all files should | |
278 | # world readable. | |
279 | chmod -R a+r ${SOURCE_DIRECTORY} | |
280 | # And that all directories have mode 777. | |
281 | find ${SOURCE_DIRECTORY} -type d -exec chmod 777 {} \; | |
282 | ||
283 | # Build one huge tarfile for the entire distribution. | |
284 | build_tarfile gcc-${RELEASE} `basename ${SOURCE_DIRECTORY}` | |
285 | ||
286 | # Now, build one for each of the languages. | |
d6f3f261 JM |
287 | maybe_build_tarfile gcc-ada-${RELEASE} ${ADA_DIRS} |
288 | maybe_build_tarfile gcc-g++-${RELEASE} ${CPLUSPLUS_DIRS} | |
d6f3f261 JM |
289 | maybe_build_tarfile gcc-fortran-${RELEASE} ${FORTRAN95_DIRS} |
290 | maybe_build_tarfile gcc-java-${RELEASE} ${JAVA_DIRS} | |
291 | maybe_build_tarfile gcc-objc-${RELEASE} ${OBJECTIVEC_DIRS} | |
292 | maybe_build_tarfile gcc-testsuite-${RELEASE} ${TESTSUITE_DIRS} | |
b4075f6b JM |
293 | |
294 | # The core is everything else. | |
295 | EXCLUDES="" | |
f47687a1 | 296 | for x in ${ADA_DIRS} ${CPLUSPLUS_DIRS} ${FORTRAN95_DIRS}\ |
dbff21c5 | 297 | ${JAVA_DIRS} ${OBJECTIVEC_DIRS} ${TESTSUITE_DIRS}; do |
b4075f6b JM |
298 | EXCLUDES="${EXCLUDES} --exclude $x" |
299 | done | |
300 | build_tarfile gcc-core-${RELEASE} ${EXCLUDES} \ | |
301 | `basename ${SOURCE_DIRECTORY}` | |
1c0d0c3e | 302 | } |
b4075f6b | 303 | |
44d952b3 GP |
304 | # Build .gz files. |
305 | build_gzip() { | |
b4075f6b | 306 | for f in ${FILE_LIST}; do |
44d952b3 GP |
307 | target=${f%.bz2}.gz |
308 | (${BZIP2} -d -c $f | ${GZIP} > ${target}) || error "Could not create ${target}" | |
b4075f6b JM |
309 | done |
310 | } | |
311 | ||
312 | # Build diffs against an old release. | |
313 | build_diffs() { | |
e776237d | 314 | old_dir=${1%/*} |
b4075f6b | 315 | old_file=${1##*/} |
44d952b3 | 316 | old_vers=${old_file%.tar.bz2} |
b4075f6b JM |
317 | old_vers=${old_vers#gcc-} |
318 | inform "Building diffs against version $old_vers" | |
f47687a1 | 319 | for f in gcc gcc-ada gcc-g++ gcc-fortran gcc-java gcc-objc gcc-testsuite gcc-core; do |
44d952b3 GP |
320 | old_tar=${old_dir}/${f}-${old_vers}.tar.bz2 |
321 | new_tar=${WORKING_DIRECTORY}/${f}-${RELEASE}.tar.bz2 | |
0a1c5051 GP |
322 | if [ ! -e $old_tar ]; then |
323 | inform "$old_tar not found; not generating diff file" | |
324 | elif [ ! -e $new_tar ]; then | |
325 | inform "$new_tar not found; not generating diff file" | |
326 | else | |
b4075f6b | 327 | build_diff $old_tar gcc-${old_vers} $new_tar gcc-${RELEASE} \ |
44d952b3 | 328 | ${f}-${old_vers}-${RELEASE}.diff.bz2 |
b4075f6b JM |
329 | fi |
330 | done | |
331 | } | |
332 | ||
333 | # Build an individual diff. | |
334 | build_diff() { | |
335 | changedir "${WORKING_DIRECTORY}" | |
336 | tmpdir=gccdiff.$$ | |
337 | mkdir $tmpdir || error "Could not create directory $tmpdir" | |
338 | changedir $tmpdir | |
44d952b3 GP |
339 | (${BZIP2} -d -c $1 | ${TAR} xf - ) || error "Could not unpack $1 for diffs" |
340 | (${BZIP2} -d -c $3 | ${TAR} xf - ) || error "Could not unpack $3 for diffs" | |
341 | ${DIFF} $2 $4 > ../${5%.bz2} | |
b4075f6b JM |
342 | if [ $? -eq 2 ]; then |
343 | error "Trouble making diffs from $1 to $3" | |
344 | fi | |
44d952b3 | 345 | ${BZIP2} ../${5%.bz2} || error "Could not generate ../$5" |
b4075f6b JM |
346 | changedir .. |
347 | rm -rf $tmpdir | |
348 | FILE_LIST="${FILE_LIST} $5" | |
349 | } | |
350 | ||
351 | # Upload the files to the FTP server. | |
b4075f6b JM |
352 | upload_files() { |
353 | inform "Uploading files" | |
354 | ||
355 | changedir "${WORKING_DIRECTORY}" | |
356 | ||
e776237d JM |
357 | # Make sure the directory exists on the server. |
358 | if [ $LOCAL -eq 0 ]; then | |
8d4d9d19 GP |
359 | ${SSH} -l ${GCC_USERNAME} ${GCC_HOSTNAME} \ |
360 | mkdir -p "${FTP_PATH}/diffs" | |
1971aca7 | 361 | UPLOAD_PATH="${GCC_USERNAME}@${GCC_HOSTNAME}:${FTP_PATH}" |
e776237d | 362 | else |
8d4d9d19 | 363 | mkdir -p "${FTP_PATH}/diffs" \ |
b4075f6b | 364 | || error "Could not create \`${FTP_PATH}'" |
1971aca7 | 365 | UPLOAD_PATH=${FTP_PATH} |
b4075f6b JM |
366 | fi |
367 | ||
8d4d9d19 | 368 | # Then copy files to their respective (sub)directories. |
b4075f6b JM |
369 | for x in gcc*.gz gcc*.bz2; do |
370 | if [ -e ${x} ]; then | |
371 | # Make sure the file will be readable on the server. | |
372 | chmod a+r ${x} | |
373 | # Copy it. | |
8d4d9d19 GP |
374 | case ${x} in |
375 | *.diff.*) | |
376 | SUBDIR="diffs/"; | |
377 | ;; | |
378 | *) | |
379 | SUBDIR=""; | |
380 | esac | |
381 | ${SCP} ${x} ${UPLOAD_PATH}/${SUBDIR} \ | |
382 | || error "Could not upload ${x}" | |
b4075f6b JM |
383 | fi |
384 | done | |
385 | } | |
386 | ||
f913dcd6 | 387 | # Print description if snapshot exists. |
2e847896 | 388 | snapshot_print() { |
155cb616 KC |
389 | if [ -e ${RELEASE}/$1 ]; then |
390 | printf "%-38s%s\n\n" "$1" "$2" >> ${SNAPSHOT_README} | |
391 | echo " <tr><td><a href=\"$1\">$1</a></td>" >> ${SNAPSHOT_INDEX} | |
392 | echo " <td>$2</td></tr>" >> ${SNAPSHOT_INDEX} | |
2e847896 KC |
393 | fi |
394 | } | |
395 | ||
b348a598 GP |
396 | # Announce a snapshot, both on the web and via mail. |
397 | announce_snapshot() { | |
398 | inform "Updating links and READMEs on the FTP server" | |
399 | ||
400 | TEXT_DATE=`date --date=$DATE +%B\ %d,\ %Y` | |
2e847896 KC |
401 | SNAPSHOT_README=${RELEASE}/README |
402 | SNAPSHOT_INDEX=${RELEASE}/index.html | |
403 | ||
238f2fef | 404 | changedir "${SNAPSHOTS_DIR}" |
155cb616 KC |
405 | echo \ |
406 | "Snapshot gcc-"${RELEASE}" is now available on | |
407 | ftp://gcc.gnu.org/pub/gcc/snapshots/"${RELEASE}"/ | |
408 | and on various mirrors, see http://gcc.gnu.org/mirrors.html for details. | |
409 | ||
bb54fdfd | 410 | This snapshot has been generated from the GCC "${BRANCH}" SVN branch |
d492addc | 411 | with the following options: "svn://gcc.gnu.org/svn/gcc/${SVNBRANCH} revision ${SVNREV}" |
155cb616 KC |
412 | |
413 | You'll find: | |
414 | " > ${SNAPSHOT_README} | |
415 | ||
416 | echo \ | |
417 | "<html> | |
418 | ||
419 | <head> | |
420 | <title>GCC "${RELEASE}" Snapshot</title> | |
421 | </head> | |
422 | ||
423 | <body> | |
424 | <h1>GCC "${RELEASE}" Snapshot</h1> | |
425 | ||
426 | <p>The <a href =\"http://gcc.gnu.org/\">GCC Project</a> makes | |
427 | periodic snapshots of the GCC source tree available to the public | |
428 | for testing purposes.</p> | |
429 | ||
430 | <p>If you are planning to download and use one of our snapshots, then | |
431 | we highly recommend you join the GCC developers list. Details for | |
432 | how to sign up can be found on the GCC project home page.</p> | |
433 | ||
bb54fdfd | 434 | <p>This snapshot has been generated from the GCC "${BRANCH}" SVN branch |
d492addc | 435 | with the following options: <code>"svn://gcc.gnu.org/svn/gcc/${SVNBRANCH} revision ${SVNREV}"</code></p> |
155cb616 KC |
436 | |
437 | <table>" > ${SNAPSHOT_INDEX} | |
2e847896 | 438 | |
155cb616 KC |
439 | snapshot_print gcc-${RELEASE}.tar.bz2 "Complete GCC (includes all of below)" |
440 | snapshot_print gcc-core-${RELEASE}.tar.bz2 "C front end and core compiler" | |
441 | snapshot_print gcc-ada-${RELEASE}.tar.bz2 "Ada front end and runtime" | |
442 | snapshot_print gcc-fortran-${RELEASE}.tar.bz2 "Fortran front end and runtime" | |
443 | snapshot_print gcc-g++-${RELEASE}.tar.bz2 "C++ front end and runtime" | |
155cb616 KC |
444 | snapshot_print gcc-java-${RELEASE}.tar.bz2 "Java front end and runtime" |
445 | snapshot_print gcc-objc-${RELEASE}.tar.bz2 "Objective-C front end and runtime" | |
446 | snapshot_print gcc-testsuite-${RELEASE}.tar.bz2 "The GCC testsuite" | |
447 | ||
448 | echo \ | |
449 | "Diffs from "${BRANCH}"-"${LAST_DATE}" are available in the diffs/ subdirectory. | |
450 | ||
451 | When a particular snapshot is ready for public consumption the LATEST-"${BRANCH}" | |
452 | link is updated and a message is sent to the gcc list. Please do not use | |
453 | a snapshot before it has been announced that way." >> ${SNAPSHOT_README} | |
454 | ||
455 | echo \ | |
456 | "</table> | |
457 | <p>Diffs from "${BRANCH}"-"${LAST_DATE}" are available in the | |
458 | <a href=\"diffs/\">diffs/ subdirectory</a>.</p> | |
459 | ||
460 | <p>When a particular snapshot is ready for public consumption the LATEST-"${BRANCH}" | |
461 | link is updated and a message is sent to the gcc list. Please do not use | |
462 | a snapshot before it has been announced that way.</p> | |
463 | ||
464 | <hr /> | |
465 | ||
466 | <address> | |
467 | <a href=\"mailto:gcc@gcc.gnu.org\">gcc@gcc.gnu.org</a> | |
468 | <br /> | |
469 | Last modified "${TEXT_DATE}" | |
470 | </address> | |
471 | </body> | |
472 | ||
473 | </html>" >> ${SNAPSHOT_INDEX} | |
2e847896 KC |
474 | |
475 | rm -f LATEST-${BRANCH} | |
476 | ln -s ${RELEASE} LATEST-${BRANCH} | |
b348a598 GP |
477 | |
478 | inform "Sending mail" | |
479 | ||
480 | export QMAILHOST=gcc.gnu.org | |
2e847896 | 481 | mail -s "gcc-${RELEASE} is now available" gcc@gcc.gnu.org < ${SNAPSHOT_README} |
b348a598 GP |
482 | } |
483 | ||
b4075f6b JM |
484 | ######################################################################## |
485 | # Initialization | |
486 | ######################################################################## | |
487 | ||
fad257c3 GP |
488 | LC_ALL=C |
489 | export LC_ALL | |
490 | ||
b4075f6b JM |
491 | # Today's date. |
492 | DATE=`date "+%Y%m%d"` | |
493 | LONG_DATE=`date "+%Y-%m-%d"` | |
494 | ||
7444c871 | 495 | SVN=${SVN:-svn} |
b4075f6b | 496 | # The CVS server containing the GCC repository. |
bb54fdfd | 497 | SVN_SERVER="gcc.gnu.org" |
b4075f6b | 498 | # The path to the repository on that server. |
bb54fdfd | 499 | SVN_REPOSITORY="/svn/gcc" |
b4075f6b | 500 | # The username to use when connecting to the server. |
bb54fdfd | 501 | SVN_USERNAME="${USER}" |
b4075f6b | 502 | |
b8f93352 MM |
503 | # The machine to which files will be uploaded. |
504 | GCC_HOSTNAME="gcc.gnu.org" | |
505 | # The name of the account on the machine to which files are uploaded. | |
506 | GCC_USERNAME="gccadmin" | |
32f4b1ed GP |
507 | # The directory in which the files will be placed (do not use ~user syntax). |
508 | FTP_PATH=/var/ftp/pub/gcc | |
238f2fef GP |
509 | # The directory in which snapshots will be placed. |
510 | SNAPSHOTS_DIR=${FTP_PATH}/snapshots | |
b4075f6b JM |
511 | |
512 | # The major number for the release. For release `3.0.2' this would be | |
513 | # `3' | |
514 | RELEASE_MAJOR="" | |
515 | # The minor number for the release. For release `3.0.2' this would be | |
516 | # `0'. | |
517 | RELEASE_MINOR="" | |
518 | # The revision number for the release. For release `3.0.2' this would | |
519 | # be `2'. | |
520 | RELEASE_REVISION="" | |
521 | # The complete name of the release. | |
522 | RELEASE="" | |
523 | ||
b69cd3cf GP |
524 | # The name of the branch from which the release should be made, in a |
525 | # user-friendly form. | |
b4075f6b JM |
526 | BRANCH="" |
527 | ||
b69cd3cf GP |
528 | # The name of the branch from which the release should be made, as used |
529 | # for our version control system. | |
bb54fdfd | 530 | SVNBRANCH="" |
b69cd3cf | 531 | |
b4075f6b JM |
532 | # The tag to apply to the sources used for the release. |
533 | TAG="" | |
534 | ||
535 | # The old tarballs from which to generate diffs. | |
536 | OLD_TARS="" | |
537 | ||
538 | # The directory that will be used to construct the release. The | |
f913dcd6 | 539 | # release itself will be placed in a subdirectory of this directory. |
b4075f6b JM |
540 | DESTINATION=${HOME} |
541 | # The subdirectory. | |
542 | WORKING_DIRECTORY="" | |
543 | # The directory that will contain the GCC sources. | |
544 | SOURCE_DIRECTORY="" | |
545 | ||
546 | # The directories that should be part of the various language-specific | |
547 | # tar files. These are all relative to the top of the source tree. | |
8bad007c | 548 | ADA_DIRS="gcc/ada libada gnattools" |
b4075f6b | 549 | CPLUSPLUS_DIRS="gcc/cp libstdc++-v3" |
6de9cd9a | 550 | FORTRAN95_DIRS="gcc/fortran libgfortran" |
b4075f6b | 551 | JAVA_DIRS="gcc/java libjava libffi fastjar zlib boehm-gc" |
a5675618 | 552 | OBJECTIVEC_DIRS="gcc/objc gcc/objcp libobjc" |
b4075f6b JM |
553 | TESTSUITE_DIRS="gcc/testsuite" |
554 | ||
555 | # Non-zero if this is the final release, rather than a prerelease. | |
556 | FINAL=0 | |
557 | ||
558 | # Non-zero if we are building a snapshot, and don't build gcc or | |
559 | # include generated files. | |
560 | SNAPSHOT=0 | |
561 | ||
562 | # Non-zero if we are running locally on gcc.gnu.org, and use local CVS | |
563 | # and copy directly to the FTP directory. | |
564 | LOCAL=0 | |
565 | ||
566 | # Major operation modes. | |
44d952b3 | 567 | MODE_GZIP=0 |
b8f93352 | 568 | MODE_DIFFS=0 |
b4075f6b JM |
569 | MODE_SOURCES=0 |
570 | MODE_TARFILES=0 | |
571 | MODE_UPLOAD=0 | |
572 | ||
44d952b3 | 573 | # List of archive files generated; used to create .gz files from .bz2. |
b4075f6b JM |
574 | FILE_LIST="" |
575 | ||
576 | # Programs we use. | |
577 | ||
578 | BZIP2="${BZIP2:-bzip2}" | |
579 | CVS="${CVS:-cvs -f -Q -z9}" | |
78ff5eea | 580 | DIFF="${DIFF:-diff -Nrcpad}" |
b4075f6b JM |
581 | ENV="${ENV:-env}" |
582 | GZIP="${GZIP:-gzip --best}" | |
583 | SCP="${SCP:-scp -p}" | |
b8f93352 | 584 | SSH="${SSH:-ssh}" |
b4075f6b JM |
585 | TAR="${TAR:-tar}" |
586 | ||
587 | ######################################################################## | |
588 | # Command Line Processing | |
589 | ######################################################################## | |
590 | ||
591 | # Parse the options. | |
1f9d6256 | 592 | while getopts "d:fr:u:t:p:s:l" ARG; do |
b4075f6b JM |
593 | case $ARG in |
594 | d) DESTINATION="${OPTARG}";; | |
595 | r) RELEASE="${OPTARG}";; | |
596 | t) TAG="${OPTARG}";; | |
bb54fdfd | 597 | u) SVN_USERNAME="${OPTARG}";; |
b4075f6b | 598 | f) FINAL=1;; |
1f9d6256 GP |
599 | s) SNAPSHOT=1 |
600 | BRANCH=${OPTARG%:*} | |
bb54fdfd | 601 | SVNBRANCH=${OPTARG#*:} |
1f9d6256 | 602 | ;; |
b4075f6b JM |
603 | l) LOCAL=1 |
604 | SCP=cp | |
f83fd9ae | 605 | PATH=~:/usr/local/bin:$PATH;; |
e776237d | 606 | p) OLD_TARS="${OLD_TARS} ${OPTARG}" |
aaaf25eb | 607 | if [ ! -f ${OPTARG} ]; then |
e776237d JM |
608 | error "-p argument must name a tarball" |
609 | fi;; | |
b4075f6b JM |
610 | \?) usage;; |
611 | esac | |
612 | done | |
613 | shift `expr ${OPTIND} - 1` | |
614 | ||
2cd5026f GP |
615 | # Handle the major modes. |
616 | while [ $# -ne 0 ]; do | |
617 | case $1 in | |
618 | diffs) MODE_DIFFS=1;; | |
619 | gzip) MODE_GZIP=1;; | |
620 | sources) MODE_SOURCES=1;; | |
621 | tarfiles) MODE_TARFILES=1;; | |
622 | upload) MODE_UPLOAD=1;; | |
623 | all) MODE_SOURCES=1; MODE_TARFILES=1; MODE_DIFFS=1; MODE_UPLOAD=1; | |
624 | if [ $SNAPSHOT -ne 1 ]; then | |
625 | # Only for releases and pre-releases. | |
626 | MODE_GZIP=1; | |
627 | fi | |
628 | ;; | |
629 | *) error "Unknown mode $1";; | |
630 | esac | |
631 | shift | |
632 | done | |
633 | ||
b4075f6b | 634 | # Perform consistency checking. |
bb54fdfd | 635 | if [ ${LOCAL} -eq 0 ] && [ -z ${SVN_USERNAME} ]; then |
b4075f6b JM |
636 | error "No username specified" |
637 | fi | |
638 | ||
639 | if [ ! -d ${DESTINATION} ]; then | |
640 | error "\`${DESTINATION}' is not a directory" | |
641 | fi | |
642 | ||
643 | if [ $SNAPSHOT -eq 0 ]; then | |
644 | if [ -z ${RELEASE} ]; then | |
645 | error "No release number specified" | |
646 | fi | |
647 | ||
648 | # Compute the major and minor release numbers. | |
649 | RELEASE_MAJOR=`echo $RELEASE | awk --assign FS=. '{ print $1; }'` | |
650 | RELEASE_MINOR=`echo $RELEASE | awk --assign FS=. '{ print $2; }'` | |
651 | RELEASE_REVISION=`echo $RELEASE | awk --assign FS=. '{ print $3; }'` | |
652 | ||
653 | if [ -z "${RELEASE_MAJOR}" ] || [ -z "${RELEASE_MINOR}" ]; then | |
654 | error "Release number \`${RELEASE}' is invalid" | |
655 | fi | |
656 | ||
657 | # Compute the full name of the release. | |
658 | if [ -z "${RELEASE_REVISION}" ]; then | |
659 | RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}" | |
660 | else | |
661 | RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_REVISION}" | |
662 | fi | |
663 | ||
664 | # Compute the name of the branch, which is based solely on the major | |
665 | # and minor release numbers. | |
bb54fdfd | 666 | SVNBRANCH="branches/gcc-${RELEASE_MAJOR}_${RELEASE_MINOR}-branch" |
b4075f6b | 667 | |
f0b9a44b | 668 | # If this is not a final release, set various parameters accordingly. |
b4075f6b | 669 | if [ ${FINAL} -ne 1 ]; then |
f0b9a44b MM |
670 | RELEASE="${RELEASE}-RC-${DATE}" |
671 | FTP_PATH="${SNAPSHOTS_DIR}/${RELEASE}" | |
b4075f6b | 672 | else |
b8f93352 | 673 | FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}/" |
b4075f6b JM |
674 | fi |
675 | else | |
b99f39de GP |
676 | RELEASE=${BRANCH}-${DATE} |
677 | FTP_PATH="${FTP_PATH}/snapshots/${RELEASE}" | |
b4075f6b | 678 | |
aaaf25eb GP |
679 | # If diffs are requested when building locally on gcc.gnu.org, we (usually) |
680 | # know what the last snapshot date was and take the corresponding tarballs, | |
f913dcd6 | 681 | # unless the user specified tarballs explicitly. |
aaaf25eb | 682 | if [ $MODE_DIFFS -ne 0 ] && [ $LOCAL -ne 0 ] && [ -z "${OLD_TARS}" ]; then |
b69cd3cf | 683 | LAST_DATE=`cat ~/.snapshot_date-${BRANCH}` |
238f2fef | 684 | OLD_TARS=${SNAPSHOTS_DIR}/${BRANCH}-${LAST_DATE}/gcc-${BRANCH}-${LAST_DATE}.tar.bz2 |
b4075f6b JM |
685 | fi |
686 | fi | |
687 | ||
688 | # Compute the name of the WORKING_DIRECTORY and the SOURCE_DIRECTORY. | |
689 | WORKING_DIRECTORY="${DESTINATION}/gcc-${RELEASE}" | |
690 | SOURCE_DIRECTORY="${WORKING_DIRECTORY}/gcc-${RELEASE}" | |
691 | ||
692 | # Recompute the names of all the language-specific directories, | |
693 | # relative to the WORKING_DIRECTORY. | |
dbff21c5 | 694 | ADA_DIRS=`adjust_dirs ${ADA_DIRS}` |
b4075f6b | 695 | CPLUSPLUS_DIRS=`adjust_dirs ${CPLUSPLUS_DIRS}` |
6de9cd9a | 696 | FORTRAN95_DIRS=`adjust_dirs ${FORTRAN95_DIRS}` |
b4075f6b JM |
697 | JAVA_DIRS=`adjust_dirs ${JAVA_DIRS}` |
698 | OBJECTIVEC_DIRS=`adjust_dirs ${OBJECTIVEC_DIRS}` | |
699 | TESTSUITE_DIRS=`adjust_dirs ${TESTSUITE_DIRS}` | |
700 | ||
bb54fdfd | 701 | # Set up SVNROOT. |
b4075f6b | 702 | if [ $LOCAL -eq 0 ]; then |
d4a43a05 DB |
703 | SVNROOT="svn+ssh://${SVN_USERNAME}@${SVN_SERVER}${SVN_REPOSITORY}" |
704 | CVSROOT=":ext:${SVN_USERNAME}@gcc.gnu.org/cvs/gcc" | |
b4075f6b | 705 | else |
bb54fdfd DB |
706 | SVNROOT="file:///svn/gcc" |
707 | CVSROOT="/cvs/gcc" | |
b4075f6b | 708 | fi |
bb54fdfd | 709 | export SVNROOT |
b4075f6b JM |
710 | export CVSROOT |
711 | ||
712 | ######################################################################## | |
713 | # Main Program | |
714 | ######################################################################## | |
715 | ||
1f1760d3 KC |
716 | # Set the timezone to UTC |
717 | TZ="UTC0" | |
718 | export TZ | |
719 | ||
b4075f6b JM |
720 | # Build the source directory. |
721 | ||
722 | if [ $MODE_SOURCES -ne 0 ]; then | |
723 | build_sources | |
724 | fi | |
725 | ||
726 | # Build the tar files. | |
727 | ||
728 | if [ $MODE_TARFILES -ne 0 ]; then | |
729 | build_tarfiles | |
730 | fi | |
731 | ||
b8f93352 MM |
732 | # Build diffs |
733 | ||
734 | if [ $MODE_DIFFS -ne 0 ]; then | |
735 | # Possibly build diffs. | |
736 | if [ -n "$OLD_TARS" ]; then | |
737 | for old_tar in $OLD_TARS; do | |
738 | build_diffs $old_tar | |
739 | done | |
740 | fi | |
741 | fi | |
742 | ||
44d952b3 GP |
743 | # Build gzip files |
744 | if [ $MODE_GZIP -ne 0 ]; then | |
745 | build_gzip | |
1c0d0c3e JM |
746 | fi |
747 | ||
b4075f6b | 748 | # Upload them to the FTP server. |
b4075f6b JM |
749 | if [ $MODE_UPLOAD -ne 0 ]; then |
750 | upload_files | |
751 | ||
752 | # For snapshots, make some further updates. | |
753 | if [ $SNAPSHOT -ne 0 ] && [ $LOCAL -ne 0 ]; then | |
b348a598 | 754 | announce_snapshot |
b4075f6b JM |
755 | |
756 | # Update snapshot date file. | |
757 | changedir ~ | |
b69cd3cf | 758 | echo $DATE > .snapshot_date-${BRANCH} |
b4075f6b | 759 | |
b4075f6b JM |
760 | # Remove working directory |
761 | rm -rf ${WORKING_DIRECTORY} | |
762 | fi | |
763 | fi |