Increasing robustness of packaging script.

This commit is contained in:
Matthew
2010-08-16 01:02:38 +12:00
parent b4068f0ac7
commit d91a7c6b35
3 changed files with 79 additions and 29 deletions

View File

@@ -12,6 +12,9 @@ PKGVERSION=`echo $5 | sed "s/-/\\./g"`
sed -i "s/pkgver=[0-9\\.]\+/pkgver=$PKGVERSION/" PKGBUILD
makepkg --holdver
if [ $? -ne 0 ]; then
exit 1
fi
PACKAGEFILE="openra-git-$PKGVERSION-1-any.pkg.tar.xz"

View File

@@ -15,6 +15,9 @@ cp openra.spec "$6/SPECS/"
cd "$6"
rpmbuild --target noarch -bb SPECS/openra.spec
if [ $? -ne 0 ]; then
exit 1
fi
cd RPMS/noarch/
PACKAGEFILE=openra-$PKGVERSION-1.noarch.rpm

View File

@@ -7,50 +7,94 @@ VERSION=`echo $TAG | grep -o "[0-9]\\+-\\?[0-9]\\?"`
_gitroot="git://github.com/chrisforbes/OpenRA.git"
_gitname="OpenRA"
mkdir ~/openra-package/
pushd ~/openra-package/
msg () {
echo -ne $1
echo $2
echo -ne "\E[0m"
}
echo "Connecting to GIT server...."
if [ -z $VERSION ]; then
msg "\E[31m" "Malformed tag $TAG"
exit 1
fi
if [ ! -d ~/openra-package/ ]; then
mkdir ~/openra-package/
fi
pushd ~/openra-package/ &> /dev/null
msg "\E[32m" "Connecting to GIT server...."
if [ -d $_gitname ] ; then
pushd $_gitname && git pull origin
echo "The local files are updated."
popd
pushd $_gitname &> /dev/null && git pull origin
msg "\E[32m" "The local files are updated."
popd &> /dev/null
else
git clone $_gitroot $_gitname
fi
echo "GIT checkout done or server timeout"
echo "Starting make..."
msg "\E[32m" "GIT checkout done or server timeout"
rm -rf "$_gitname-build"
git clone "$_gitname" "$_gitname-build"
pushd "$_gitname-build"
git checkout $TAG
pushd "$_gitname-build" &> /dev/null
msg "\E[32m" "Checking out $TAG"
git checkout $TAG &> /dev/null
if [ $? -ne 0 ]; then
msg "\E[31m" "Checkout of $TAG failed."
exit 1
fi
msg "\E[32m" "Starting make..."
make prefix=/usr all
if [ $? -ne 0 ]; then
msg "\E[31m" "Build failed."
exit 1
fi
make prefix=/usr DESTDIR=../built install
popd
popd
popd &> /dev/null
popd &> /dev/null
pushd linux/pkgbuild/
sh buildpackage.sh "ftp.open-ra.org" "httpdocs/releases/linux" "$2" "$3" "$VERSION"
popd
#Arch-Linux
msg "\E[34m" "Building Arch-Linux package."
pushd linux/pkgbuild/ &> /dev/null
sh buildpackage.sh "ftp.open-ra.org" "httpdocs/releases/linux" "$2" "$3" "$VERSION" &> package.log
if [ $? -ne 0 ]; then
msg "\E[31m" "Package build failed, refer to log."
fi
popd &> /dev/null
pushd linux/rpm/
sh buildpackage.sh "ftp.open-ra.org" "httpdocs/releases/linux" "$2" "$3" "$VERSION" ~/rpmbuild
popd
#RPM
msg "\E[34m" "Building RPM package."
pushd linux/rpm/ &> /dev/null
sh buildpackage.sh "ftp.open-ra.org" "httpdocs/releases/linux" "$2" "$3" "$VERSION" ~/rpmbuild &> package.log
if [ $? -ne 0 ]; then
msg "\E[31m" "Package build failed, refer to log."
fi
popd &> /dev/null
pushd osx/
sh package-game.sh ~/openra-package/$_gitname-build "$VERSION"
popd
./uploader.sh mac "$VERSION" ~/openra-package/$_gitname-build/osxbuild/OpenRA-$VERSION.zip "$2" "$3"
pushd windows/
makensis -DSRCDIR=/home/openra/openra-package/$_gitname-build OpenRA.nsi
mv OpenRA.exe OpenRA-$VERSION.exe
../uploader.sh windows "$VERSION" OpenRA-$VERSION.exe "$2" "$3"
popd
#OSX
msg "\E[34m" "Building OSX package."
pushd osx/ &>/dev/null
sh package-game.sh ~/openra-package/$_gitname-build "$VERSION" &> package.log
if [ $? -eq 0 ]; then
../uploader.sh mac "$VERSION" ~/openra-package/$_gitname-build/osxbuild/OpenRA-$VERSION.zip "$2" "$3"
else
msg "\E[31m" "Package build failed, refer to log."
fi
popd &> /dev/null
#Windows
msg "\E[34m" "Building Windows package."
pushd windows/ &> /dev/null
makensis -DSRCDIR=/home/openra/openra-package/$_gitname-build OpenRA.nsi &> package.log
if [ $? -eq 0 ]; then
mv OpenRA.exe OpenRA-$VERSION.exe
../uploader.sh windows "$VERSION" OpenRA-$VERSION.exe "$2" "$3"
else
msg "\E[31m" "Package build failed, refer to log."
fi
popd &> /dev/null