This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch for snapshot generation from gccadmin with gcc_release


This patch makes gcc_release usable for generating the weekly
snapshots, so allowing that process to move to gccadmin and obsoleting
the old csh script currently used.  OK to copy contrib/gcc_release
from the 3.0 branch to maintainer-scripts/ on the mainline and apply
this patch there?

The old cron job running snapshots from law's crontab should now be
removed - could someone send me the exact crontab entry?  I'll then make
them run from gccadmin's crontab at the same time (but running
"/home/gccadmin/scripts/gcc_release -s -l -d /var/tmp all" as the
command).

Note: this version still generates snapshots from the 3.0 branch.  I
think it's about time that they moved back to the mainline; making
that move will require the obvious changes to add support for
generating a gcc-ada tarball.

Note: the ftp disk is 98% full; probably some of the 3.0 and 3.0.1
prereleases should be removed.

2001-10-08  Joseph S. Myers  <jsm28@cam.ac.uk>

	* gcc_release: Copy from 3.0 branch.  Add support for building the
	weekly snapshots on gcc.gnu.org.

--- gcc_release.orig	Fri Aug 24 23:52:11 2001
+++ gcc_release	Sun Oct  7 23:45:22 2001
@@ -69,7 +69,7 @@
 		[-r release]
 		[-t tag]
 		[-p previous-tarball]
-		[-s] [-f]
+		[-s] [-f] [-l]
 EOF
     exit 1
 }
@@ -114,7 +114,7 @@
            error "Could not check out release sources"
     for x in `find ${SOURCE_DIRECTORY} -name ChangeLog`; do
       cat - ${x} > ${x}.new <<EOF
-`date "+%Y-%m-%d"`  Release Manager
+${LONG_DATE}  Release Manager
 
 	* GCC ${RELEASE} Released.
 
@@ -338,13 +338,18 @@
 
   changedir "${WORKING_DIRECTORY}"
 
+  if [ $LOCAL -ne 0 ]; then
+    mkdir -p "${FTP_PATH}" \
+      || error "Could not create \`${FTP_PATH}'"
+  fi
+
   # Copy the tar files to the FTP server.
   for x in gcc*.gz gcc*.bz2; do
     if [ -e ${x} ]; then
       # Make sure the file will be readable on the server.
       chmod a+r ${x}
       # Copy it.
-      ${SCP} -p ${x} ${FTP_PATH} || \
+      ${SCP} ${x} ${FTP_PATH} || \
         error "Could not upload ${x}"
     fi
   done
@@ -356,6 +361,7 @@
 
 # Today's date.
 DATE=`date "+%Y%m%d"`
+LONG_DATE=`date "+%Y-%m-%d"`
 
 # The CVS server containing the GCC repository.
 CVS_SERVER="gcc.gnu.org"
@@ -413,6 +419,10 @@
 # include generated files.
 SNAPSHOT=0
 
+# Non-zero if we are running locally on gcc.gnu.org, and use local CVS
+# and copy directly to the FTP directory.
+LOCAL=0
+
 # Major operation modes.
 MODE_SOURCES=0
 MODE_TARFILES=0
@@ -428,7 +438,7 @@
 DIFF="${DIFF:-diff -Nrc3pad}"
 ENV="${ENV:-env}"
 GZIP="${GZIP:-gzip --best}"
-SCP="${SCP:-scp}"
+SCP="${SCP:-scp -p}"
 TAR="${TAR:-tar}"
 
 ########################################################################
@@ -436,7 +446,7 @@
 ########################################################################
 
 # Parse the options.
-while getopts "d:fr:u:t:p:s" ARG; do
+while getopts "d:fr:u:t:p:sl" ARG; do
     case $ARG in
     d)    DESTINATION="${OPTARG}";;
     r)    RELEASE="${OPTARG}";;
@@ -444,6 +454,10 @@
     u)    CVS_USERNAME="${OPTARG}";;
     f)    FINAL=1;;
     s)    SNAPSHOT=1;;
+    l)    LOCAL=1
+	  SCP=cp
+	  FTP_PATH=~ftp/pub/gcc
+	  PATH=~:$PATH;;
     p)    OLD_TARS="${OLD_TARS} ${OPTARG}";;
     \?)   usage;;
     esac
@@ -455,40 +469,58 @@
   error "No username specified"
 fi
 
-if [ -z ${RELEASE} ]; then
-  error "No release number specified"
-fi
-
 if [ ! -d ${DESTINATION} ]; then
   error "\`${DESTINATION}' is not a directory"
 fi
 
-# Compute the major and minor release numbers.
-RELEASE_MAJOR=`echo $RELEASE | awk --assign FS=. '{ print $1; }'`
-RELEASE_MINOR=`echo $RELEASE | awk --assign FS=. '{ print $2; }'`
-RELEASE_REVISION=`echo $RELEASE | awk --assign FS=. '{ print $3; }'`
+if [ $SNAPSHOT -eq 0 ]; then
+  if [ -z ${RELEASE} ]; then
+    error "No release number specified"
+  fi
 
-if [ -z "${RELEASE_MAJOR}" ] || [ -z "${RELEASE_MINOR}" ]; then
-  error "Release number \`${RELEASE}' is invalid"
-fi
+  # Compute the major and minor release numbers.
+  RELEASE_MAJOR=`echo $RELEASE | awk --assign FS=. '{ print $1; }'`
+  RELEASE_MINOR=`echo $RELEASE | awk --assign FS=. '{ print $2; }'`
+  RELEASE_REVISION=`echo $RELEASE | awk --assign FS=. '{ print $3; }'`
 
-# Compute the full name of the release.
-if [ -z "${RELEASE_REVISION}" ]; then
-  RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}"
-else
-  RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_REVISION}"
-fi
+  if [ -z "${RELEASE_MAJOR}" ] || [ -z "${RELEASE_MINOR}" ]; then
+    error "Release number \`${RELEASE}' is invalid"
+  fi
 
-# Compute the name of the branch, which is based solely on the major
-# and minor release numbers.
-BRANCH="gcc-${RELEASE_MAJOR}_${RELEASE_MINOR}-branch"
-
-# If this is not a final release, set various parameters acordingly.
-if [ ${FINAL} -ne 1 ]; then
-  RELEASE="${RELEASE}-${DATE}"
-  FTP_PATH="${FTP_PATH}/snapshots"
+  # Compute the full name of the release.
+  if [ -z "${RELEASE_REVISION}" ]; then
+    RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}"
+  else
+    RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_REVISION}"
+  fi
+
+  # Compute the name of the branch, which is based solely on the major
+  # and minor release numbers.
+  BRANCH="gcc-${RELEASE_MAJOR}_${RELEASE_MINOR}-branch"
+
+  # If this is not a final release, set various parameters acordingly.
+  if [ ${FINAL} -ne 1 ]; then
+    RELEASE="${RELEASE}-${DATE}"
+    FTP_PATH="${FTP_PATH}/snapshots"
+  else
+    FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}"
+  fi
 else
-  FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}"
+  RELEASE=$DATE
+  # For now snapshots come from the 3.0 branch.
+  BRANCH=gcc-3_0-branch
+  FTP_PATH="${FTP_PATH}/snapshots/${LONG_DATE}"
+  TAG=gcc_ss_${DATE}
+
+  # Building locally on gcc.gnu.org, we know what the last snapshot date
+  # was.
+  if [ $LOCAL -ne 0 ]; then
+    LAST_DATE=`cat ~/.snapshot_date`
+    PREV_LAST_DATE=`cat ~/.prev_snapshot_date`
+    LAST_LONG_DATE=`date --date=$LAST_DATE +%Y-%m-%d`
+    LAST_DIR=~ftp/pub/gcc/snapshots/${LAST_LONG_DATE}
+    OLD_TARS=${LAST_DIR}/gcc-${LAST_DATE}.tar.gz
+  fi
 fi
 
 # Compute the name of the WORKING_DIRECTORY and the SOURCE_DIRECTORY.
@@ -504,8 +536,12 @@
 TESTSUITE_DIRS=`adjust_dirs ${TESTSUITE_DIRS}`
 
 # Set up CVSROOT.
-CVSROOT=":${CVS_PROTOCOL}:${CVS_USERNAME}@"
-CVSROOT="${CVSROOT}${CVS_SERVER}:${CVS_REPOSITORY}"
+if [ $LOCAL -eq 0 ]; then
+    CVSROOT=":${CVS_PROTOCOL}:${CVS_USERNAME}@"
+    CVSROOT="${CVSROOT}${CVS_SERVER}:${CVS_REPOSITORY}"
+else
+    CVSROOT="${CVS_REPOSITORY}"
+fi
 export CVSROOT
 
 ########################################################################
@@ -540,4 +576,38 @@
 
 if [ $MODE_UPLOAD -ne 0 ]; then
   upload_files
+
+  # For snapshots, make some further updates.
+  if [ $SNAPSHOT -ne 0 ] && [ $LOCAL -ne 0 ]; then
+    # Update links on the FTP server.
+    TEXT_DATE=`date --date=$DATE +%B\ %d,\ %Y`
+    LAST_TEXT_DATE=`date --date=$LAST_DATE +%B\ %d,\ %Y`
+    cd ~ftp/pub/gcc/snapshots
+    sed -e "s%$LAST_DATE%$DATE%g" -e "s%$PREV_LAST_DATE%$LAST_DATE%g" \
+      -e "s%$LAST_LONG_DATE%$LONG_DATE%g" \
+      -e "s%$LAST_TEXT_DATE%$TEXT_DATE%g" < README > $$
+    mv $$ README
+    sed -e "s%$LAST_DATE%$DATE%g" -e "s%$PREV_LAST_DATE%$LAST_DATE%g" \
+      -e "s%$LAST_LONG_DATE%$LONG_DATE%g" \
+      -e "s%$LAST_TEXT_DATE%$TEXT_DATE%g" < index.html > $$
+    mv $$ index.html
+
+    touch LATEST-IS-$LONG_DATE
+    rm -f LATEST-IS-$LAST_LONG_DATE
+
+    # Update snapshot date file.
+    changedir ~
+    mv .snapshot_date .prev_snapshot_date
+    echo $DATE >.snapshot_date
+
+    # Update gcc_latest_snapshot tag.
+    ${CVS} rtag -d gcc_latest_snapshot gcc
+    ${CVS} rtag -rgcc_ss_${DATE} gcc_latest_snapshot gcc
+
+    # Announce the snapshot.
+    mail -s "gcc-ss-$DATE is now available" gcc@gcc.gnu.org < ~ftp/pub/gcc/snapshots/README
+
+    # Remove working directory
+    rm -rf ${WORKING_DIRECTORY}
+  fi
 fi

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]