r18122 - gnucash/trunk/packaging/win32 - Refactor daily_build.sh into build_package.sh

Derek Atkins warlord at code.gnucash.org
Sat Jun 13 00:31:36 EDT 2009


Author: warlord
Date: 2009-06-13 00:31:35 -0400 (Sat, 13 Jun 2009)
New Revision: 18122
Trac: http://svn.gnucash.org/trac/changeset/18122

Added:
   gnucash/trunk/packaging/win32/build_package.sh
   gnucash/trunk/packaging/win32/build_tags.sh
Modified:
   gnucash/trunk/packaging/win32/daily_build.sh
Log:
Refactor daily_build.sh into build_package.sh
Create a build_tags.sh that will check for new tags
in the tag directory and rebuild them when they appear.

Added: gnucash/trunk/packaging/win32/build_package.sh
===================================================================
--- gnucash/trunk/packaging/win32/build_package.sh	                        (rev 0)
+++ gnucash/trunk/packaging/win32/build_package.sh	2009-06-13 04:31:35 UTC (rev 18122)
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+#
+# This assumes we're in the "packaging" directory for the correct build.
+# It could be the packaging/win32 subdir of a tag checkout, or it could
+# be the top-level daily-build packaging directory.
+#
+
+set -e
+
+function unix_path() { echo "$*" | sed 's,^\([A-Za-z]\):,/\1,;s,\\,/,g'; }
+
+tag="$1"
+
+. functions.sh
+. defaults.sh
+
+set_default OUTPUT_DIR $GLOBAL_DIR\\output
+LOGFILENAME=build${tag:+-${tag}}-`date +'%Y-%m-%d'`.log
+
+_OUTPUT_DIR=`unix_path $OUTPUT_DIR`
+LOGFILE=${_OUTPUT_DIR}/${LOGFILENAME}
+mkdir -p ${_OUTPUT_DIR}
+
+# Run the compile
+./install.sh 2>&1 | tee ${LOGFILE}
+
+# This directory needs to be removed before calling dist.sh
+DIST_DIR=${INSTALL_DIR}\\..\\dist
+_DIST_UDIR=`unix_path $DIST_DIR`
+rm -rf ${_DIST_UDIR}
+
+# Create the installer
+./dist.sh 2>&1 | tee -a ${LOGFILE}
+
+# Copy the resulting installer into the output directory
+_BUILD_UDIR=`unix_path $BUILD_DIR`
+_GNUCASH_UDIR=`unix_path $GNUCASH_DIR`
+PKG_VERSION=`grep PACKAGE_VERSION ${_BUILD_UDIR}/config.h | cut -d" " -f3 | cut -d\" -f2 `
+SVN_REV=`grep GNUCASH_SVN_REV ${_BUILD_UDIR}/src/gnome-utils/gnc-svninfo.h | cut -d" " -f3 | cut -d\" -f2 `
+SETUP_FILENAME="gnucash-${PKG_VERSION}-svn-r${SVN_REV}-setup.exe"
+mv ${_GNUCASH_UDIR}/${SETUP_FILENAME} ${_OUTPUT_DIR}
+
+#
+# Verify that PKG_VERSION == $tag, and add to the build log if it's not.
+# Note: only do this if tag exists and matches x.y.z
+#
+if [ -n "${tag}" ] ; then
+  case "${tag}" in
+  [0-9]*.[0-9]*.[0-9]*)
+     if [ "${PKG_VERSION}" != "${tag}" ] ; then
+       echo "" >> ${LOGFILE}
+       echo " *** ERROR: Package Version ${PKG_VERSION} doesn't match Tag ${tag}" >> ${LOGILE}
+       echo "" >> ${LOGFILE}
+    fi
+    ;;
+  esac
+fi
+
+# If we're running on the build server then upload the files
+# Note: change this target if you're building a different branch
+if [ `hostname` = "gnucash-win32" ]; then
+  scp -p ${LOGFILE} ${_OUTPUT_DIR}/${SETUP_FILENAME} upload at code.gnucash.org:public_html/win32/trunk
+fi


Property changes on: gnucash/trunk/packaging/win32/build_package.sh
___________________________________________________________________
Added: svn:keywords
   + "Author Date Id Revision"
Added: svn:eol-style
   + native

Added: gnucash/trunk/packaging/win32/build_tags.sh
===================================================================
--- gnucash/trunk/packaging/win32/build_tags.sh	                        (rev 0)
+++ gnucash/trunk/packaging/win32/build_tags.sh	2009-06-13 04:31:35 UTC (rev 18122)
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+set -e
+
+function qpushd() { pushd "$@" >/dev/null; }
+function qpopd() { popd >/dev/null; }
+function unix_path() { echo "$*" | sed 's,^\([A-Za-z]\):,/\1,;s,\\,/,g'; }
+
+################################################################
+# Setup our environment  (we need the DOWNLOAD_DIR)
+
+pkgdir="$(dirname $(unix_path "$0"))"
+qpushd "${pkgdir}"
+svn update
+. functions.sh
+. defaults.sh
+
+
+################################################################
+# determine if there are any new tags since the last time we ran
+#
+
+# If we don't have a tagfile then start from 'now'
+tagfile=tags
+if [ ! -f ${tagfile} ] ; then
+  svn ls http://svn.gnucash.org/repo/gnucash/tags > ${tagfile}
+fi
+
+# Figure out the new set of tags
+svn ls http://svn.gnucash.org/repo/gnucash/tags > ${tagfile}.new
+tags="`diff --suppress-common-lines ${tagfile} ${tagfile}.new | grep '^> ' | sed -e 's/^> //g' -e 's#/$##g'`"
+
+# move the new file into place
+mv -f ${tagile}.new ${tagfile}
+
+################################################################
+# Now iterate over all the new tags (if any) and build a package
+
+for tag in $tags ; do
+  tagbasedir=/c/soft/gnucash-${tag}
+  tagdir=${tagbasedir}/gnucash
+  mkdir -p ${tagdir}
+
+  # Copy the downloads to save time
+  mkdir -p ${tagbasedir}/downloads
+  cp -p $(unix_path ${DOWNLOAD_DIR})/* ${tagbasedir}/downloads
+
+  # Check out the tag and setup custom.sh
+  svn co -q http://svn.gnucash.org/repo/gnucash/tags/${tag} ${tagdir}/repos
+  w32pkg=${tagdir}/repos/packaging/win32
+  cp -p "${pkgdir}/custom.sh" ${w32pkg}/custom.sh
+
+  # Set the global directory to the tag build
+  echo "GLOBAL_DIR=c:\soft\gnucash-${tag}" >> ${w32pkg}/custom.sh
+
+  # No need to update the sources we just checked out
+  echo "UPDATE_SOURCES=no" >> ${w32pkg}/custom.sh
+
+  # Now build the tag!  (this will upload it too)
+  qpushd ${w32pkg}
+    ./build_package.sh ${tag}
+  qpopd
+done


Property changes on: gnucash/trunk/packaging/win32/build_tags.sh
___________________________________________________________________
Added: svn:keywords
   + "Author Date Id Revision"
Added: svn:eol-style
   + native

Modified: gnucash/trunk/packaging/win32/daily_build.sh
===================================================================
--- gnucash/trunk/packaging/win32/daily_build.sh	2009-06-10 12:20:20 UTC (rev 18121)
+++ gnucash/trunk/packaging/win32/daily_build.sh	2009-06-13 04:31:35 UTC (rev 18122)
@@ -8,38 +8,5 @@
 
 qpushd "$(dirname $(unix_path "$0"))"
 svn update
-. functions.sh
-. defaults.sh
-
-set_default OUTPUT_DIR $GLOBAL_DIR\\output
-
-LOGFILENAME=build-`date +'%Y-%m-%d'`.log
-
-_OUTPUT_DIR=`unix_path $OUTPUT_DIR`
-LOGFILE=${_OUTPUT_DIR}/${LOGFILENAME}
-mkdir -p ${_OUTPUT_DIR}
-
-# Run the compile
-./install.sh 2>&1 | tee ${LOGFILE}
-
-# This directory needs to be removed before calling dist.sh
-DIST_DIR=${INSTALL_DIR}\\..\\dist
-_DIST_UDIR=`unix_path $DIST_DIR`
-rm -rf ${_DIST_UDIR}
-
-# Create the installer
-./dist.sh 2>&1 | tee -a ${LOGFILE}
-
-# Copy the resulting installer into the output directory
-_BUILD_UDIR=`unix_path $BUILD_DIR`
-_GNUCASH_UDIR=`unix_path $GNUCASH_DIR`
-PKG_VERSION=`grep PACKAGE_VERSION ${_BUILD_UDIR}/config.h | cut -d" " -f3 | cut -d\" -f2 `
-SVN_REV=`grep GNUCASH_SVN_REV ${_BUILD_UDIR}/src/gnome-utils/gnc-svninfo.h | cut -d" " -f3 | cut -d\" -f2 `
-SETUP_FILENAME="gnucash-${PKG_VERSION}-svn-r${SVN_REV}-setup.exe"
-mv ${_GNUCASH_UDIR}/${SETUP_FILENAME} ${_OUTPUT_DIR}
-
-# If we're running on the build server than upload the files
-# Note: change this target if you're building a different branch
-if [ `hostname` = "gnucash-win32" ]; then
-  scp -p ${LOGFILE} ${_OUTPUT_DIR}/${SETUP_FILENAME} upload at code.gnucash.org:public_html/win32/trunk
-fi
+./build_package.sh
+qpopd



More information about the gnucash-changes mailing list