Commit f6a30ac9 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie

Several improvements to the debian release script.

* Now builds 'testing' as well - this is the tip of the latest stable branch
* Can build one at a time, or all three at once (with confirmation)
* Does not use cogito any more
parent 11c2b558
#!/bin/bash
#
# Builds and releases Mahara to the debian repo
#
# This script can release just one version (stable|testing|unstable), or all at
# once
#
set -e
BUILDDIR="/tmp/mahara_release"
REPODIR="/tmp/mahara_repo"
ARCHLIST="i386 amd64"
DATE="`date`"
RELEASE=$1
if [ "$RELEASE" = "" ]; then
echo -n "Building ALL versions: are you sure? (y/N) "
read ANS
if [ "$ANS" != "y" ] && [ "$ANS" != "Y" ]; then
echo "Abort."
exit 1
fi
RELEASELIST="stable testing unstable"
elif [ "$RELEASE" != "stable" ] && [ "$RELEASE" != "testing" ] && [ "$RELEASE" != "unstable" ]; then
echo "Invalid release: $RELEASE"
exit 1
else
RELEASELIST=$RELEASE
fi
print_usage() {
echo "Usage is debian_release.sh"
echo "(must be run from a trunk checkout of mahara)"
......@@ -26,7 +49,7 @@ fi
mkdir ${BUILDDIR}
# Create repo dirs
for release in stable unstable; do
for release in $RELEASELIST; do
mkdir -p ${REPODIR}/dists/${release}/mahara
pushd ${REPODIR}/dists/${release}/mahara
mkdir binary-all
......@@ -35,33 +58,61 @@ for release in stable unstable; do
mkdir -p ${REPODIR}/pool/${release}
done
# If done properly, we don't need this here - the build can happen from any place that has this script
git-fetch -t
STABLE_RELEASE="`ls -1 .git/refs/tags | grep 'RELEASE$' | tail -n1`"
TESTING_RELEASE="`git branch -a | grep "origin.*STABLE$" | sort | tail -1 | sed 's/origin\///' | tr -d ' '`"
pushd ${BUILDDIR}
echo "Building ${STABLE_RELEASE} ..."
# Build Stable
cg-clone "git+ssh://git.catalyst.net.nz/git/public/mahara.git#${STABLE_RELEASE}"
rm -f *.deb
pushd ${BUILDDIR}/mahara
make
popd
cp *.deb ${REPODIR}/pool/stable/
rm ${BUILDDIR}/mahara -rf
echo "Building Trunk ..."
# Build Trunk
cg-clone "git+ssh://git.catalyst.net.nz/git/public/mahara.git"
rm -f *.deb
pushd ${BUILDDIR}/mahara
make
popd
cp *.deb ${REPODIR}/pool/unstable/
rm ${BUILDDIR}/mahara -rf
if [ "$RELEASE" = "" ] || [ "$RELEASE" = "stable" ]; then
echo
echo "Building ${STABLE_RELEASE} ..."
git clone -n "git+ssh://git.catalyst.net.nz/git/public/mahara.git" mahara
( cd mahara && git checkout -b "${STABLE_RELEASE}" "${STABLE_RELEASE}" )
rm -f *.deb
pushd ${BUILDDIR}/mahara
make
popd
cp *.deb ${REPODIR}/pool/stable/
rm ${BUILDDIR}/mahara -rf
fi
# Build Testing (tip of stable)
if [ "$RELEASE" = "" ] || [ "$RELEASE" = "testing" ]; then
echo
echo "Building Testing (${TESTING_RELEASE})..."
git clone -n "git+ssh://git.catalyst.net.nz/git/public/mahara.git" mahara
( cd mahara && git checkout -b ${TESTING_RELEASE} "origin/${TESTING_RELEASE}" )
rm -f *.deb
pushd ${BUILDDIR}/mahara
make
popd
cp *.deb ${REPODIR}/pool/testing/
rm ${BUILDDIR}/mahara -rf
fi
# Build Unstable
if [ "$RELEASE" = "" ] || [ "$RELEASE" = "unstable" ]; then
echo
echo "Building Unstable ..."
git clone "git+ssh://git.catalyst.net.nz/git/public/mahara.git" mahara
( cd mahara && git checkout master )
rm -f *.deb
pushd ${BUILDDIR}/mahara
make
popd
cp *.deb ${REPODIR}/pool/unstable/
rm ${BUILDDIR}/mahara -rf
fi
# Link other arches into all and build packages
for release in stable unstable; do
for release in $RELEASELIST; do
pushd ${REPODIR}/pool
for arch in all ${ARCHLIST}; do
......@@ -100,5 +151,9 @@ popd
cp debian/index.html ${REPODIR}
rsync -PIlvr --delete-after --no-p --no-g --chmod=Dg+ws,Fg+w ${REPODIR}/* locke.catalyst.net.nz:/home/ftp/pub/mahara/
if [ "$RELEASE" = "" ]; then
rsync -PIlvr --delete-after --no-p --no-g --chmod=Dg+ws,Fg+w ${REPODIR}/* locke.catalyst.net.nz:/home/ftp/pub/mahara/
else
rsync -PIlvr --no-p --no-g --chmod=Dg+ws,Fg+w ${REPODIR}/* locke.catalyst.net.nz:/home/ftp/pub/mahara/
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment