cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject svn commit: r123108 - /cocoon/branches/BRANCH_2_1_X/tools/bin/create-repository-jars.sh
Date Wed, 22 Dec 2004 15:15:19 GMT
Author: giacomo
Date: Wed Dec 22 07:15:17 2004
New Revision: 123108

URL: http://svn.apache.org/viewcvs?view=rev&rev=123108
Log:
adapted to SVN
Modified:
   cocoon/branches/BRANCH_2_1_X/tools/bin/create-repository-jars.sh

Modified: cocoon/branches/BRANCH_2_1_X/tools/bin/create-repository-jars.sh
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/tools/bin/create-repository-jars.sh?view=diff&rev=123108&p1=cocoon/branches/BRANCH_2_1_X/tools/bin/create-repository-jars.sh&r1=123107&p2=cocoon/branches/BRANCH_2_1_X/tools/bin/create-repository-jars.sh&r2=123108
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/tools/bin/create-repository-jars.sh	(original)
+++ cocoon/branches/BRANCH_2_1_X/tools/bin/create-repository-jars.sh	Wed Dec 22 07:15:17 2004
@@ -22,46 +22,37 @@
 #   - build all jars and the war file
 #   - copy all jars and the war to the appropriate locations (repository structure)
 
-# The cvs repository name
-if [ "$REPOSITORY_NAME" = "" ]; then
-  REPOSITORY_NAME=cocoon-2.1
-fi
-
-# What is the default revision/branch/tag to use
-# In case of a HEAD revision a SNAPSHOT version will be created and
-# any old snapshots will be removed to save some space
-if [ "$REVISION" = "" ]; then
-  REVISION="" # it's a HEAD
-fi
-
-# What is the default CVSROOT to be used for checkout
-if [ "$CVSROOT" = "" ]; then
-  CVSROOT=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
-fi
-
-# Where is the local cocoon cvs repository we use to maintain.
-# If this directory doesn't exists it will do a 
-#   'cvs -d $CVSROOT co -Pd $LOCAL_REPOSITORY -r $REVISION $REPOSITORY_NAME'
-#   to create it.
-#   
-# If it exists it will do a 
-#   'cvs upd -dPACr $REVISION'
-#   in there to update to the requested revision (see REVISION below)
-if [ "$LOCAL_REPOSITORY" = "" ]; then
-  LOCAL_REPOSITORY=$HOME/cvs/cocoon-2.1
+# The path to the local repository we maintain
+if [ "$LOCAL_PATH" = "" ]; then
+  LOCAL_PATH="$PWD"
+fi
+
+# The base URL to the SVN repository
+if [ "$SVN_BASE_URL" = "" ]; then
+  SVN_BASE_URL=https://svn.apache.org/repos/asf/cocoon
 fi
 
 # On which host should the artifacts be published
-if [ "$REMOTEHOST" = "" ]; then
-  REMOTEHOST=www.apache.org
+if [ "$REMOTE_HOST" = "" ]; then
+  REMOTE_HOST=www.apache.org
+fi
+
+# The path to the remote repository
+if [ "$REMOTE_PATH" = "" ]; then
+  REMOTE_PATH=/www/www.apache.org/dist/java-repository/cocoon
 fi
 
-# Where is the path on the remote host the repository is located at
-if [ "$REMOTEPATH" = "" ]; then
-  REMOTEPATH=/www/www.apache.org/dist/java-repository/cocoon
+# The SVN URL part indicating the HEAD of development
+if [ "$HEAD_SUB_URL" = "" ]; then
+  HEAD_SUB_URL=branches/BRANCH_2_1_X
 fi
 
-# Where is the md5sum command to be used
+# The SVN URL part pointing to the revision/branch/tag to use
+if [ "$REVISION_SUB_URL" = "" ]; then
+  REVISION_SUB_URL=$HEAD_SUB_URL
+fi
+
+# The MD5 sum utility
 if [ "$MD5SUM" = "" ]; then
   MD5SUM=/sbin/md5
 fi
@@ -76,91 +67,98 @@
 $JAVA_HOME/bin/java -version
 
 # parse for options
-NOCVS=0
+NOSVN=0
 NOBUILD=0
 NOCLEAN=0
 NOJARS=0
 NOWAR=0
 BUILD_SRC_DIST=0
-while getopts ":BCdhJkW" option
+while getopts ":BdhJkSW" option
 do
   case $option in
     B) NOBUILD=1;;
-    C) NOCVS=1;;
     d) BUILD_SRC_DIST=1;;
-    h) echo "Usage: `basename $0` [-B] [-C] [-d] [-J] [-h] [-k] [-W] [RELEASE-TAG]"
+    h) echo "Usage: `basename $0` options [-S] [-B] [-h] [TAG-Path]"
+       echo "       -S          don't do a svn update"
        echo "       -B          don't do a build"
-       echo "       -C          don't do a cvs update"
        echo "       -d          build a src dist"
        echo "       -h          this usage note"
        echo "       -J          don't deploy the jar files"
        echo "       -k          keep the build tree (don't do a clean-dist)"
        echo "       -W          don't deploy the war file"
-       echo "       RELEASE-TAG the tag to do a cvs update for"
-       echo "                   if the RELEASE-TAG is HEAD a snapshot version"
+       echo "       TAG-Path    the path to do a svn Tag or Branch from (excluding the base
url)"
+       echo "                   if the TAG-Path equals to HEAD a snapshot version"
        echo "                   will be produced"
+       echo 
+       echo "   Settings:"
+       echo "      LOCAL_PATH:       $LOCAL_PATH"
+       echo "      SVN_BASE_URL:     $SVN_BASE_URL"
+       echo "      REMOTE_PATH:      $REMOTE_PATH"
+       echo "      HEAD_SUB_URL:     $HEAD_SUB_URL"
+       echo "      REVISION_SUB_URL: $REVISION_SUB_URL"
+       echo "      MD5SUM:           $MD5SUM"
+       echo "      JAVA_HOME:        $JAVA_HOME"
        exit 0
        ;;
     J) NOJARS=1;;
     k) NOCLEAN=1;;
+    S) NOSVN=1;;
     W) NOWAR=1;;
     *     ) echo "Unimplemented option $option chosen.";;
   esac
 done
-
 shift $(($OPTIND - 1))
-if [ "$1" != "" -a "$1" != "HEAD" ]; then
-  REVISION=$1
+
+# check if a different revision/branch/tag was specified on the command line
+if [ ! -z "$1" ]; then
+  REVISION_SUB_URL=$1
 fi
 
 # check if the local repository exists and do a checkout/update accordingly
-if [ -d "$LOCAL_REPOSITORY" ]; then
-  cd $LOCAL_REPOSITORY
-  if [ $NOCVS = 0 ]; then
+if [ -d "$LOCAL_PATH" ]; then
+  cd $LOCAL_PATH
+  if [ $NOSVN = 0 ]; then
     echo
-    echo "updating the local repository at $LOCAL_REPOSITORY with"
-    if [ "$REVISION" = "" ]; then
-      echo "    cvs up -dPAC"
-      echo
-      cvs up -dPAC
-    else
-      echo "    cvs up -dPACr $REVISION"
-      echo
-      cvs up -dPACr $REVISION
-    fi
+    echo "updating the local repository at $LOCAL_PATH with"
+    echo "    svn switch ${SVN_BASE_URL}/$REVISION_SUB_URL"
+    echo
+    svn switch ${SVN_BASE_URL}/$REVISION_SUB_URL
   fi
 else
-  DIRNAME=`dirname $LOCAL_REPOSITORY`
-  BASENAME=`basename $LOCAL_REPOSITORY`
+  DIRNAME=`dirname $LOCAL_PATH`
+  BASENAME=`basename $LOCAL_PATH`
   if [ ! -d $DIRNAME ]; then
     mkdir -p $DIRNAME 2>/dev/null >/dev/null
   fi
   cd $DIRNAME 
   echo
-  echo "checking out into the local repository at $LOCAL_REPOSITORY with "
-  if [ "$REVISION" = "" ]; then
-    echo "    cvs -d $CVSROOT co -Pd $LOCAL_REPOSITORY $REPOSITORY_NAME"
-    echo
-    cvs -d $CVSROOT co -Pd $BASENAME $REPOSITORY_NAME
-  else
-    echo "    cvs -d $CVSROOT co -Pd $LOCAL_REPOSITORY -r $REVISION $REPOSITORY_NAME"
-    echo
-    cvs -d $CVSROOT co -Pd $BASENAME -r $REVISION $REPOSITORY_NAME
-  fi
-  cd $LOCAL_REPOSITORY
+  echo "checking out into the local repository at $LOCAL_PATH with "
+  echo "    svn co ${SVN_BASE_URL}/$REVISION_SUB_URL $BASENAME"
+  echo
+  svn co ${SVN_BASE_URL}/$REVISION_SUB_URL $BASENAME
+  cd $LOCAL_PATH
 fi
 
 # cleanup the repository, prepare and do a build if not suppressed by command line option
-RC=0 # set in advace in case we don't do a build
-if [ $NOBUILD = 0 ]; then
-  # build the local.blocks.properties file
+if [ "$NOBUILD" -eq 0 ]; then
+  echo
+  echo "clean the local repository"
+  echo
+  ./build.sh clean-dist 
+  find . -type f -name "*~" | xargs rm -f 2>/dev/null 1>/dev/null
+  find . -type f -name ".#*" | xargs rm -f 2>/dev/null 1>/dev/null
+  find . -type f -name "#*#" | xargs rm -f 2>/dev/null 1>/dev/null
+  find . -type f -name "*.bak" | xargs rm -f 2>/dev/null 1>/dev/null
+  find . -type f -name "*.BAK" | xargs rm -f 2>/dev/null 1>/dev/null
+
+  # build the blocks.properties file
   echo
   echo "generating local.blocks.properties file"
   echo
   cat blocks.properties \
     >local.blocks.properties
 
-  # build the local.build.properties file
+  # build the build.properties file
   echo
   echo "generating local.build.properties file"
   echo
@@ -168,11 +166,15 @@
     | sed 's/#exclude.webapp.documentation/exclude.webapp.documentation/' \
     | sed 's/#exclude.webapp.javadocs/exclude.webapp.javadocs/' \
     | sed 's/#exclude.webapp.samples/exclude.webapp.samples/' \
+    | sed 's/#exclude.webapp.test-suite/exclude.webapp.test-suite/' \
     | sed 's/#exclude.documentation/exclude.documentation/' \
     | sed 's/#exclude.javadocs/exclude.javadocs/' \
-    | sed 's/#exclude.validate.xdocs/exclude.validate.xdocs/' \
     | sed 's/#config.allow-reloads/config.allow-reloads/' \
-    | sed 's/#config.enable-uploads/config.enable-uploads/' >local.build.properties
+    | sed 's/#config.enable-uploads/config.enable-uploads/' \
+    | sed 's/#exclude.validate.config/exclude.validate.config/' \
+    | sed 's/#exclude.validate.xdocs/exclude.validate.xdocs/' \
+    | sed 's/#exclude.validate.jars/exclude.validate.jars/' \
+    >local.build.properties
 
   # build everything
   echo
@@ -184,9 +186,9 @@
     CLEAN=""
   fi
   echo
-  ./build.sh $CLEAN webapp war | tee $LOCAL_REPOSITORY/build.log
+  ./build.sh $CLEAN webapp war | tee $LOCAL_PATH/build.log
   # The build script dosn't report on failures so we have to do that by hand
-  tail -10 $LOCAL_REPOSITORY/build.log|grep "BUILD SUCCESSFUL"
+  tail -10 $LOCAL_PATH/build.log|grep "BUILD SUCCESSFUL"
   if [ $? = 0 ]; then
     RC=0
   else
@@ -199,9 +201,9 @@
   exit $RC
 fi
 
-# copy all the jars produced over to the remote repository space
+# copy all the jars produced over to the web server space
 VERSION=`ls build | grep cocoon | sed s/cocoon-//`
-if [ "$REVISION" = "" ]; then 
+if [ "$REVISION_SUB_URL" == "$HEAD_SUB_URL" ]; then 
   TVERSION=`date "+%Y%m%d.%H%M%S"` 
 else
   TVERSION=$VERSION
@@ -209,8 +211,8 @@
 
 if [ $NOJARS = 0 ]; then
   # create the target directory if they do not exists and make them group writable
-  ssh $REMOTEHOST "mkdir -p $REMOTEPATH/jars 2>/dev/null >/dev/null; \
-                 chmod -R g+w $REMOTEPATHi/jars"
+  ssh $REMOTE_HOST "mkdir -p $REMOTE_PATH/jars 2>/dev/null >/dev/null; \
+                 chmod -R g+w $REMOTE_PATH/jars"
   JARS=`find build/cocoon-$VERSION -name "*.jar"`
   for i in $JARS; do
     FILE=`echo $i | sed 's/.*[/]//' | sed s/[.]jar//`
@@ -220,73 +222,95 @@
     else
       BLOCKPART=`echo $FILE | sed 's/cocoon//'`
     fi
-    if [ "$REVISION" = "" ]; then
+    if [ "$REVISION_SUB_URL" == "$HEAD_SUB_URL" ]; then
       # remove all snapshots in the remote repository
-      SNAPSHOT=`ssh $REMOTEHOST "ls $REMOTEPATH/jars/cocoon$BLOCKPART-????????.??????.jar
2>/dev/null"` 
+      SNAPSHOT=`ssh $REMOTE_HOST "ls $REMOTE_PATH/jars/cocoon$BLOCKPART-????????.??????.jar
2>/dev/null"` 
     fi
-    scp $i $REMOTEHOST:$REMOTEPATH/jars/cocoon$BLOCKPART-$TVERSION.jar
-    if [ "$REVISION" = "" ]; then
+    scp $i $REMOTE_HOST:$REMOTE_PATH/jars/cocoon$BLOCKPART-$TVERSION.jar
+    if [ "$REVISION_SUB_URL" == "$HEAD_SUB_URL" ]; then
       if [ ! -z "$SNAPSHOT" ]; then
-        RM="rm $SNAPSHOT;"
+        RM="rm ${SNAPSHOT}\*;\
+	    rm $REMOTE_PATH/jars/cocoon$BLOCKPART-snapshot.version;"
       else
         RM=""
       fi
       CMD="$RM \
-           cd $REMOTEPATH/jars; \
-           ln -fs cocoon$BLOCKPART-$TVERSION.jar cocoon$BLOCKPART-SNAPSHOT.jar; \
+           cd $REMOTE_PATH/jars; \
+           rm cocoon$BLOCKPART-SNAPSHOT.jar; \
+           ln -s cocoon$BLOCKPART-$TVERSION.jar cocoon$BLOCKPART-SNAPSHOT.jar; \
            echo $TVERSION >cocoon$BLOCKPART-snapshot.version;"
     else
       CMD=""
     fi
-    ssh $REMOTEHOST "$CMD \
-                     $MD5SUM <$REMOTEPATH/jars/cocoon$BLOCKPART-$TVERSION.jar | \
-                       sed 's/ .*$//' >$REMOTEPATH/jars/cocoon$BLOCKPART-$TVERSION.jar.md5;
\
-                     chmod g+w $REMOTEPATH/jars/cocoon$BLOCKPART-$TVERSION.*"
+    ssh $REMOTE_HOST "$CMD \
+                      $MD5SUM <$REMOTE_PATH/jars/cocoon$BLOCKPART-$TVERSION.jar | \
+                      sed 's/ .*$//' >$REMOTE_PATH/jars/cocoon$BLOCKPART-$TVERSION.jar.md5;
\
+                      chmod g+w $REMOTE_PATH/jars/cocoon$BLOCKPART-$TVERSION.*"
   done
 fi
 
 # copy the war file to the web space
 if [ "$NOWAR" = "0" ]; then
   # create the target directory if they do not exists and make them group writable
-  ssh $REMOTEHOST "mkdir -p $REMOTEPATH/wars 2>/dev/null >/dev/null; \
-                   chmod -R g+w $REMOTEPATH/wars"
+  ssh $REMOTE_HOST "mkdir -p $REMOTE_PATH/wars 2>/dev/null >/dev/null; \
+                   chmod -R g+w $REMOTE_PATH/wars"
   WAR=build/cocoon-$VERSION/cocoon.war
-  if [ "$REVISION" = "" ]; then
-    SNAPSHOT=`ssh $REMOTEHOST "ls $REMOTEPATH/wars/cocoon-war-????????.??????.war 2>/dev/null"`

+  if [ "$REVISION_SUB_URL" == "$HEAD_SUB_URL" ]; then
+    SNAPSHOT=`ssh $REMOTE_HOST "ls $REMOTE_PATH/wars/cocoon-war-????????.??????.war 2>/dev/null"`

   fi
-  scp $WAR $REMOTEHOST:$REMOTEPATH/wars/cocoon-war-$TVERSION.war
-  if [ "$REVISION" = "" ]; then
+  scp $WAR $REMOTE_HOST:$REMOTE_PATH/wars/cocoon-war-$TVERSION.war
+  if [ "$REVISION_SUB_URL" == "$HEAD_SUB_URL" ]; then
     if [ ! -z "$SNAPSHOT" ]; then
-      RM="rm $SNAPSHOT;"
+      RM="rm ${SNAPSHOT}\*;\
+          rm $REMOTE_PATH/wars/cocoon-war-snapshot.version;"
     else
       RM=""
     fi
     CMD="$RM \
-         cd $REMOTEPATH/wars; \
-         ln -fs cocoon-war-$TVERSION.war cocoon-war-SNAPSHOT.war; \
+         cd $REMOTE_PATH/wars; \
+         rm cocoon$BLOCKPART-SNAPSHOT.war; \
+         ln -s cocoon-war-$TVERSION.war cocoon-war-SNAPSHOT.war; \
          echo $TVERSION >cocoon-war-snapshot.version;"
   else
     CMD=""
   fi
-  ssh $REMOTEHOST "$CMD \
-                   $MD5SUM <$REMOTEPATH/wars/cocoon-war-$TVERSION.war | \
-                     sed 's/ .*$//' >$REMOTEPATH/jars/cocoon-war-$TVERSION.jar.md5; \
-                   chmod g+w $REMOTEPATH/jars/cocoon-war-$TVERSION.*"
+  ssh $REMOTE_HOST "$CMD \
+                    $MD5SUM <$REMOTE_PATH/wars/cocoon-war-$TVERSION.war | \
+                    sed 's/ .*$//' >$REMOTE_PATH/wars/cocoon-war-$TVERSION.war.md5; \
+                    chmod g+w $REMOTE_PATH/wars/cocoon-war-$TVERSION.*"
 fi
 
 # create a distribution
 if [ "$BUILD_SRC_DIST" = "1" ]; then
   # create the target directory if they do not exists and make them group writable
-  ssh $REMOTEHOST "mkdir -p $REMOTEPATH/distributions 2>/dev/null >/dev/null; \
-                   chmod -R g+w $REMOTEPATH/distributions"
-  ./build.sh clean-dist
-  cd ..
-  if [ "$REVISION" = "" ]; then
-    TVERSION=SNAPSHOT
+  ssh $REMOTE_HOST "mkdir -p $REMOTE_PATH/distributions 2>/dev/null >/dev/null; \
+                   chmod -R g+w $REMOTE_PATH/distributions"
+  ./build.sh dist
+  cd dist
+  if [ "$REVISION_SUB_URL" == "$HEAD_SUB_URL" ]; then
+    SNAPSHOT=`ssh $REMOTE_HOST "ls $REMOTE_PATH/distributions/cocoon-src-????????.??????.zip
2>/dev/null"` 
+    if [ ! -z "$SNAPSHOT" ]; then
+      RM="rm ${SNAPSHOT}\*;\
+	  rm $REMOTE_PATH/distributions/cocoon-src-snapshot.version;"
+    else
+      RM=""
+    fi
+    CMD="$RM \
+         cd $REMOTE_PATH/distributions; \
+         rm cocoon-src-SNAPSHOT.zip; \
+         ln -s cocoon-src-$TVERSION.zip cocoon-src-SNAPSHOT.zip; \
+         echo $TVERSION >cocoon-src-snapshot.version;"
+    ln -s cocoon-$TVERSION cocoon-src-SNAPSHOT
+    zip -qr $REMOTE_PATH/distributions/cocoon-src-$TVERSION.zip cocoon-src-SNAPSHOT
+  else
+    CMD=""
+    ln -s cocoon-$TVERSION cocoon-src-$TVERSION
+    zip -qr cocoon-src-$TVERSION.zip cocoon-src-$TVERSION
   fi
-  ln -sf $REPOSITORY_NAME cocoon-src-$TVERSION
-  zip -r cocoon-src-$TVERSION.zip cocoon-src-$TVERSION
-  rm cocoon-src-$TVERSION
-  scp cocoon-src-$TVERSION.zip $REMOTEHOST:$REMOTEPATH/distributions/cocoon-src-$TVERSION.zip
-  rm cocoon-src-$TVERSION.zip
+  scp cocoon-src-$TVERSION.zip $REMOTE_HOST:$REMOTE_PATH/distributions/cocoon-src-$TVERSION.zip
+  ssh $REMOTE_HOST "$CMD \
+                    $MD5SUM <$REMOTE_PATH/distributions/cocoon-src-$TVERSION.zip | \
+                    sed 's/ .*$//' >$REMOTE_PATH/distributions/cocoon-src-$TVERSION.zip.md5;
\
+                    chmod g+w $REMOTE_PATH/distributions/cocoon-src-$TVERSION.zip*"
+    
 fi

Mime
View raw message