openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r781792 - in /openjpa/sandboxes/dwoods: ./ daily_build_scripts/ daily_build_scripts/build.sh daily_build_scripts/cleanup.sh daily_build_scripts/trunk-local.cfg daily_build_scripts/trunk.cfg
Date Thu, 04 Jun 2009 16:48:37 GMT
Author: dwoods
Date: Thu Jun  4 16:48:36 2009
New Revision: 781792

URL: http://svn.apache.org/viewvc?rev=781792&view=rev
Log:
creating my sandbox area

Added:
    openjpa/sandboxes/dwoods/
    openjpa/sandboxes/dwoods/daily_build_scripts/
    openjpa/sandboxes/dwoods/daily_build_scripts/build.sh   (with props)
    openjpa/sandboxes/dwoods/daily_build_scripts/cleanup.sh   (with props)
    openjpa/sandboxes/dwoods/daily_build_scripts/trunk-local.cfg
    openjpa/sandboxes/dwoods/daily_build_scripts/trunk.cfg

Added: openjpa/sandboxes/dwoods/daily_build_scripts/build.sh
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/dwoods/daily_build_scripts/build.sh?rev=781792&view=auto
==============================================================================
--- openjpa/sandboxes/dwoods/daily_build_scripts/build.sh (added)
+++ openjpa/sandboxes/dwoods/daily_build_scripts/build.sh Thu Jun  4 16:48:36 2009
@@ -0,0 +1,248 @@
+#!/bin/sh
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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: 725830 $ $Date: 2008-12-11 17:02:45 -0500 (Thu, 11 Dec 2008) $
+# --------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# OpenJPA build automation and notification script.
+#   $1 - build config file, like trunk.cfg
+#   $2 - skip unit tests, like false
+# -----------------------------------------------------------------------------
+
+CONFIG_FILE=$1
+SKIP_TESTS=$2
+
+if [ -f "$CONFIG_FILE" ]; then
+  . "$CONFIG_FILE"
+else
+  echo "ERROR: $CONFIG_FILE does not exist or is not a file"
+  exit 1
+fi
+
+export MVN_HOME
+export MAVEN_OPTS
+export JAVA_HOME
+
+export PATH=$JAVA_HOME/bin:$MVN_HOME/bin:$PATH
+
+LOG_DIR=$TEST_DIR/logs
+rm -rf $LOG_DIR
+mkdir -p $LOG_DIR
+ts=`date +%T | awk -F: '{print $1$2}'`
+log=$LOG_DIR/build-$ts.log
+mail=$LOG_DIR/mail.log
+svn=$LOG_DIR/svn.log
+echo "Using logfile=$log"
+echo "" > $log
+
+# function
+send_mail() {
+   subject=$1
+   mailto=$2
+
+   if [ "$BUILD_EMAIL" = "true" ]
+   then
+     mail_ts=`date +%Y%m%d%H%M%S`
+     remote_mail_file=${REMOTE_HOME}/${mail_ts}.mail.txt
+     scp $mail ${REMOTE_ACCOUNT}@${REMOTE_MACHINE}:$remote_mail_file
+     ssh ${REMOTE_ACCOUNT}@${REMOTE_MACHINE} "mail -s '$subject' $mailto < $remote_mail_file;
rm -f $remote_mail_file"
+   else
+     echo " " >> $log
+     echo "Email is disabled, so logging details -" >> $log
+     echo "Subject: $subject" >> $log
+     echo "Body:" >> $log
+     cat $mail >> $log
+     echo " " >> $log
+  fi
+}
+
+
+echo `date` > $LOG_DIR/date.log
+
+# check if another build script is still running
+ps -ef > $LOG_DIR/ps.out
+count=`cat $LOG_DIR/ps.out | grep "build.sh" | wc -l`
+if [ $count -gt 1 ]
+then
+  echo "ERROR: Previous build is still running..." 
+  subject="[BUILD] ${BRANCH}: Previous build did not complete"
+  echo "Previous build is still running..." > $mail
+  send_mail "$subject" "$ADMIN_EMAIL_ADDR"
+  exit 2
+fi
+
+if [ "$M2REPO_CLEAN" = "true" ]
+then
+  rm -rf $M2_REPO
+fi
+
+if [ "$BUILD_CLEAN" = "true" ]
+then
+  cd $TEST_DIR
+  rm -rf $BRANCH_DIR
+  echo "Running SVN CHECKOUT for Branch=$BRANCH"
+  echo "Running SVN CHECKOUT for Branch=$BRANCH" >> $log
+  svn co https://svn.apache.org/repos/asf/openjpa/$BRANCH $BRANCH_DIR
+  if [ $? -ne 0 ]
+  then
+    echo "ERROR: SVN checkout failed."
+    subject="[BUILD] ${BRANCH}: SVN checkout failed"
+    echo "SVN checkout failed." > $mail
+    send_mail "$subject" "$ADMIN_EMAIL_ADDR"
+    exit 3
+  fi
+else
+  cd $TEST_DIR
+  find . -name target | xargs rm -rf
+  echo "Running SVN UPDATE for Branch=$BRANCH"
+  echo "Running SVN UPDATE for Branch=$BRANCH" >> $log
+  svn up $BRANCH_DIR
+  if [ $? -ne 0 ]
+  then
+    echo "ERROR: SVN update failed."
+    subject="[BUILD] ${BRANCH}: SVN update failed"
+    echo "SVN update failed." > $mail
+    send_mail "$subject" "$ADMIN_EMAIL_ADDR"
+    exit 4
+  fi
+fi
+
+cd $BRANCH_DIR
+#rev=`svn info | grep Revision | awk -F: '{print $2}'`
+rev=`svn info | grep "Last Changed Rev" | awk -F: '{print $2}'`
+echo "revision = $rev" > $svn
+echo "Building OpenJPA ${BRANCH} at Revision: $rev"
+echo "Building OpenJPA ${BRANCH} at Revision: $rev" >> $log
+echo " " >> $log
+java -version >> $log 2>&1
+echo " " >> $log
+
+# function
+build() {
+  mvn -B -e -Dmaven.test.skip=$1 $BUILD_OPTS install > temp 2>&1
+  tail -100 temp | grep "Missing:"
+  if [ $? -eq 0 ]
+  then
+    echo "Rebuilding due to missing depend..."
+    mvn -B -e -Dmaven.test.skip=$1 $BUILD_OPTS install > temp 2>&1
+  fi
+  cat temp >> $log
+  rm -f temp
+}
+
+# function
+copyUnitTestReports() {
+   DIRS=`find . -type d -name surefire-reports`
+   for DIR in $DIRS
+   do
+       mkdir -p $UNIT_DIR/$DIR
+       cp $DIR/*.txt $UNIT_DIR/$DIR
+       cp $DIR/*.xml $UNIT_DIR/$DIR
+   done
+}
+
+# function
+mail_results() {
+   if [ "$1" = "passed" ]
+   then
+      subject="[BUILD] ${BRANCH}: Successful"
+      mailto=$PASS_EMAIL_ADDR
+   else
+      subject="[BUILD] ${BRANCH}: Failed for Revision: $rev"
+      mailto=$FAIL_EMAIL_ADDR
+   fi
+
+   send_mail "$subject" "$mailto"
+}
+
+build $SKIP_TESTS
+
+if [ "$SKIP_TESTS" = "true" ]
+then
+  echo "Unit tests skiped"
+  echo "OpenJPA $BRANCH_ID Revision: $rev built with tests skipped" >> $mail
+  echo " " >> $mail
+else
+  echo "Unit tests included"
+  echo "OpenJPA $BRANCH_ID Revision $rev built with tests included" >> $mail
+  echo " " >> $mail
+fi
+
+dir=`date +%F | awk -F- '{print $1$2$3}'`
+bin_dir=$BINARY_DIR/$BRANCH_DIR/$dir
+latest_dir=$BINARY_DIR/$BRANCH_DIR/latest
+if [ "$BUILD_PUBLISH" = "true" ]
+then
+  echo "Publishing build log..."
+  ssh ${REMOTE_ACCOUNT}@${REMOTE_MACHINE} "mkdir -p $bin_dir"
+  scp $log ${REMOTE_ACCOUNT}@${REMOTE_MACHINE}:$bin_dir
+  echo "See the full $log file at $BINARY_URL/$BRANCH_DIR/$dir/$log" >> $mail
+  echo " " >> $mail
+fi
+
+grep "BUILD SUCCESSFUL" $log
+if [ $? -eq 0 ]
+then
+  echo "Build Successful.  See $log for details."
+  result="passed"
+  grep -A10 "BUILD SUCCESSFUL" $log >> $mail
+
+  #if [ "$BUILD_PUBLISH" = "true" ]
+  #then
+    #echo "Publishing build zipfile..."
+    #echo "Download the build results from $BINARY_URL/$BRANCH_DIR/$dir" >> $mail
+    #zip -r $LOG_DIR/build-$ts.zip $TEST_DIR/$BRANCH_DIR
+    #scp $LOG_DIR/build-$ts.zip ${REMOTE_ACCOUNT}@${REMOTE_MACHINE}:$bin_dir
+
+    # fix permissions
+    #ssh ${REMOTE_ACCOUNT}@${REMOTE_MACHINE} "chmod -R g+w $bin_dir"
+
+    # if build passed, then update link to latest build
+    #ssh ${REMOTE_ACCOUNT}@${REMOTE_MACHINE} "rm -f $latest_dir"
+    #ssh ${REMOTE_ACCOUNT}@${REMOTE_MACHINE} "ln -s $bin_dir $latest_dir"
+    #ssh ${REMOTE_ACCOUNT}@${REMOTE_MACHINE} "chmod g+w $latest_dir"
+  #fi
+   
+  mail_results $result
+
+  exit 0
+else
+  echo "Build Failed.  See $log for details."
+  if [ "$BUILD_PUBLISH" = "true" ]
+  then
+    echo "Publishing unit-test-reports..."
+    # if build failed, publish unit test reports
+    UNIT_DIR=$TEST_DIR/$BRANCH_DIR/unit-test-reports
+    copyUnitTestReports
+    scp -r $UNIT_DIR ${REMOTE_ACCOUNT}@${REMOTE_MACHINE}:$bin_dir
+
+    # fix permissions
+    ssh ${REMOTE_ACCOUNT}@${REMOTE_MACHINE} "chmod -R g+w $bin_dir"
+
+    echo " " >> $mail
+    echo "See the unit test reports at $BINARY_URL/$BRANCH_DIR/$dir/unit-test-reports" >>
$mail
+    echo " " >> $mail
+  fi
+
+  tail -100 $log >> $mail
+  mail_results "failed"
+
+  exit 99
+fi
+

Propchange: openjpa/sandboxes/dwoods/daily_build_scripts/build.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/sandboxes/dwoods/daily_build_scripts/build.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: openjpa/sandboxes/dwoods/daily_build_scripts/cleanup.sh
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/dwoods/daily_build_scripts/cleanup.sh?rev=781792&view=auto
==============================================================================
--- openjpa/sandboxes/dwoods/daily_build_scripts/cleanup.sh (added)
+++ openjpa/sandboxes/dwoods/daily_build_scripts/cleanup.sh Thu Jun  4 16:48:36 2009
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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: 613373 $ $Date: 2008-01-19 01:45:37 -0500 (Sat, 19 Jan 2008) $
+# --------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+
+CONFIG_FILE=$1
+
+if [ -f "$CONFIG_FILE" ]; then
+  . "$CONFIG_FILE"
+else
+  echo "ERROR: $CONFIG_FILE does not exist or is not a file"
+  exit 1
+fi
+
+DAYS=30
+#DATE=`date -d "-${DAYS} day" +%Y%m%d`
+DATE=`date -v-${DAYS}d +%Y%m%d`
+
+rm -r $BINARY_DIR/$BRANCH_DIR/$DATE

Propchange: openjpa/sandboxes/dwoods/daily_build_scripts/cleanup.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/sandboxes/dwoods/daily_build_scripts/cleanup.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: openjpa/sandboxes/dwoods/daily_build_scripts/trunk-local.cfg
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/dwoods/daily_build_scripts/trunk-local.cfg?rev=781792&view=auto
==============================================================================
--- openjpa/sandboxes/dwoods/daily_build_scripts/trunk-local.cfg (added)
+++ openjpa/sandboxes/dwoods/daily_build_scripts/trunk-local.cfg Thu Jun  4 16:48:36 2009
@@ -0,0 +1,59 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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: 725830 $ $Date: 2008-12-11 17:02:45 -0500 (Thu, 11 Dec 2008) $
+# --------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# Common build settings for openjpa/trunk
+# -----------------------------------------------------------------------------
+BRANCH=trunk
+BRANCH_ID=2.0.0-SNAPSHOT
+BRANCH_DIR=trunk
+
+M2REPO_CLEAN=false
+BUILD_CLEAN=true
+BUILD_EMAIL=false
+BUILD_PUBLISH=false
+BUILD_OPTS=
+
+BINARY_URL=http://people.apache.org/builds/openjpa
+BINARY_DIR=/www/people.apache.org/builds/openjpa
+
+#PASS_EMAIL_ADDR="scm@openjpa.apache.org"
+#FAIL_EMAIL_ADDR="dev@openjpa.apache.org"
+
+REMOTE_MACHINE=people.apache.org
+#REMOTE_HOME=/home/$REMOTE_ACCOUNT
+#ADMIN_EMAIL_ADDR="$REMOTE_ACCOUNT@apache.org"
+
+M2_REPO=$HOME/.m2/repository
+MAVEN_OPTS="-XX:MaxPermSize=256m -Xmx512m"
+
+# -----------------------------------------------------------------------------
+# Settings to customize based on user build environment
+# -----------------------------------------------------------------------------
+# Remote account on $REMOTE_MACHINE for sending emails
+#REMOTE_ACCOUNT=your_people_uid_here
+
+# Local directory to use for builds
+TEST_DIR=/tmp/openjpa
+
+# Use the user environment defaults for Maven and Java
+#MVN_HOME=/usr/local/maven
+#JAVA_HOME=/usr/local/java
+

Added: openjpa/sandboxes/dwoods/daily_build_scripts/trunk.cfg
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/dwoods/daily_build_scripts/trunk.cfg?rev=781792&view=auto
==============================================================================
--- openjpa/sandboxes/dwoods/daily_build_scripts/trunk.cfg (added)
+++ openjpa/sandboxes/dwoods/daily_build_scripts/trunk.cfg Thu Jun  4 16:48:36 2009
@@ -0,0 +1,61 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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: 725830 $ $Date: 2008-12-11 17:02:45 -0500 (Thu, 11 Dec 2008) $
+# --------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# Common build settings for openjpa/trunk
+# -----------------------------------------------------------------------------
+BRANCH=trunk
+BRANCH_ID=2.0.0-SNAPSHOT
+BRANCH_DIR=trunk
+
+M2REPO_CLEAN=false
+BUILD_CLEAN=true
+BUILD_EMAIL=true
+BUILD_PUBLISH=true
+BUILD_OPTS=
+
+BINARY_URL=http://people.apache.org/builds/openjpa
+BINARY_DIR=/www/people.apache.org/builds/openjpa
+
+PASS_EMAIL_ADDR="scm@openjpa.apache.org"
+FAIL_EMAIL_ADDR="dev@openjpa.apache.org"
+
+REMOTE_MACHINE=people.apache.org
+REMOTE_HOME=/home/$REMOTE_ACCOUNT
+ADMIN_EMAIL_ADDR="$REMOTE_ACCOUNT@apache.org"
+
+M2_REPO=$HOME/.m2/repository
+MAVEN_OPTS="-XX:MaxPermSize=256m -Xmx512m"
+
+# -----------------------------------------------------------------------------
+# Settings to customize based on user build environment
+# -----------------------------------------------------------------------------
+# Remote account on $REMOTE_MACHINE for sending emails
+REMOTE_ACCOUNT=dwoods
+
+# Local directory to use for builds
+TEST_DIR=/tmp/openjpa
+
+# Override user environment defaults for Maven and Java
+MVN_HOME=/opt/jdk1.5.0_17
+SUN_JAVA5_HOME=/opt/jdk1.5.0_17
+SUN_JAVA6_HOME=/opt/jdk1.6.0_11
+JAVA_HOME=$SUN_JAVA5_HOME
+



Mime
View raw message