giacomo     2004/02/04 08:09:11

  Modified:    tools/bin create-repository-jars.sh
  Log:
  more options added
  
  Revision  Changes    Path
  1.8       +88 -54    cocoon-2.1/tools/bin/create-repository-jars.sh
  
  Index: create-repository-jars.sh
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/tools/bin/create-repository-jars.sh,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -d -b -u -r1.7 -r1.8
  --- create-repository-jars.sh 2 Feb 2004 20:28:03 -0000       1.7
  +++ create-repository-jars.sh 4 Feb 2004 16:09:11 -0000       1.8
  @@ -66,32 +66,39 @@
   NOCVS=0
   NOBUILD=0
   NOCLEAN=0
  -while getopts ":CkBh" option
  +NOJARS=0
  +NOWAR=0
  +BUILD_SRC_DIST=0
  +while getopts ":BCdhJkW" option
   do
     case $option in
  -    C) NOCVS=1;;
  -    k) NOCLEAN=1;;
       B) NOBUILD=1;;
  -    h) echo "Usage: `basename $0` [-C] [-k] [-B] [-h] [RELEASE-TAG]"
  -       echo "       -C          don't do a cvs update"
  -       echo "       -k          keep the build tree (don't do a clean-dist)"
  +    C) NOCVS=1;;
  +    d) BUILD_SRC_DIST=1;;
  +    h) echo "Usage: `basename $0` [-B] [-C] [-d] [-J] [-h] [-k] [-W] 
[RELEASE-TAG]"
          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 "                   will be produced"
          exit 0
          ;;
  +    J) NOJARS=1;;
  +    k) NOCLEAN=1;;
  +    W) NOWAR=1;;
       *     ) echo "Unimplemented option $option chosen.";;
     esac
   done
   
   shift $(($OPTIND - 1))
  -
  -# 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; \
  -                 mkdir -p $REMOTEPATH/wars 2>/dev/null >/dev/null; \
  -                 chmod -R g+w $REMOTEPATH"
  +if [ "$1" != "" ]; then
  +  REVISION=$1
  +fi
   
   # check if the local repository exists and do a checkout/update accordingly
   if [ -d "$LOCAL_REPOSITORY" ]; then
  @@ -167,15 +174,20 @@
     exit $RC
   fi
   
  -# copy all the jars produced over to the iremote repository space
  +# copy all the jars produced over to the remote repository space
   VERSION=`ls build | grep cocoon | sed s/cocoon-//`
   if [ "$REVISION" = "HEAD" ]; then 
     TVERSION=`date "+%Y%m%d.%H%M%S"` 
   else
     TVERSION=$VERSION
   fi
  -JARS=`find build/cocoon-$VERSION -name "*.jar"`
  -for i in $JARS; do
  +
  +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"
  +  JARS=`find build/cocoon-$VERSION -name "*.jar"`
  +  for i in $JARS; do
     FILE=`echo $i | sed 's/.*[/]//' | sed s/[.]jar//`
     isBlock=`echo $FILE|grep block`
     if [ ! -z "$isBlock" ]; then
  @@ -205,15 +217,20 @@
                      $MD5SUM <$REMOTEPATH/jars/cocoon$BLOCKPART-$TVERSION.jar 
| \
                        sed 's/ .*$//' 
>$REMOTEPATH/jars/cocoon$BLOCKPART-$TVERSION.jar.md5; \
                      chmod g+w $REMOTEPATH/jars/cocoon$BLOCKPART-$TVERSION.*"
  -done
  +  done
  +fi
   
   # copy the war file to the web space
  -WAR=build/cocoon-$VERSION/cocoon.war
  -if [ "$REVISION" = "HEAD" ]; then
  +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"
  +  WAR=build/cocoon-$VERSION/cocoon.war
  +  if [ "$REVISION" = "HEAD" ]; then
     SNAPSHOT=`ssh $REMOTEHOST "ls 
$REMOTEPATH/wars/cocoon-war-????????.??????.war 2>/dev/null"` 
  -fi
  -scp $WAR $REMOTEHOST:$REMOTEPATH/wars/cocoon-war-$TVERSION.war
  -if [ "$REVISION" = "HEAD" ]; then
  +  fi
  +  scp $WAR $REMOTEHOST:$REMOTEPATH/wars/cocoon-war-$TVERSION.war
  +  if [ "$REVISION" = "HEAD" ]; then
     if [ ! -z "$SNAPSHOT" ]; then
       RM="rm $SNAPSHOT;"
     else
  @@ -223,11 +240,28 @@
          cd $REMOTEPATH/wars; \
          ln -fs cocoon-war-$TVERSION.war cocoon-war-SNAPSHOT.war; \
          echo $TVERSION >cocoon-war-snapshot.version;"
  -else
  +  else
     CMD=""
  -fi
  -ssh $REMOTEHOST "$CMD \
  -                 $MD5SUM <$REMOTEPATH/wars/cocoon-war-$TVERSION.jar | \
  +  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.*"
  +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" = "HEAD" ]; then
  +    TVERSION=SNAPSHOT
  +  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
  +fi
  
  
  

Reply via email to