| 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 | #
|
|---|
| 12 | # Copyright (c) 2001, 2002 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 2, 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 COPYING. If not, write to
|
|---|
| 28 | # the Free Software Foundation, 59 Temple Place - Suite 330,
|
|---|
| 29 | # Boston, MA 02111-1307, USA.
|
|---|
| 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
|
|---|
| 67 | gcc_release [-d destination]
|
|---|
| 68 | [-u username]
|
|---|
| 69 | [-r release]
|
|---|
| 70 | [-t tag]
|
|---|
| 71 | [-p previous-tarball]
|
|---|
| 72 | [-s] [-f] [-l]
|
|---|
| 73 | EOF
|
|---|
| 74 | exit 1
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | # Change to the directory given by $1.
|
|---|
| 78 |
|
|---|
| 79 | changedir() {
|
|---|
| 80 | cd $1 || \
|
|---|
| 81 | error "Could not change directory to $1"
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | # Each of the arguments is a directory name, relative to the top
|
|---|
| 85 | # of the source tree. Return another name for that directory, relative
|
|---|
| 86 | # to the working directory.
|
|---|
| 87 |
|
|---|
| 88 | adjust_dirs() {
|
|---|
| 89 | for x in $@; do
|
|---|
| 90 | echo `basename ${SOURCE_DIRECTORY}`/$x
|
|---|
| 91 | done
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | # Build the source tree that will be the basis for the release
|
|---|
| 95 | # in ${WORKING_DIRECTORY}/gcc-${RELEASE}.
|
|---|
| 96 |
|
|---|
| 97 | build_sources() {
|
|---|
| 98 | # If the WORKING_DIRECTORY already exists, do not risk destroying it.
|
|---|
| 99 | if [ -r ${WORKING_DIRECTORY} ]; then
|
|---|
| 100 | error "\`${WORKING_DIRECTORY}' already exists"
|
|---|
| 101 | fi
|
|---|
| 102 | # Create the WORKING_DIRECTORY.
|
|---|
| 103 | mkdir "${WORKING_DIRECTORY}" \
|
|---|
| 104 | || error "Could not create \`${WORKING_DIRECTORY}'"
|
|---|
| 105 | changedir "${WORKING_DIRECTORY}"
|
|---|
| 106 |
|
|---|
| 107 | # If this is a final release, make sure that the ChangeLogs
|
|---|
| 108 | # and version strings are updated.
|
|---|
| 109 | if [ ${FINAL} -ne 0 ]; then
|
|---|
| 110 | inform "Updating ChangeLogs and version files"
|
|---|
| 111 |
|
|---|
| 112 | ${CVS} co -d "`basename ${SOURCE_DIRECTORY}`" \
|
|---|
| 113 | -r ${BRANCH} gcc || \
|
|---|
| 114 | error "Could not check out release sources"
|
|---|
| 115 | for x in `find ${SOURCE_DIRECTORY} -name ChangeLog`; do
|
|---|
| 116 | cat - ${x} > ${x}.new <<EOF
|
|---|
| 117 | ${LONG_DATE} Release Manager
|
|---|
| 118 |
|
|---|
| 119 | * GCC ${RELEASE} Released.
|
|---|
| 120 |
|
|---|
| 121 | EOF
|
|---|
| 122 | mv ${x}.new ${x} || \
|
|---|
| 123 | error "Could not update ${x}"
|
|---|
| 124 | (changedir `dirname ${x}` && \
|
|---|
| 125 | ${CVS} ci -m 'Mark ChangeLog' `basename ${x}`) || \
|
|---|
| 126 | error "Could not commit ${x}"
|
|---|
| 127 | done
|
|---|
| 128 |
|
|---|
| 129 | # Update `gcc/version.c'.
|
|---|
| 130 | for x in gcc/version.c; do
|
|---|
| 131 | y=`basename ${x}`
|
|---|
| 132 | (changedir `dirname ${SOURCE_DIRECTORY}/${x}` && \
|
|---|
| 133 | sed -e 's|version_string\[\] = \".*\"|version_string\[\] = \"'${RELEASE}'\"|g' < ${y} > ${y}.new && \
|
|---|
| 134 | mv ${y}.new ${y} && \
|
|---|
| 135 | ${CVS} ci -m 'Update version' ${y}) || \
|
|---|
| 136 | error "Could not update ${x}"
|
|---|
| 137 | done
|
|---|
| 138 |
|
|---|
| 139 | # Make sure we tag the sources for a final release.
|
|---|
| 140 | TAG="gcc_`echo ${RELEASE} | tr . _`_release"
|
|---|
| 141 |
|
|---|
| 142 | rm -rf ${SOURCE_DIRECTORY}
|
|---|
| 143 | fi
|
|---|
| 144 |
|
|---|
| 145 | # Tag the sources.
|
|---|
| 146 | if [ -n "${TAG}" ]; then
|
|---|
| 147 | inform "Tagging release sources"
|
|---|
| 148 | ${CVS} rtag -r ${BRANCH} -F ${TAG} gcc || \
|
|---|
| 149 | error "Could not tag release sources"
|
|---|
| 150 | BRANCH=$TAG
|
|---|
| 151 | fi
|
|---|
| 152 |
|
|---|
| 153 | # Export the current sources.
|
|---|
| 154 | inform "Retrieving release sources"
|
|---|
| 155 | ${CVS} \
|
|---|
| 156 | export -d "`basename ${SOURCE_DIRECTORY}`" \
|
|---|
| 157 | -r ${BRANCH} gcc || \
|
|---|
| 158 | error "Could not retrieve release sources"
|
|---|
| 159 |
|
|---|
| 160 | # Run gcc_update on them to set up the timestamps nicely.
|
|---|
| 161 | changedir "gcc-${RELEASE}"
|
|---|
| 162 | contrib/gcc_update --touch
|
|---|
| 163 |
|
|---|
| 164 | # Obtain some documentation files from the wwwdocs module.
|
|---|
| 165 | inform "Retrieving HTML documentation"
|
|---|
| 166 | changedir "${WORKING_DIRECTORY}"
|
|---|
| 167 | for x in bugs faq; do
|
|---|
| 168 | (${CVS} export -r HEAD wwwdocs/htdocs/${x}.html && \
|
|---|
| 169 | cp ${WORKING_DIRECTORY}/wwwdocs/htdocs/${x}.html \
|
|---|
| 170 | ${SOURCE_DIRECTORY}) || \
|
|---|
| 171 | error "Could not retrieve ${x}.html"
|
|---|
| 172 | done
|
|---|
| 173 |
|
|---|
| 174 | inform "Generating plain-text documentation from HTML"
|
|---|
| 175 | changedir "${SOURCE_DIRECTORY}"
|
|---|
| 176 | for file in *.html; do
|
|---|
| 177 | newfile=`echo $file | sed -e 's/.html//' | tr "[:lower:]" "[:upper:]"`
|
|---|
| 178 | (${ENV} TERM=vt100 lynx -dump $file \
|
|---|
| 179 | | sed -e "s#file://localhost`/bin/pwd`\(.*\)#http://gcc.gnu.org\1#g" \
|
|---|
| 180 | > $newfile) || \
|
|---|
| 181 | error "Could not generate text-only version of ${file}"
|
|---|
| 182 | done
|
|---|
| 183 |
|
|---|
| 184 | # For a prerelease or real release, we need to generate additional
|
|---|
| 185 | # files not present in CVS.
|
|---|
| 186 | changedir "${SOURCE_DIRECTORY}"
|
|---|
| 187 | if [ $SNAPSHOT -ne 1 ]; then
|
|---|
| 188 | # Generate the documentation.
|
|---|
| 189 | inform "Building install docs"
|
|---|
| 190 | SOURCEDIR=${SOURCE_DIRECTORY}/gcc/doc
|
|---|
| 191 | DESTDIR=${SOURCE_DIRECTORY}/INSTALL
|
|---|
| 192 | export SOURCEDIR
|
|---|
| 193 | export DESTDIR
|
|---|
| 194 | ${SOURCE_DIRECTORY}/gcc/doc/install.texi2html
|
|---|
| 195 |
|
|---|
| 196 | # Regenerate the NEWS file.
|
|---|
| 197 | contrib/gennews > NEWS || \
|
|---|
| 198 | error "Could not regenerate NEWS files"
|
|---|
| 199 |
|
|---|
| 200 | # Now, we must build the compiler in order to create any generated
|
|---|
| 201 | # files that are supposed to go in the source directory. This is
|
|---|
| 202 | # also a good sanity check to make sure that the release builds
|
|---|
| 203 | # on at least one platform.
|
|---|
| 204 | inform "Building compiler"
|
|---|
| 205 | OBJECT_DIRECTORY=../objdir
|
|---|
| 206 | contrib/gcc_build -d ${SOURCE_DIRECTORY} -o ${OBJECT_DIRECTORY} build || \
|
|---|
| 207 | error "Could not rebuild GCC"
|
|---|
| 208 |
|
|---|
| 209 | # Regenerate the Fotran NEWS and BUGS files.
|
|---|
| 210 | (cd ${OBJECT_DIRECTORY}/gcc && make f77.rebuilt) || \
|
|---|
| 211 | error "Could not regenerate Fortran NEWS and BUGS files"
|
|---|
| 212 | fi
|
|---|
| 213 |
|
|---|
| 214 | # Move message catalogs to source directory.
|
|---|
| 215 | mv ../objdir/gcc/po/*.gmo gcc/po/
|
|---|
| 216 |
|
|---|
| 217 | # Create a `.brik' file to use for checking the validity of the
|
|---|
| 218 | # release.
|
|---|
| 219 | changedir "${SOURCE_DIRECTORY}"
|
|---|
| 220 | BRIK_FILE=`mktemp /tmp/gcc_release.XXXXXXX`
|
|---|
| 221 | ((find . -type f | sort > $BRIK_FILE) && \
|
|---|
| 222 | brik -Gb -f ${BRIK_FILE} > .brik && \
|
|---|
| 223 | rm ${BRIK_FILE}) || \
|
|---|
| 224 | error "Could not compute brik checksum"
|
|---|
| 225 | }
|
|---|
| 226 |
|
|---|
| 227 | # Buid a single tarfile. The first argument is the name of the name
|
|---|
| 228 | # of the tarfile to build, without any suffixes. They will be added
|
|---|
| 229 | # automatically. The rest of the arguments are the files or
|
|---|
| 230 | # directories to include.
|
|---|
| 231 |
|
|---|
| 232 | build_tarfile() {
|
|---|
| 233 | # Get the name of the destination tar file.
|
|---|
| 234 | TARFILE="$1.tar.gz"
|
|---|
| 235 | shift
|
|---|
| 236 |
|
|---|
| 237 | # Build the tar file itself.
|
|---|
| 238 | (${TAR} cf - "$@" | ${GZIP} > ${TARFILE}) || \
|
|---|
| 239 | error "Could not build tarfile"
|
|---|
| 240 | FILE_LIST="${FILE_LIST} ${TARFILE}"
|
|---|
| 241 | }
|
|---|
| 242 |
|
|---|
| 243 | # Build the various tar files for the release.
|
|---|
| 244 |
|
|---|
| 245 | build_tarfiles() {
|
|---|
| 246 | inform "Building tarfiles"
|
|---|
| 247 |
|
|---|
| 248 | changedir "${WORKING_DIRECTORY}"
|
|---|
| 249 |
|
|---|
| 250 | # The GNU Coding Standards specify that all files should
|
|---|
| 251 | # world readable.
|
|---|
| 252 | chmod -R a+r ${SOURCE_DIRECTORY}
|
|---|
| 253 | # And that all directories have mode 777.
|
|---|
| 254 | find ${SOURCE_DIRECTORY} -type d -exec chmod 777 {} \;
|
|---|
| 255 |
|
|---|
| 256 | # Build one huge tarfile for the entire distribution.
|
|---|
| 257 | build_tarfile gcc-${RELEASE} `basename ${SOURCE_DIRECTORY}`
|
|---|
| 258 |
|
|---|
| 259 | # Now, build one for each of the languages.
|
|---|
| 260 | build_tarfile gcc-ada-${RELEASE} ${ADA_DIRS}
|
|---|
| 261 | build_tarfile gcc-g++-${RELEASE} ${CPLUSPLUS_DIRS}
|
|---|
| 262 | build_tarfile gcc-g77-${RELEASE} ${FORTRAN_DIRS}
|
|---|
| 263 | build_tarfile gcc-java-${RELEASE} ${JAVA_DIRS}
|
|---|
| 264 | build_tarfile gcc-objc-${RELEASE} ${OBJECTIVEC_DIRS}
|
|---|
| 265 | build_tarfile gcc-testsuite-${RELEASE} ${TESTSUITE_DIRS}
|
|---|
| 266 |
|
|---|
| 267 | # The core is everything else.
|
|---|
| 268 | EXCLUDES=""
|
|---|
| 269 | for x in ${ADA_DIRS} ${CPLUSPLUS_DIRS} ${FORTRAN_DIRS} \
|
|---|
| 270 | ${JAVA_DIRS} ${OBJECTIVEC_DIRS} ${TESTSUITE_DIRS}; do
|
|---|
| 271 | EXCLUDES="${EXCLUDES} --exclude $x"
|
|---|
| 272 | done
|
|---|
| 273 | build_tarfile gcc-core-${RELEASE} ${EXCLUDES} \
|
|---|
| 274 | `basename ${SOURCE_DIRECTORY}`
|
|---|
| 275 | }
|
|---|
| 276 |
|
|---|
| 277 | # Build .bz2 files.
|
|---|
| 278 | build_bzip2() {
|
|---|
| 279 | for f in ${FILE_LIST}; do
|
|---|
| 280 | bzfile=${f%.gz}.bz2
|
|---|
| 281 | (zcat $f | ${BZIP2} > ${bzfile}) || error "Could not create ${bzfile}"
|
|---|
| 282 | done
|
|---|
| 283 | }
|
|---|
| 284 |
|
|---|
| 285 | # Build diffs against an old release.
|
|---|
| 286 | build_diffs() {
|
|---|
| 287 | old_dir=${1%/*}
|
|---|
| 288 | old_file=${1##*/}
|
|---|
| 289 | old_vers=${old_file%.tar.gz}
|
|---|
| 290 | old_vers=${old_vers#gcc-}
|
|---|
| 291 | inform "Building diffs against version $old_vers"
|
|---|
| 292 | for f in gcc gcc-ada gcc-g++ gcc-g77 gcc-java gcc-objc gcc-testsuite gcc-core; do
|
|---|
| 293 | old_tar=${old_dir}/${f}-${old_vers}.tar.gz
|
|---|
| 294 | new_tar=${WORKING_DIRECTORY}/${f}-${RELEASE}.tar.gz
|
|---|
| 295 | if [ ! -e $old_tar ]; then
|
|---|
| 296 | inform "$old_tar not found; not generating diff file"
|
|---|
| 297 | elif [ ! -e $new_tar ]; then
|
|---|
| 298 | inform "$new_tar not found; not generating diff file"
|
|---|
| 299 | else
|
|---|
| 300 | build_diff $old_tar gcc-${old_vers} $new_tar gcc-${RELEASE} \
|
|---|
| 301 | ${f}-${old_vers}-${RELEASE}.diff.gz
|
|---|
| 302 | fi
|
|---|
| 303 | done
|
|---|
| 304 | }
|
|---|
| 305 |
|
|---|
| 306 | # Build an individual diff.
|
|---|
| 307 | build_diff() {
|
|---|
| 308 | changedir "${WORKING_DIRECTORY}"
|
|---|
| 309 | tmpdir=gccdiff.$$
|
|---|
| 310 | mkdir $tmpdir || error "Could not create directory $tmpdir"
|
|---|
| 311 | changedir $tmpdir
|
|---|
| 312 | tar xfz $1 || error "Could not unpack $1 for diffs"
|
|---|
| 313 | tar xfz $3 || error "Could not unpack $3 for diffs"
|
|---|
| 314 | ${DIFF} $2 $4 > ../${5%.gz}
|
|---|
| 315 | if [ $? -eq 2 ]; then
|
|---|
| 316 | error "Trouble making diffs from $1 to $3"
|
|---|
| 317 | fi
|
|---|
| 318 | ${GZIP} ../${5%.gz} || error "Could not gzip ../${5%.gz}"
|
|---|
| 319 | changedir ..
|
|---|
| 320 | rm -rf $tmpdir
|
|---|
| 321 | FILE_LIST="${FILE_LIST} $5"
|
|---|
| 322 | }
|
|---|
| 323 |
|
|---|
| 324 | # Upload the files to the FTP server.
|
|---|
| 325 |
|
|---|
| 326 | upload_files() {
|
|---|
| 327 | inform "Uploading files"
|
|---|
| 328 |
|
|---|
| 329 | changedir "${WORKING_DIRECTORY}"
|
|---|
| 330 |
|
|---|
| 331 | # Make sure the directory exists on the server.
|
|---|
| 332 | if [ $LOCAL -eq 0 ]; then
|
|---|
| 333 | ${SSH} -l ${GCC_USERNAME} ${GCC_HOSTNAME} \
|
|---|
| 334 | mkdir -p "${FTP_PATH}/diffs"
|
|---|
| 335 | UPLOAD_PATH="${GCC_USERNAME}@${GCC_HOSTNAME}:${FTP_PATH}"
|
|---|
| 336 | else
|
|---|
| 337 | mkdir -p "${FTP_PATH}/diffs" \
|
|---|
| 338 | || error "Could not create \`${FTP_PATH}'"
|
|---|
| 339 | UPLOAD_PATH=${FTP_PATH}
|
|---|
| 340 | fi
|
|---|
| 341 |
|
|---|
| 342 | # Then copy files to their respective (sub)directories.
|
|---|
| 343 | for x in gcc*.gz gcc*.bz2; do
|
|---|
| 344 | if [ -e ${x} ]; then
|
|---|
| 345 | # Make sure the file will be readable on the server.
|
|---|
| 346 | chmod a+r ${x}
|
|---|
| 347 | # Copy it.
|
|---|
| 348 | case ${x} in
|
|---|
| 349 | *.diff.*)
|
|---|
| 350 | SUBDIR="diffs/";
|
|---|
| 351 | ;;
|
|---|
| 352 | *)
|
|---|
| 353 | SUBDIR="";
|
|---|
| 354 | esac
|
|---|
| 355 | ${SCP} ${x} ${UPLOAD_PATH}/${SUBDIR} \
|
|---|
| 356 | || error "Could not upload ${x}"
|
|---|
| 357 | fi
|
|---|
| 358 | done
|
|---|
| 359 | }
|
|---|
| 360 |
|
|---|
| 361 | ########################################################################
|
|---|
| 362 | # Initialization
|
|---|
| 363 | ########################################################################
|
|---|
| 364 |
|
|---|
| 365 | # Today's date.
|
|---|
| 366 | DATE=`date "+%Y%m%d"`
|
|---|
| 367 | LONG_DATE=`date "+%Y-%m-%d"`
|
|---|
| 368 |
|
|---|
| 369 | # The CVS server containing the GCC repository.
|
|---|
| 370 | CVS_SERVER="gcc.gnu.org"
|
|---|
| 371 | # The path to the repository on that server.
|
|---|
| 372 | CVS_REPOSITORY="/cvs/gcc"
|
|---|
| 373 | # The CVS protocol to use.
|
|---|
| 374 | CVS_PROTOCOL="ext"
|
|---|
| 375 | # The username to use when connecting to the server.
|
|---|
| 376 | CVS_USERNAME="${USER}"
|
|---|
| 377 |
|
|---|
| 378 | # The machine to which files will be uploaded.
|
|---|
| 379 | GCC_HOSTNAME="gcc.gnu.org"
|
|---|
| 380 | # The name of the account on the machine to which files are uploaded.
|
|---|
| 381 | GCC_USERNAME="gccadmin"
|
|---|
| 382 | # The directory in which the files will be placed.
|
|---|
| 383 | FTP_PATH="~ftp/pub/gcc"
|
|---|
| 384 |
|
|---|
| 385 | # The major number for the release. For release `3.0.2' this would be
|
|---|
| 386 | # `3'
|
|---|
| 387 | RELEASE_MAJOR=""
|
|---|
| 388 | # The minor number for the release. For release `3.0.2' this would be
|
|---|
| 389 | # `0'.
|
|---|
| 390 | RELEASE_MINOR=""
|
|---|
| 391 | # The revision number for the release. For release `3.0.2' this would
|
|---|
| 392 | # be `2'.
|
|---|
| 393 | RELEASE_REVISION=""
|
|---|
| 394 | # The complete name of the release.
|
|---|
| 395 | RELEASE=""
|
|---|
| 396 |
|
|---|
| 397 | # The name of the branch from which the release should be made.
|
|---|
| 398 | BRANCH=""
|
|---|
| 399 |
|
|---|
| 400 | # The tag to apply to the sources used for the release.
|
|---|
| 401 | TAG=""
|
|---|
| 402 |
|
|---|
| 403 | # The old tarballs from which to generate diffs.
|
|---|
| 404 | OLD_TARS=""
|
|---|
| 405 |
|
|---|
| 406 | # The directory that will be used to construct the release. The
|
|---|
| 407 | # release itself will be placed in a subdirectory of this diretory.
|
|---|
| 408 | DESTINATION=${HOME}
|
|---|
| 409 | # The subdirectory.
|
|---|
| 410 | WORKING_DIRECTORY=""
|
|---|
| 411 | # The directory that will contain the GCC sources.
|
|---|
| 412 | SOURCE_DIRECTORY=""
|
|---|
| 413 |
|
|---|
| 414 | # The directories that should be part of the various language-specific
|
|---|
| 415 | # tar files. These are all relative to the top of the source tree.
|
|---|
| 416 | ADA_DIRS="gcc/ada"
|
|---|
| 417 | CPLUSPLUS_DIRS="gcc/cp libstdc++-v3"
|
|---|
| 418 | FORTRAN_DIRS="gcc/f libf2c"
|
|---|
| 419 | JAVA_DIRS="gcc/java libjava libffi fastjar zlib boehm-gc"
|
|---|
| 420 | OBJECTIVEC_DIRS="gcc/objc libobjc"
|
|---|
| 421 | TESTSUITE_DIRS="gcc/testsuite"
|
|---|
| 422 |
|
|---|
| 423 | # Non-zero if this is the final release, rather than a prerelease.
|
|---|
| 424 | FINAL=0
|
|---|
| 425 |
|
|---|
| 426 | # Non-zero if we are building a snapshot, and don't build gcc or
|
|---|
| 427 | # include generated files.
|
|---|
| 428 | SNAPSHOT=0
|
|---|
| 429 |
|
|---|
| 430 | # Non-zero if we are running locally on gcc.gnu.org, and use local CVS
|
|---|
| 431 | # and copy directly to the FTP directory.
|
|---|
| 432 | LOCAL=0
|
|---|
| 433 |
|
|---|
| 434 | # Major operation modes.
|
|---|
| 435 | MODE_BZIP2=0
|
|---|
| 436 | MODE_DIFFS=0
|
|---|
| 437 | MODE_SOURCES=0
|
|---|
| 438 | MODE_TARFILES=0
|
|---|
| 439 | MODE_UPLOAD=0
|
|---|
| 440 |
|
|---|
| 441 | # .gz files generated to create .bz2 files from.
|
|---|
| 442 | FILE_LIST=""
|
|---|
| 443 |
|
|---|
| 444 | # Programs we use.
|
|---|
| 445 |
|
|---|
| 446 | BZIP2="${BZIP2:-bzip2}"
|
|---|
| 447 | CVS="${CVS:-cvs -f -Q -z9}"
|
|---|
| 448 | DIFF="${DIFF:-diff -Nrc3pad}"
|
|---|
| 449 | ENV="${ENV:-env}"
|
|---|
| 450 | GZIP="${GZIP:-gzip --best}"
|
|---|
| 451 | SCP="${SCP:-scp -p}"
|
|---|
| 452 | SSH="${SSH:-ssh}"
|
|---|
| 453 | TAR="${TAR:-tar}"
|
|---|
| 454 |
|
|---|
| 455 | ########################################################################
|
|---|
| 456 | # Command Line Processing
|
|---|
| 457 | ########################################################################
|
|---|
| 458 |
|
|---|
| 459 | # Parse the options.
|
|---|
| 460 | while getopts "d:fr:u:t:p:sl" ARG; do
|
|---|
| 461 | case $ARG in
|
|---|
| 462 | d) DESTINATION="${OPTARG}";;
|
|---|
| 463 | r) RELEASE="${OPTARG}";;
|
|---|
| 464 | t) TAG="${OPTARG}";;
|
|---|
| 465 | u) CVS_USERNAME="${OPTARG}";;
|
|---|
| 466 | f) FINAL=1;;
|
|---|
| 467 | s) SNAPSHOT=1;;
|
|---|
| 468 | l) LOCAL=1
|
|---|
| 469 | SCP=cp
|
|---|
| 470 | FTP_PATH=~ftp/pub/gcc
|
|---|
| 471 | PATH=~:/usr/local/bin:$PATH;;
|
|---|
| 472 | p) OLD_TARS="${OLD_TARS} ${OPTARG}"
|
|---|
| 473 | if [ -d ${OPTARG} ]; then
|
|---|
| 474 | error "-p argument must name a tarball"
|
|---|
| 475 | fi;;
|
|---|
| 476 | \?) usage;;
|
|---|
| 477 | esac
|
|---|
| 478 | done
|
|---|
| 479 | shift `expr ${OPTIND} - 1`
|
|---|
| 480 |
|
|---|
| 481 | # Perform consistency checking.
|
|---|
| 482 | if [ ${LOCAL} -eq 0 ] && [ -z ${CVS_USERNAME} ]; then
|
|---|
| 483 | error "No username specified"
|
|---|
| 484 | fi
|
|---|
| 485 |
|
|---|
| 486 | if [ ! -d ${DESTINATION} ]; then
|
|---|
| 487 | error "\`${DESTINATION}' is not a directory"
|
|---|
| 488 | fi
|
|---|
| 489 |
|
|---|
| 490 | if [ $SNAPSHOT -eq 0 ]; then
|
|---|
| 491 | if [ -z ${RELEASE} ]; then
|
|---|
| 492 | error "No release number specified"
|
|---|
| 493 | fi
|
|---|
| 494 |
|
|---|
| 495 | # Compute the major and minor release numbers.
|
|---|
| 496 | RELEASE_MAJOR=`echo $RELEASE | awk --assign FS=. '{ print $1; }'`
|
|---|
| 497 | RELEASE_MINOR=`echo $RELEASE | awk --assign FS=. '{ print $2; }'`
|
|---|
| 498 | RELEASE_REVISION=`echo $RELEASE | awk --assign FS=. '{ print $3; }'`
|
|---|
| 499 |
|
|---|
| 500 | if [ -z "${RELEASE_MAJOR}" ] || [ -z "${RELEASE_MINOR}" ]; then
|
|---|
| 501 | error "Release number \`${RELEASE}' is invalid"
|
|---|
| 502 | fi
|
|---|
| 503 |
|
|---|
| 504 | # Compute the full name of the release.
|
|---|
| 505 | if [ -z "${RELEASE_REVISION}" ]; then
|
|---|
| 506 | RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}"
|
|---|
| 507 | else
|
|---|
| 508 | RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_REVISION}"
|
|---|
| 509 | fi
|
|---|
| 510 |
|
|---|
| 511 | # Compute the name of the branch, which is based solely on the major
|
|---|
| 512 | # and minor release numbers.
|
|---|
| 513 | BRANCH="gcc-${RELEASE_MAJOR}_${RELEASE_MINOR}-branch"
|
|---|
| 514 |
|
|---|
| 515 | # If this is not a final release, set various parameters acordingly.
|
|---|
| 516 | if [ ${FINAL} -ne 1 ]; then
|
|---|
| 517 | RELEASE="${RELEASE}-${DATE}"
|
|---|
| 518 | FTP_PATH="${FTP_PATH}/prerelease-${RELEASE}/"
|
|---|
| 519 | else
|
|---|
| 520 | FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}/"
|
|---|
| 521 | fi
|
|---|
| 522 | else
|
|---|
| 523 | RELEASE=$DATE
|
|---|
| 524 | # For now snapshots come from the mainline.
|
|---|
| 525 | BRANCH=HEAD
|
|---|
| 526 | FTP_PATH="${FTP_PATH}/snapshots/${LONG_DATE}"
|
|---|
| 527 | TAG=gcc_ss_${DATE}
|
|---|
| 528 |
|
|---|
| 529 | # Building locally on gcc.gnu.org, we know what the last snapshot date
|
|---|
| 530 | # was.
|
|---|
| 531 | if [ $LOCAL -ne 0 ]; then
|
|---|
| 532 | LAST_DATE=`cat ~/.snapshot_date`
|
|---|
| 533 | LAST_LONG_DATE=`date --date=$LAST_DATE +%Y-%m-%d`
|
|---|
| 534 | LAST_DIR=~ftp/pub/gcc/snapshots/${LAST_LONG_DATE}
|
|---|
| 535 | OLD_TARS=${LAST_DIR}/gcc-${LAST_DATE}.tar.gz
|
|---|
| 536 | fi
|
|---|
| 537 | fi
|
|---|
| 538 |
|
|---|
| 539 | # Compute the name of the WORKING_DIRECTORY and the SOURCE_DIRECTORY.
|
|---|
| 540 | WORKING_DIRECTORY="${DESTINATION}/gcc-${RELEASE}"
|
|---|
| 541 | SOURCE_DIRECTORY="${WORKING_DIRECTORY}/gcc-${RELEASE}"
|
|---|
| 542 |
|
|---|
| 543 | # Recompute the names of all the language-specific directories,
|
|---|
| 544 | # relative to the WORKING_DIRECTORY.
|
|---|
| 545 | ADA_DIRS=`adjust_dirs ${ADA_DIRS}`
|
|---|
| 546 | CPLUSPLUS_DIRS=`adjust_dirs ${CPLUSPLUS_DIRS}`
|
|---|
| 547 | FORTRAN_DIRS=`adjust_dirs ${FORTRAN_DIRS}`
|
|---|
| 548 | JAVA_DIRS=`adjust_dirs ${JAVA_DIRS}`
|
|---|
| 549 | OBJECTIVEC_DIRS=`adjust_dirs ${OBJECTIVEC_DIRS}`
|
|---|
| 550 | TESTSUITE_DIRS=`adjust_dirs ${TESTSUITE_DIRS}`
|
|---|
| 551 |
|
|---|
| 552 | # Set up CVSROOT.
|
|---|
| 553 | if [ $LOCAL -eq 0 ]; then
|
|---|
| 554 | CVSROOT=":${CVS_PROTOCOL}:${CVS_USERNAME}@"
|
|---|
| 555 | CVSROOT="${CVSROOT}${CVS_SERVER}:${CVS_REPOSITORY}"
|
|---|
| 556 | else
|
|---|
| 557 | CVSROOT="${CVS_REPOSITORY}"
|
|---|
| 558 | fi
|
|---|
| 559 | export CVSROOT
|
|---|
| 560 |
|
|---|
| 561 | ########################################################################
|
|---|
| 562 | # Main Program
|
|---|
| 563 | ########################################################################
|
|---|
| 564 |
|
|---|
| 565 | # Set the timezone to UTC
|
|---|
| 566 | TZ="UTC0"
|
|---|
| 567 | export TZ
|
|---|
| 568 |
|
|---|
| 569 | # Handle the major modes.
|
|---|
| 570 | while [ $# -ne 0 ]; do
|
|---|
| 571 | case $1 in
|
|---|
| 572 | bzip2) MODE_BZIP2=1;;
|
|---|
| 573 | diffs) MODE_DIFFS=1;;
|
|---|
| 574 | sources) MODE_SOURCES=1;;
|
|---|
| 575 | tarfiles) MODE_TARFILES=1;;
|
|---|
| 576 | upload) MODE_UPLOAD=1;;
|
|---|
| 577 | all) MODE_SOURCES=1; MODE_TARFILES=1; MODE_DIFFS=1; MODE_UPLOAD=1;
|
|---|
| 578 | if [ $SNAPSHOT -ne 1 ]; then
|
|---|
| 579 | # Only for releases and pre-releases.
|
|---|
| 580 | MODE_BZIP2=1;
|
|---|
| 581 | fi
|
|---|
| 582 | ;;
|
|---|
| 583 | *) error "Unknown mode $1";;
|
|---|
| 584 | esac
|
|---|
| 585 | shift
|
|---|
| 586 | done
|
|---|
| 587 |
|
|---|
| 588 | # Build the source directory.
|
|---|
| 589 |
|
|---|
| 590 | if [ $MODE_SOURCES -ne 0 ]; then
|
|---|
| 591 | build_sources
|
|---|
| 592 | fi
|
|---|
| 593 |
|
|---|
| 594 | # Build the tar files.
|
|---|
| 595 |
|
|---|
| 596 | if [ $MODE_TARFILES -ne 0 ]; then
|
|---|
| 597 | build_tarfiles
|
|---|
| 598 | fi
|
|---|
| 599 |
|
|---|
| 600 | # Build diffs
|
|---|
| 601 |
|
|---|
| 602 | if [ $MODE_DIFFS -ne 0 ]; then
|
|---|
| 603 | # Possibly build diffs.
|
|---|
| 604 | if [ -n "$OLD_TARS" ]; then
|
|---|
| 605 | for old_tar in $OLD_TARS; do
|
|---|
| 606 | build_diffs $old_tar
|
|---|
| 607 | done
|
|---|
| 608 | fi
|
|---|
| 609 | fi
|
|---|
| 610 |
|
|---|
| 611 | # Build bzip2 files
|
|---|
| 612 | if [ $MODE_BZIP2 -ne 0 ]; then
|
|---|
| 613 | build_bzip2
|
|---|
| 614 | fi
|
|---|
| 615 |
|
|---|
| 616 | # Upload them to the FTP server.
|
|---|
| 617 |
|
|---|
| 618 | if [ $MODE_UPLOAD -ne 0 ]; then
|
|---|
| 619 | upload_files
|
|---|
| 620 |
|
|---|
| 621 | # For snapshots, make some further updates.
|
|---|
| 622 | if [ $SNAPSHOT -ne 0 ] && [ $LOCAL -ne 0 ]; then
|
|---|
| 623 | # Update links on the FTP server.
|
|---|
| 624 | TEXT_DATE=`date --date=$DATE +%B\ %d,\ %Y`
|
|---|
| 625 | cd ~ftp/pub/gcc/snapshots
|
|---|
| 626 | sed -e "s%@DATE@%$DATE%g" -e "s%@LAST_DATE@%$LAST_DATE%g" \
|
|---|
| 627 | -e "s%@LONG_DATE@%$LONG_DATE%g" \
|
|---|
| 628 | -e "s%@TEXT_DATE@%$TEXT_DATE%g" < ~/scripts/snapshot-README > $$
|
|---|
| 629 | mv $$ README
|
|---|
| 630 | sed -e "s%@DATE@%$DATE%g" -e "s%@LAST_DATE@%$LAST_DATE%g" \
|
|---|
| 631 | -e "s%@LONG_DATE@%$LONG_DATE%g" \
|
|---|
| 632 | -e "s%@TEXT_DATE@%$TEXT_DATE%g" < ~/scripts/snapshot-index.html > $$
|
|---|
| 633 | mv $$ index.html
|
|---|
| 634 |
|
|---|
| 635 | touch LATEST-IS-$LONG_DATE
|
|---|
| 636 | rm -f LATEST-IS-$LAST_LONG_DATE
|
|---|
| 637 |
|
|---|
| 638 | # Update snapshot date file.
|
|---|
| 639 | changedir ~
|
|---|
| 640 | echo $DATE >.snapshot_date
|
|---|
| 641 |
|
|---|
| 642 | # Announce the snapshot.
|
|---|
| 643 | export QMAILHOST=gcc.gnu.org
|
|---|
| 644 | mail -s "gcc-ss-$DATE is now available" gcc@gcc.gnu.org < ~ftp/pub/gcc/snapshots/README
|
|---|
| 645 |
|
|---|
| 646 | # Remove working directory
|
|---|
| 647 | rm -rf ${WORKING_DIRECTORY}
|
|---|
| 648 | fi
|
|---|
| 649 | fi
|
|---|