gfortran.dg/gomp/requires-4.f90: Fix !$omp clause
[gcc.git] / maintainer-scripts / gcc_release
index e784554eabb861c02271d59547511f217a2edd98..2456908d716167fa7de8d9b49ddaad9eaf616625 100755 (executable)
@@ -9,7 +9,7 @@
 # Contents:
 #   Script to create a GCC release.
 #
-# Copyright (c) 2001-2015 Free Software Foundation.
+# Copyright (c) 2001-2020 Free Software Foundation.
 #
 # This file is part of GCC.
 #
 # Functions
 ########################################################################
 
-# Issue the error message given by $1 and exit with a non-zero
+# Issue the error message given by $@ and exit with a non-zero
 # exit code.
 
 error() {
-    echo "gcc_release: error: $1"
+    echo "gcc_release: error: $@"
     exit 1
 }
 
-# Issue the informational message given by $1.
+# Issue the informational message given by $@.
 
 inform() {
-    echo "gcc_release: $1"
+    echo "gcc_release: $@"
 }
 
 # Issue a usage message explaining how to use this script.
@@ -64,20 +64,21 @@ inform() {
 usage() {
 cat <<EOF
 gcc_release -r release [-f] [further options]
-gcc_release -s name:svnbranch [further options]
+gcc_release -s name:gitbranch [further options]
 
 Options:
 
   -r release           Version of the form X.Y or X.Y.Z.
-  -s name:svnbranch    Create a snapshot, not a real release.
+  -s name:gitbranch    Create a snapshot, not a real release.
 
   -d destination       Local working directory where we will build the release
                        (default=${HOME}).
   -f                   Create a final release (and update ChangeLogs,...).
   -l                   Indicate that we are running on gcc.gnu.org.
   -p previous-tarball  Location of a previous tarball (to generate diff files).
-  -t tag               Tag to mark the release in SVN.
+  -t tag               Tag to mark the release in git.
   -u username          Username for upload operations.
+  -b local-git-repo    Local git repository to speed up cloning.
 EOF
     exit 1
 }
@@ -102,14 +103,51 @@ build_sources() {
     || error "Could not create \`${WORKING_DIRECTORY}'"
   changedir "${WORKING_DIRECTORY}"
 
+  # Check out the sources.
+  if [ -n "${GIT_REFERENCE}" ]; then
+    ${GIT} clone -q --dissociate --reference "${GIT_REFERENCE}" \
+                -b "${GITBRANCH}" "${GITROOT}" "`basename ${SOURCE_DIRECTORY}`" || \
+        error "Could not check out release sources"
+  else
+    ${GIT} clone -q -b "${GITBRANCH}" "${GITROOT}" "`basename ${SOURCE_DIRECTORY}`" || \
+        error "Could not check out release sources"
+  fi
+
   # If this is a final release, make sure that the ChangeLogs
   # and version strings are updated.
   if [ ${FINAL} -ne 0 ]; then
     inform "Updating ChangeLogs and version files"
 
-    ${SVN} -q co "${SVNROOT}/${SVNBRANCH}" "`basename ${SOURCE_DIRECTORY}`" ||\
-           error "Could not check out release sources"
-    svnciargs=""
+    grep -q "gcc-${RELEASE_MAJOR}/index.html gcc-${RELEASE_MAJOR}/changes.html" \
+        ${SOURCE_DIRECTORY}/contrib/gennews ||\
+          error "New release not listed in contrib/gennews"
+
+    ${SOURCE_DIRECTORY}/contrib/gennews > NEWS ||\
+          error "Could not regenerate NEWS files"
+
+    grep -q "no releases of GCC ${RELEASE_MAJOR} have yet been made" NEWS &&\
+          error "gcc-${RELEASE_MAJOR}/index.html has not been updated yet"
+
+    grep -q "GCC ${RELEASE_MAJOR} has not been released yet" NEWS &&\
+          error "gcc-${RELEASE_MAJOR}/changes.html has not been updated yet"
+
+    thisindex="http:\/\/gcc.gnu.org\/gcc-${RELEASE_MAJOR}\/index.html"
+    thischanges="http:\/\/gcc.gnu.org\/gcc-${RELEASE_MAJOR}\/changes.html"
+    previndex="http:\/\/gcc.gnu.org\/gcc-`expr ${RELEASE_MAJOR} - 1`\/index.html"
+    sed -n -e "/^${thisindex}/,/^${thischanges}/p" NEWS |\
+          sed -n -e "/Release History/,/References and Acknowledgments/p" |\
+          grep -q "^[[:blank:]]*GCC ${RELEASE_MAJOR}.${RELEASE_MINOR}" ||\
+          error "GCC ${RELEASE_MAJOR}.${RELEASE_MINOR} not mentioned "\
+                "in gcc-${RELEASE_MAJOR}/index.html"
+
+    sed -n -e "/^${thischanges}/,/^${previndex}/p" NEWS |\
+          grep -q "^[[:blank:]]*GCC ${RELEASE_MAJOR}.${RELEASE_MINOR}" ||\
+          error "GCC ${RELEASE_MAJOR}.${RELEASE_MINOR} not mentioned "\
+                "in gcc-${RELEASE_MAJOR}/changes.html"
+
+    rm -f NEWS
+
+    commit_files=""
     for x in `changedir ${SOURCE_DIRECTORY} && \
              find . -name ChangeLog`; do
       # Update this ChangeLog file only if it does not yet contain the
@@ -124,7 +162,7 @@ ${LONG_DATE}  Release Manager
 EOF
        mv ${SOURCE_DIRECTORY}/${x}.new ${SOURCE_DIRECTORY}/${x} \
          || error "Could not update ${x}"
-       svnciargs="${svnciargs} ${x}"
+       commit_files="${commit_files} ${x}"
       fi
     done
 
@@ -139,7 +177,7 @@ EOF
        (changedir ${SOURCE_DIRECTORY}/gcc && \
         echo ${RELEASE} > BASE-VER) || \
        error "Could not update BASE-VER"
-       svnciargs="${svnciargs} gcc/BASE-VER"
+       commit_files="${commit_files} gcc/BASE-VER"
       else
        error "Release number ${RELEASE} does not immediately follow BASE-VER"
       fi
@@ -147,16 +185,15 @@ EOF
     (changedir ${SOURCE_DIRECTORY}/gcc && \
      : > DEV-PHASE) || \
     error "Could not update DEV-PHASE"
-    svnciargs="${svnciargs} gcc/DEV-PHASE"
+    commit_files="${commit_files} gcc/DEV-PHASE"
 
     (changedir ${SOURCE_DIRECTORY} && \
-     ${SVN} -q ci -m 'Update ChangeLog and version files for release' ${svnciargs}) || \
+     ${GIT} commit -q -m 'Update ChangeLog and version files for release' ${commit_files} && \
+     ${GIT} push) || \
     error "Could not commit ChangeLog and version file updates"
 
     # Make sure we tag the sources for a final release.
-    TAG="tags/gcc_`echo ${RELEASE} | tr . _`_release"
-
-    rm -rf ${SOURCE_DIRECTORY}
+    TAG="releases/gcc-${RELEASE}"
   fi
 
   # Tag the sources.
@@ -165,30 +202,43 @@ EOF
     # We don't want to overwrite an existing tag.  So, if the tag
     # already exists, issue an error message; the release manager can
     # manually remove the tag if appropriate.
-    echo "${SVN} ls ${SVNROOT}/${TAG}/ChangeLog" 
-    if ${SVN} ls "${SVNROOT}/${TAG}/ChangeLog"; then 
+    if (changedir ${SOURCE_DIRECTORY} && \
+       ${GIT} rev-parse "refs/tags/${TAG}" > /dev/null 2>&1); then
       error "Tag ${TAG} already exists"
     fi
-    ${SVN} -m "Tagging source as ${TAG}" cp "${SVNROOT}/${SVNBRANCH}" "${SVNROOT}/${TAG}" || \
+    (changedir ${SOURCE_DIRECTORY} && \
+     ${GIT} tag -s -m "GCC ${RELEASE} release" "${TAG}" && \
+     ${GIT} push origin tag "${TAG}") || \
       error "Could not tag sources"
-    SVNBRANCH=${TAG}
+    GITBRANCH=${TAG}
   fi
-  SVNREV=`${SVN} info "${SVNROOT}/${SVNBRANCH}"|awk '/Revision:/ {print $2}'`
 
-  # Export the current sources.
-  inform "Retrieving sources (svn export -r ${SVNREV} ${SVNROOT}/${SVNBRANCH})"
+  GITREV=`cd ${SOURCE_DIRECTORY} && ${GIT} rev-parse HEAD`
+  inform "Sources are commit ${GITREV}"
+
+  # Make sure there are no uncommitted changes in the sources.
+  status=${WORKING_DIRECTORY}/gitstatus.$$
+  (changedir ${SOURCE_DIRECTORY} && \
+   ${GIT} status --porcelain --ignored > "$status") || \
+    error "Could not get source directory status"
+  if [ -s "$status" ]; then
+    cat "$status"
+    error "Source directory has unexpected changes"
+  fi
+  rm "$status"
 
-  ${SVN} -q export -r${SVNREV} "${SVNROOT}/${SVNBRANCH}" "`basename ${SOURCE_DIRECTORY}`" ||\
-    error "Could not retrieve sources"
+  # Remove .git from the sources.
+  rm -rf "${SOURCE_DIRECTORY}/.git" || \
+    error "Could not remove .git from sources"
 
   # Run gcc_update on them to set up the timestamps nicely, and (re)write
-  # the LAST_UPDATED file containing the SVN tag/revision used.
+  # the LAST_UPDATED file containing the git tag/revision used.
   changedir "gcc-${RELEASE}"
   contrib/gcc_update --touch
-  echo "Obtained from SVN: ${SVNBRANCH} revision ${SVNREV}" > LAST_UPDATED
+  echo "Obtained from git: ${GITBRANCH} revision ${GITREV}" > LAST_UPDATED
 
   # For a prerelease or real release, we need to generate additional
-  # files not present in SVN.
+  # files not present in git.
   changedir "${SOURCE_DIRECTORY}"
   if [ $SNAPSHOT -ne 1 ]; then
     # Generate the documentation.
@@ -348,7 +398,7 @@ upload_files() {
   # Make sure the directory exists on the server.
   if [ $LOCAL -eq 0 ]; then
     ${SSH} -l ${GCC_USERNAME} ${GCC_HOSTNAME} \
-      mkdir -p "${FTP_PATH}/diffs"
+      mkdir -m 755 -p "${FTP_PATH}/diffs"
     UPLOAD_PATH="${GCC_USERNAME}@${GCC_HOSTNAME}:${FTP_PATH}"
   else
     mkdir -p "${FTP_PATH}/diffs" \
@@ -400,11 +450,11 @@ announce_snapshot() {
   changedir "${SNAPSHOTS_DIR}"
   echo \
 "Snapshot gcc-"${RELEASE}" is now available on
-  ftp://gcc.gnu.org/pub/gcc/snapshots/"${RELEASE}"/
+  https://gcc.gnu.org/pub/gcc/snapshots/"${RELEASE}"/
 and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.
 
-This snapshot has been generated from the GCC "${BRANCH}" SVN branch
-with the following options: "svn://gcc.gnu.org/svn/gcc/${SVNBRANCH} revision ${SVNREV}"
+This snapshot has been generated from the GCC "${BRANCH}" git branch
+with the following options: "git://gcc.gnu.org/git/gcc.git branch ${GITBRANCH} revision ${GITREV}"
 
 You'll find:
 " > ${SNAPSHOT_README}
@@ -427,8 +477,8 @@ for testing purposes.</p>
 we highly recommend you join the GCC developers list.  Details for
 how to sign up can be found on the GCC project home page.</p>
 
-<p>This snapshot has been generated from the GCC "${BRANCH}" SVN branch
-with the following options: <code>"svn://gcc.gnu.org/svn/gcc/${SVNBRANCH} revision ${SVNREV}"</code></p>
+<p>This snapshot has been generated from the GCC "${BRANCH}" git branch
+with the following options: <code>"git://gcc.gnu.org/git/gcc.git branch ${GITBRANCH} revision ${GITREV}"</code></p>
 
 <table>" > ${SNAPSHOT_INDEX}
        
@@ -481,13 +531,13 @@ export LC_ALL
 DATE=`date "+%Y%m%d"`
 LONG_DATE=`date "+%Y-%m-%d"`
 
-SVN=${SVN:-svn}
-# The CVS server containing the GCC repository.
-SVN_SERVER="gcc.gnu.org"
+GIT=${GIT:-git}
+# The server containing the GCC repository.
+GIT_SERVER="gcc.gnu.org"
 # The path to the repository on that server.
-SVN_REPOSITORY="/svn/gcc"
+GIT_REPOSITORY="/git/gcc.git"
 # The username to use when connecting to the server.
-SVN_USERNAME="${USER}"
+GIT_USERNAME="${USER}"
 
 # The machine to which files will be uploaded.
 GCC_HOSTNAME="gcc.gnu.org"
@@ -516,7 +566,7 @@ BRANCH=""
 
 # The name of the branch from which the release should be made, as used
 # for our version control system.
-SVNBRANCH=""
+GITBRANCH=""
 
 # The tag to apply to the sources used for the release.
 TAG=""
@@ -524,6 +574,9 @@ TAG=""
 # The old tarballs from which to generate diffs.
 OLD_TARS=""
 
+# Local gcc git checkout to speed up git cloning.
+GIT_REFERENCE=""
+
 # The directory that will be used to construct the release.  The
 # release itself will be placed in a subdirectory of this directory.
 DESTINATION=${HOME}
@@ -570,16 +623,16 @@ TAR="${TAR:-tar}"
 ########################################################################
 
 # Parse the options.
-while getopts "d:fr:u:t:p:s:l" ARG; do
+while getopts "d:fr:u:t:p:s:lb:" ARG; do
     case $ARG in
     d)    DESTINATION="${OPTARG}";;
     r)    RELEASE="${OPTARG}";;
     t)    TAG="${OPTARG}";;
-    u)    SVN_USERNAME="${OPTARG}";;
+    u)    GIT_USERNAME="${OPTARG}";;
     f)    FINAL=1;;
     s)    SNAPSHOT=1
           BRANCH=${OPTARG%:*}
-          SVNBRANCH=${OPTARG#*:}
+          GITBRANCH=${OPTARG#*:}
           ;;
     l)    LOCAL=1
          SCP=cp
@@ -588,6 +641,7 @@ while getopts "d:fr:u:t:p:s:l" ARG; do
           if [ ! -f ${OPTARG} ]; then
            error "-p argument must name a tarball"
          fi;;
+    b)    GIT_REFERENCE="${OPTARG}";;
     \?)   usage;;
     esac
 done
@@ -613,7 +667,7 @@ while [ $# -ne 0 ]; do
 done
 
 # Perform consistency checking.
-if [ ${LOCAL} -eq 0 ] && [ -z ${SVN_USERNAME} ]; then
+if [ ${LOCAL} -eq 0 ] && [ -z ${GIT_USERNAME} ]; then
   error "No username specified"
 fi
 
@@ -643,12 +697,8 @@ if [ $SNAPSHOT -eq 0 ]; then
   fi
 
   # Compute the name of the branch, which is based solely on the major
-  # and minor release numbers.
-  if [ ${RELEASE_MAJOR} -ge 5 ]; then
-    SVNBRANCH="branches/gcc-${RELEASE_MAJOR}-branch"
-  else
-    SVNBRANCH="branches/gcc-${RELEASE_MAJOR}_${RELEASE_MINOR}-branch"
-  fi
+  # release number.
+  GITBRANCH="releases/gcc-${RELEASE_MAJOR}"
 
   # If this is not a final release, set various parameters accordingly.
   if [ ${FINAL} -ne 1 ]; then
@@ -677,13 +727,13 @@ fi
 WORKING_DIRECTORY="${DESTINATION}/gcc-${RELEASE}"
 SOURCE_DIRECTORY="${WORKING_DIRECTORY}/gcc-${RELEASE}"
 
-# Set up SVNROOT.
+# Set up GITROOT.
 if [ $LOCAL -eq 0 ]; then
-    SVNROOT="svn+ssh://${SVN_USERNAME}@${SVN_SERVER}${SVN_REPOSITORY}"
+    GITROOT="git+ssh://${GIT_USERNAME}@${GIT_SERVER}${GIT_REPOSITORY}"
 else
-    SVNROOT="file:///svn/gcc"
+    GITROOT="/git/gcc.git"
 fi
-export SVNROOT
+export GITROOT
 
 ########################################################################
 # Main Program