mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
First attempt at rewriting the win32 automated build scripts for git
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22304 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
028212f8a2
commit
50f62a5516
107
packaging/win32/build_package_git.sh
Normal file
107
packaging/win32/build_package_git.sh
Normal file
@ -0,0 +1,107 @@
|
||||
#!/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 -o pipefail
|
||||
set -e
|
||||
LOG_DIR=build-logs
|
||||
|
||||
function on_error() {
|
||||
if [ `hostname` = "gnucash-win32" ]; then
|
||||
scp -p ${LOGFILE} upload@code.gnucash.org:public_html/win32/$LOG_DIR
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
function unix_path() { echo "$*" | sed 's,^\([A-Za-z]\):,/\1,;s,\\,/,g'; }
|
||||
|
||||
tag="$1"
|
||||
|
||||
. functions.sh
|
||||
. defaults.sh
|
||||
|
||||
# Determine where to upload to
|
||||
# NOTE: this assumes GIT_REV to be either a tag or a branch, not a
|
||||
# commit hash. It will probably work with a hash as well,
|
||||
# but will create a directory for the hash
|
||||
if [ -n "$($GIT_CMD tag -l $GIT_REV)" ]; then
|
||||
TARGET_DIR=releases
|
||||
LOG_TAG=$tag
|
||||
else
|
||||
TARGET_DIR=${GIT_REV}
|
||||
LOG_TAG=$TARGET_DIR
|
||||
fi
|
||||
|
||||
set_default OUTPUT_DIR $GLOBAL_DIR\\output
|
||||
LOGFILENAME=build-${LOG_TAG}-`date +'%Y-%m-%d'`.log
|
||||
|
||||
_OUTPUT_DIR=`unix_path $OUTPUT_DIR`
|
||||
LOGFILE=${_OUTPUT_DIR}/${LOGFILENAME}
|
||||
mkdir -p ${_OUTPUT_DIR}
|
||||
|
||||
# Small hack to create $LOG_DIR on the webserver if it doesn't exist yet
|
||||
if [ `hostname` = "gnucash-win32" ]; then
|
||||
mkdir -p "$_OUTPUT_DIR/$LOG_DIR"
|
||||
scp -r "$_OUTPUT_DIR/$LOG_DIR" upload@code.gnucash.org:public_html/win32
|
||||
rmdir "$_OUTPUT_DIR/$LOG_DIR"
|
||||
fi
|
||||
|
||||
set +e
|
||||
trap on_error ERR
|
||||
|
||||
# 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/core-utils/gnc-svninfo.h | cut -d" " -f3 | cut -d\" -f2 `
|
||||
|
||||
# Choose the output filename based on our "build_from_tarball" setting
|
||||
# Make sure this logic matches the logic in dist.sh!
|
||||
if [ "$BUILD_FROM_TARBALL" = "no" ]; then
|
||||
SETUP_FILENAME="gnucash-${PKG_VERSION}-git-r${SVN_REV}-setup.exe"
|
||||
else
|
||||
SETUP_FILENAME="gnucash-${PKG_VERSION}-setup.exe"
|
||||
fi
|
||||
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}" >> ${LOGFILE}
|
||||
echo "" >> ${LOGFILE}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# If we're running on the build server then upload the files
|
||||
if [ `hostname` = "gnucash-win32" ]; then
|
||||
# Small hack to create the $TARGET_DIR on the webserver if it doesn't exist yet
|
||||
mkdir -p "$_OUTPUT_DIR/$TARGET_DIR"
|
||||
scp -r "$_OUTPUT_DIR/$TARGET_DIR" upload@code.gnucash.org:public_html/win32
|
||||
rmdir "$_OUTPUT_DIR/$TARGET_DIR"
|
||||
# Copy the files to the chosen target directory
|
||||
scp -p ${LOGFILE} upload@code.gnucash.org:public_html/win32/$LOG_DIR
|
||||
scp -p ${_OUTPUT_DIR}/${SETUP_FILENAME} upload@code.gnucash.org:public_html/win32/$TARGET_DIR
|
||||
fi
|
105
packaging/win32/build_tags_git.sh
Normal file
105
packaging/win32/build_tags_git.sh
Normal file
@ -0,0 +1,105 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Note: for this script to work, git must have been setup before
|
||||
# in a way that doesn't conflict with the GnuCash build.
|
||||
# The easiest way to do so is to run the build once manually
|
||||
# with a properly set up custom.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'; }
|
||||
|
||||
TAG_URL=http://svn.gnucash.org/repo/gnucash/tags
|
||||
|
||||
################################################################
|
||||
# Setup our environment (we need the DOWNLOAD_DIR)
|
||||
|
||||
qpushd "$(dirname $(unix_path "$0"))"
|
||||
pkgdir="`pwd`"
|
||||
. functions.sh
|
||||
. defaults.sh
|
||||
|
||||
# Variables
|
||||
_GIT_UDIR=`unix_path $GIT_DIR`
|
||||
set_env "$_GIT_UDIR/bin/git" GIT_CMD
|
||||
export $GIT_CMD
|
||||
|
||||
$GIT_CMD pull
|
||||
. 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_git
|
||||
if [ ! -f ${tagfile} ] ; then
|
||||
for one_tag in $($GIT_CMD tag)
|
||||
do
|
||||
tag_hash=$($GIT_CMD rev_parse ${one_tag})
|
||||
echo ${one_tag}/${tag_hash} >> ${tagfile}
|
||||
done
|
||||
fi
|
||||
|
||||
# Figure out the new set of tags
|
||||
rm -f ${tagfile}.new
|
||||
for one_tag in $($GIT_CMD tag)
|
||||
do
|
||||
tag_hash=$($GIT_CMD rev_parse ${one_tag})
|
||||
echo ${one_tag}/${tag_hash} >> ${tagfile}.new
|
||||
done
|
||||
tags="`diff --suppress-common-lines ${tagfile} ${tagfile}.new | grep '^> ' | sed -e 's/^> //g'`"
|
||||
|
||||
# move the new file into place
|
||||
mv -f ${tagfile}.new ${tagfile}
|
||||
|
||||
################################################################
|
||||
# Now iterate over all the new tags (if any) and build a package
|
||||
|
||||
for tag_rev in $tags ; do
|
||||
tag=${tag_rev#*/}
|
||||
tag=${tag%/*}
|
||||
tagbasedir=/c/soft/gnucash-${tag}
|
||||
tagdir=${tagbasedir}/gnucash
|
||||
rm -fr $tagbasedir
|
||||
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
|
||||
$GIT_CMD clone checkout ${REPO_URL} ${tagdir}/repos
|
||||
qpushd {tagdir}/repos
|
||||
$GIT_CMD checkout $tag
|
||||
qpopd
|
||||
w32pkg=${tagdir}/repos/packaging/win32
|
||||
cp -p "${pkgdir}/custom.sh" ${w32pkg}/custom.sh
|
||||
|
||||
# Set the global directory to the tag build
|
||||
echo -n 'GLOBAL_DIR=c:\\soft\\gnucash-' >> ${w32pkg}/custom.sh
|
||||
echo "${tag}" >> ${w32pkg}/custom.sh
|
||||
|
||||
# No need to update the sources we just checked out
|
||||
echo "UPDATE_SOURCES=no" >> ${w32pkg}/custom.sh
|
||||
|
||||
# BUILD_FROM_TARBALL is special:
|
||||
# in install.sh place we check !=yes, in defaults.sh =yes, in dist.sh =no
|
||||
# We want it to look like 'no' in install and defaults, but yes in dist
|
||||
# so this hack works!
|
||||
echo "BUILD_FROM_TARBALL=maybe" >> ${w32pkg}/custom.sh
|
||||
|
||||
# Point HH_DIR at the global installation because we don't need to redo it
|
||||
echo -n "HH_DIR=" >> ${w32pkg}/custom.sh
|
||||
echo "${GLOBAL_DIR}\\hh" | sed -e 's/\\/\\\\/g' >> ${w32pkg}/custom.sh
|
||||
|
||||
# Now build the tag! (this will upload it too)
|
||||
# Use the build_package script from trunk (cwd), not from the tag
|
||||
qpushd ${w32pkg}
|
||||
${pkgdir}/build_package.sh ${tag}
|
||||
qpopd
|
||||
done
|
25
packaging/win32/daily_build_git.sh
Normal file
25
packaging/win32/daily_build_git.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Note: for this script to work, git must have been setup before
|
||||
# in a way that doesn't conflict with the GnuCash build.
|
||||
# The easiest way to do so is to run the build once manually
|
||||
# with a properly set up custom.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'; }
|
||||
|
||||
qpushd "$(dirname $(unix_path "$0"))"
|
||||
. functions.sh
|
||||
. defaults.sh
|
||||
|
||||
# Variables
|
||||
_GIT_UDIR=`unix_path $GIT_DIR`
|
||||
set_env "$_GIT_UDIR/bin/git" GIT_CMD
|
||||
export $GIT_CMD
|
||||
|
||||
$GIT_CMD pull
|
||||
./build_package_git.sh
|
||||
qpopd
|
28
packaging/win32/weekly_build_git.sh
Normal file
28
packaging/win32/weekly_build_git.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Note: for this script to work, git must have been setup before
|
||||
# in a way that doesn't conflict with the GnuCash build.
|
||||
# The easiest way to do so is to run the build once manually
|
||||
# with a properly set up custom.sh.
|
||||
|
||||
set -e
|
||||
|
||||
## Only run this script on Monday night (first day of the week)
|
||||
if [ `date +%u` != 1 ] ; then exit ; fi
|
||||
|
||||
function qpushd() { pushd "$@" >/dev/null; }
|
||||
function qpopd() { popd >/dev/null; }
|
||||
function unix_path() { echo "$*" | sed 's,^\([A-Za-z]\):,/\1,;s,\\,/,g'; }
|
||||
|
||||
qpushd "$(dirname $(unix_path "$0"))"
|
||||
. functions.sh
|
||||
. defaults.sh
|
||||
|
||||
# Variables
|
||||
_GIT_UDIR=`unix_path $GIT_DIR`
|
||||
set_env "$_GIT_UDIR/bin/git" GIT_CMD
|
||||
export $GIT_CMD
|
||||
|
||||
$GIT_CMD pull
|
||||
./build_package.sh
|
||||
qpopd
|
Loading…
Reference in New Issue
Block a user