mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-02 05:29:20 -06:00
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. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18122 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ff42b2566f
commit
e751014bca
64
packaging/win32/build_package.sh
Normal file
64
packaging/win32/build_package.sh
Normal file
@ -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@code.gnucash.org:public_html/win32/trunk
|
||||
fi
|
63
packaging/win32/build_tags.sh
Normal file
63
packaging/win32/build_tags.sh
Normal file
@ -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
|
@ -8,38 +8,5 @@ function unix_path() { echo "$*" | sed 's,^\([A-Za-z]\):,/\1,;s,\\,/,g'; }
|
||||
|
||||
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@code.gnucash.org:public_html/win32/trunk
|
||||
fi
|
||||
./build_package.sh
|
||||
qpopd
|
||||
|
Loading…
Reference in New Issue
Block a user