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