You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by db...@apache.org on 2005/04/26 03:37:21 UTC

svn commit: r164708 - in /geronimo/scripts: NOTICE.txt buildall.sh publish_build.sh

Author: dblevins
Date: Mon Apr 25 18:37:21 2005
New Revision: 164708

URL: http://svn.apache.org/viewcvs?rev=164708&view=rev
Log:
David Jencks' buildall.sh.

A script for building archives that are versioned with the svn revision number.  It's not called nightly_build.sh as it really doesn't have to be run nightly, we can just run it whenever we feel we have a good build or important changes people may want.


Added:
    geronimo/scripts/NOTICE.txt
    geronimo/scripts/buildall.sh   (with props)
    geronimo/scripts/publish_build.sh   (with props)

Added: geronimo/scripts/NOTICE.txt
URL: http://svn.apache.org/viewcvs/geronimo/scripts/NOTICE.txt?rev=164708&view=auto
==============================================================================
--- geronimo/scripts/NOTICE.txt (added)
+++ geronimo/scripts/NOTICE.txt Mon Apr 25 18:37:21 2005
@@ -0,0 +1,7 @@
+**********************************************************************
+The scripts in this directory are not supported!
+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+The only supported way to build Geronimo is through maven directly.
+The scripts in this directory are for your convenience and are not
+guaranteed to work on every platform or any version of Geronimo.
+**********************************************************************

Added: geronimo/scripts/buildall.sh
URL: http://svn.apache.org/viewcvs/geronimo/scripts/buildall.sh?rev=164708&view=auto
==============================================================================
--- geronimo/scripts/buildall.sh (added)
+++ geronimo/scripts/buildall.sh Mon Apr 25 18:37:21 2005
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+#  Copyright 2005 The Apache Software Foundation
+# 
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# $Rev$ $Date$
+
+#script to build geronimo, tranql, tranql-connector, and openejb in a reasonable order
+
+echo "To deploy use the command line ./buildall.sh [clean] deploy <your apache/codehaus username>"
+
+set -e
+
+MAVEN_REPO=~/.maven/repository
+
+OFFLINE=
+
+TRANQL=tranql/tranql
+TRANQLCONNECTOR=tranql/connector
+OPENEJB=openejb
+
+if [ "$1" = clean ]; then
+  shift
+  echo cleaning...
+  (cd specs;maven $OFFLINE multiproject:clean)
+  (if [ -d $TRANQL ]; then cd $TRANQL ; maven $OFFLINE  clean; fi)
+  (if [ -d $TRANQLCONNECTOR ]; then cd $TRANQLCONNECTOR; maven $OFFLINE  clean; fi)
+  (cd modules; maven $OFFLINE  multiproject:clean)
+  (cd plugins; maven $OFFLINE multiproject:clean)
+  (cd applications; maven $OFFLINE multiproject:clean)
+  (if [ -d $OPENEJB ]; then cd $OPENEJB/modules; maven $OFFLINE  multiproject:clean; fi)
+  (cd modules/assembly; maven $OFFLINE  clean)
+  (if [ -d $OPENEJB ]; then cd openejb/modules/assembly; maven $OFFLINE  clean; fi)
+  (if [ -d $OPENEJB ]; then cd openejb/modules/itests; maven $OFFLINE clean; fi )
+fi
+
+echo updating
+svn up
+(if [ -d $TRANQL ]; then cd $TRANQL ; cvs -q up -dP; fi)
+(if [ -d $TRANQLCONNECTOR ]; then cd $TRANQLCONNECTOR; cvs -q up -dP; fi)
+(if [ -d $OPENEJB ]; then cd $OPENEJB; cvs -q up -dP; fi)
+
+echo cleaning local repo
+rm -rf  $MAVEN_REPO/geronimo
+rm -rf  $MAVEN_REPO/geronimo-spec
+if [ -d $TRANQL ]; then rm -rf $MAVEN_REPO/tranql; fi
+if [ -d $OPENEJB ]; then rm -rf $MAVEN_REPO/openejb; fi
+
+OFFLINE=-o
+
+echo building
+(cd specs;maven $OFFLINE multiproject:install)
+(if [ -d $TRANQL ]; then cd $TRANQL ; maven $OFFLINE  jar:install; fi)
+(if [ -d $TRANQLCONNECTOR ]; then cd $TRANQLCONNECTOR; maven $OFFLINE  rar:install; fi)
+(cd plugins/maven-xmlbeans-plugin; maven -o plugin:install);
+(cd modules; maven $OFFLINE  multiproject:install)
+(cd plugins; maven $OFFLINE multiproject:install)
+(cd applications; maven $OFFLINE multiproject:install)
+(if [ -d $OPENEJB ]; then cd $OPENEJB/modules; maven $OFFLINE  multiproject:install; fi)
+(cd modules/assembly; maven $OFFLINE  jar:install)
+(if [ -d $OPENEJB ]; then cd openejb/modules/assembly; maven $OFFLINE  jar:install; fi)
+#(if [ -d $OPENEJB ]; then cd openejb/modules/itests; maven $OFFLINE; fi )
+
+if [ "$1" = deploy ]; then
+  echo deploying
+  (cd specs;maven -o -Duser.name=$2 multiproject:deploy)
+  (if [ -d $TRANQL ]; then cd $TRANQL ; maven -o -Duser.name=$2 jar:deploy; fi)
+  (if [ -d $TRANQLCONNECTOR ]; then cd $TRANQLCONNECTOR; maven -o -Duser.name=$2  jar:deploy  rar:deploy; fi)
+  (cd modules; maven -o -Duser.name=$2  multiproject:deploy)
+  (if [ -d $OPENEJB ]; then cd $OPENEJB/modules; maven -o -Duser.name=$2   multiproject:deploy; fi)
+  (cd modules/assembly; maven -o -Duser.name=$2   jar:deploy)
+  (if [ -d $OPENEJB ]; then cd openejb/modules/assembly; maven -o -Duser.name=$2   jar:deploy; fi)
+fi

Propchange: geronimo/scripts/buildall.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/scripts/publish_build.sh
URL: http://svn.apache.org/viewcvs/geronimo/scripts/publish_build.sh?rev=164708&view=auto
==============================================================================
--- geronimo/scripts/publish_build.sh (added)
+++ geronimo/scripts/publish_build.sh Mon Apr 25 18:37:21 2005
@@ -0,0 +1,192 @@
+#!/usr/local/bin/bash
+#
+#  Copyright 2005 The Apache Software Foundation
+# 
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# --------------------------------------------------------------------
+# $Rev$ $Date$
+# --------------------------------------------------------------------
+
+PROJ=geronimo
+BIN_DIR=${2:-modules/assembly/target}
+DIST=${3:-$PWD/dist}
+
+#  Make the DIST directory if it isn't present
+test -d $DIST || mkdir $DIST
+
+#  The public repo url for geronimo
+SVN_URL="http://svn.apache.org/repos/asf/$PROJ"
+
+#  If we need to SSH up to the server where the builds are published
+#  These three varaibles will be used to find the host 
+REMOTE_USER=dblevins
+REMOTE_HOST=apache.org
+
+#  This is where we should place our unstable, non-release builds
+#  We aren't labeling the releases by date, rather by svn revision, so
+#  we put them in a directory called 'unstable' rather than 'nightly'
+#  It's fine as we really don't even need to run this script nightly and
+#  can instead opt to run it just when we think we think things are in a 
+#  relatively good state.
+RELEASE_DIR=/www/cvs.apache.org/dist/$PROJ/unstable
+
+#  Get the current svn revision number for geronimo
+#  Example: 123456
+SVN_VERSION=$(wget -q -O - $SVN_URL/trunk | grep title | sed 's/[^0-9]//g')
+
+#  The version of geronimo we are building.  In the future we may have nightly builds
+#  of 1.0 and 2.0 going at the same time, so it's nice to include that in the build name
+VN='1.0'
+
+#  Example value: 1.0-123456
+VERSION="$VN-$SVN_VERSION"
+
+#  Example value: geronimo-1.0-123456
+RELEASE_ID="$PROJ-$VERSION"
+
+#  Example value: /www/cvs.apache.org/dist/geronimo/unstable/geronimo-1.0-123456
+VERSION_DIR="$RELEASE_DIR/$VERSION"
+
+echo "$RELEASE_ID"
+    
+### Utility functions ########
+function shash { openssl $1 < $2 > $2.$1 ;}
+function fail () { echo $1 >&2; exit 1;}
+function package () { 
+    DEST=$1; SOURCE=$2
+    tar czf $DEST.tar.gz $SOURCE
+    zip -9rq $DEST.zip $SOURCE
+}
+function replace_version { # VERSION, PROJ
+    local PROJ=${1?Must specify a project name}
+    local VERSION=${2?Must specify a new version name}
+
+    perl -i.bak -pe "s/(${PROJ}_version)=.*/\$1=${VERSION}/" etc/project.properties
+    perl -i.bak -pe "s/<(currentVersion)>[^<]*<\/currentVersion>.*/<\$1>${VERSION}<\/\$1>/" plugins/maven-geronimo-plugin/project.xml
+}
+function publish_build_archives {
+
+    #  We want to checkout Geronimo into a directory that will be named
+    #  just right to be the source directory, then we can just zip and tar
+    #  it up before we build it.
+    #
+    #  The directory will be named geronimo-1.0-SVN_REVISION_NUMBER
+    svn checkout --revision $SVN_VERSION $SVN_URL/trunk $RELEASE_ID
+
+    #  The .svn directories contain a copy of all the files, so we should 
+    #  delete them our or source zip and tar files will be twice as big 
+    #  as they need to be.
+    find $RELEASE_ID -name '.svn' -exec rm -rf {} \;
+
+    #  The geronimo version should be changed from SNAPSHOT to the 
+    #  svn revision number we checked out
+    ( cd $RELEASE_ID && replace_version $PROJ $VERSION )
+
+    #  Now let's create the source zip and tar before we build while we
+    #  still have a completely clean checkout with no target directories,
+    #  velocity.log files and other junk created during a build.
+    package $DIST/${RELEASE_ID}-src $RELEASE_ID || fail "Unable to create source binaries"
+
+    #  Let's go ahead and run the build to create the geronimo-foo-1.0-SVN_REVISION.jar files
+    #  We don't run the tests as this is not a script for testing and reporting those test results.
+    #  If the build fails to compile, the 'fail' function is called and this script will exit
+    #  and nothing will be published.
+    ( cd $RELEASE_ID && maven -o -Dmaven.{itest,test}.skip=true ) || fail "Build failed"
+
+    #  During the assembly module a directory called geronimo-1.0-SVN_REVISION was created.  Let's 
+    #  move in to that directory and create a geronimo-1.0-SVN_REVISION.zip and a tar.gz of the same name.
+    #  When unpacked by users, these archives will extract into a directory called geronimo-1.0-SVN_REVISION/
+    ( cd $RELEASE_ID/$BIN_DIR && package $DIST/${RELEASE_ID} $RELEASE_ID ) || fail "Unable to make binary archives"
+
+    #  Let's create checksums for our source and binary tars and zips.
+    for archive in $DIST/*.{zip,tar.gz}; do
+	echo $archive
+	shash md5 $archive
+        shash sha $archive
+    done || fail "Unable to sign or hash release archives"
+
+    #  Now we want to create a directory where we will put the archives and checksums up for download.
+    #  Here we setup some variables for use.  The VERSION_DIR will typically look like:
+    #     /www/cvs.apache.org/dist/geronimo/unstable/1.0-SVN_REVISION/
+    #  This is the directory on apache.org where non-release builds a placed.
+    VERSION_DIR=$RELEASE_DIR/$VERSION
+
+    #  At this point we are mostly done, we just need to make our release directory and copy the files.
+    #
+    #  We look to see if that release directory (/www/cvs.apache.org/dist/geronimo) is on this machine.
+    #  If it is, then we know we are running locally and we can just move things over using mkdir and cp.
+    #  If not, then we have to do this remotely over ssh.
+    [ -d $RELEASE_DIR ] && RUNNING_LOCALLY=true
+
+    echo "Making dir $VERSION_DIR"
+
+    if [ $RUNNING_LOCALLY ]; then
+	mkdir $VERSION_DIR || fail "Unable to create the release dir $VERSION_DIR"
+	cp -r $DIST/${RELEASE_ID}* $VERSION_DIR || fail "Unable to upload the binaries to release dir $VERSION_DIR"
+    else 
+	SSH_URL=$REMOTE_USER@$REMOTE_HOST
+	(ssh $SSH_URL  mkdir $VERSION_DIR ) || fail "Unable to create the release dir $VERSION_DIR"
+	(scp $DIST/${RELEASE_ID}* $SSH_URL:$VERSION_DIR) || fail "Unable to upload the binaries to release dir $VERSION_DIR"
+    fi
+
+    #  Now we should be responsible and delete old nightly builds
+    #  Again, we have take into account that this script might be running
+    #  on another machine than where builds are published, so we do it
+    #  over ssh if that is the case.
+    #
+    #  The commands are basically the same either way, so we'll just put the
+    #  ssh part of the command in a variable SSH which will just not be set
+    #  if we are running locally.
+
+    [ ! $RUNNING_LOCALLY ] && SSH="ssh $REMOTE_USER@$REMOTE_HOST"
+
+    #  The extra parenthesis in this statement make the result of the
+    #  ls command into an array.  Many people aren't familiar with a 
+    #  bash array.  This is a good reference:
+    #     http://www.tldp.org/LDP/abs/html/arrays.html
+    #  The -t option to ls gives us a list of files sorted by order created, newest first.
+    UNSTABLE_BUILDS=( $( $SSH ls -t $RELEASE_DIR ) )
+
+    #  Set this to the number of builds you want to keep
+    KEEP=7
+   
+    #  Now we create a new list skipping over the newest entries.
+    DELETE_LIST=${UNSTABLE_BUILDS[@]:$KEEP}
+    
+    #  If there is anything in the DELETE_LIST, delete them.  The command
+    #  is in quotes so it will work as one command if done over ssh.
+    [ "$DELETE_LIST" ] && ( $SSH "cd $RELEASE_DIR && rm -r $DELETE_LIST" )
+
+    #  clean up locally
+    echo rm -r $DIST/* $RELEASE_ID
+}
+
+function setup {
+    svn co http://svn.apache.org/repos/asf/geronimo/trunk geronimo
+    cvs -d:pserver:anon@cvs.openejb.org:/scm/openejb co openejb
+}
+
+[ ! -d geronimo ] || [ ! -d openejb ] && setup
+
+##  The following function is really for convenience of getting this 
+##  script to run given the current state of our build.  The intent is
+##  that this function will get deleted when running the build via a 
+##  plain 'maven' command is possible without running other builds first.
+function build {
+    MODULES=$(ls geronimo/{specs,modules}/*/project.xml openejb/modules/*/project.xml | tr '\n' ',')
+    (cd geronimo && svn update) && (cd openejb && cvs -q up -dP) &&
+    maven -Dmaven.{test,itest}.skip=true -Dmaven.multiproject.includes=$MODULES -Dgoal=default multiproject:goal
+}
+
+build && publish_build_archives

Propchange: geronimo/scripts/publish_build.sh
------------------------------------------------------------------------------
    svn:executable = *