Tag prefixes change upload location for packages.

This commit is contained in:
Matthew
2010-09-23 12:03:58 +12:00
parent d87e02ab41
commit 094986d066
2 changed files with 51 additions and 28 deletions

View File

@@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
ARGS=3
E_BADARGS=85
TAG=$1 if [ $# -ne "$ARGS" ]; then
echo "Usage: `basename $0` tag username password"
VERSION=`echo $TAG | grep -o "[0-9]\\+-\\?[0-9]\\?"` exit $E_BADARGS
fi
_gitroot="git://github.com/chrisforbes/OpenRA.git"
_gitname="OpenRA"
msg () { msg () {
echo -ne $1 echo -ne $1
@@ -13,24 +13,46 @@ msg () {
echo -ne "\E[0m" echo -ne "\E[0m"
} }
TAG=$1
TYPE=`echo $TAG | grep -o "^[a-z]\\+"`
VERSION=`echo $TAG | grep -o "[0-9]\\+-\\?[0-9]\\?"`
_gitroot="git://github.com/chrisforbes/OpenRA.git"
_gitname="OpenRA"
if [ -z $VERSION ]; then if [ -z $VERSION ]; then
msg "\E[31m" "Malformed tag $TAG" msg "\E[31m" "Malformed tag $TAG"
exit 1 exit 1
fi fi
case "$TYPE" in
"release")
FTPPATH="httpdocs/releases"
;;
"playtest")
FTPPATH="httpdocs/playtests"
;;
*)
msg "\E[31m" "Unrecognized tag prefix $TYPE"
exit 1
;;
esac
if [ ! -d ~/openra-package/ ]; then if [ ! -d ~/openra-package/ ]; then
mkdir ~/openra-package/ mkdir ~/openra-package/
fi fi
pushd ~/openra-package/ &> /dev/null pushd ~/openra-package/ &> /dev/null
msg "\E[32m" "Connecting to GIT server...." msg "\E[32m" "Connecting to GIT server...."
if [ -d $_gitname ] ; then if [ -d $_gitname ] ; then
pushd $_gitname &> /dev/null && git pull origin pushd $_gitname &> /dev/null && git pull origin
msg "\E[32m" "The local files are updated." msg "\E[32m" "The local files are updated."
popd &> /dev/null # $_gitname popd &> /dev/null # $_gitname
else else
git clone $_gitroot $_gitname git clone $_gitroot $_gitname
fi fi
msg "\E[32m" "GIT checkout done or server timeout" msg "\E[32m" "GIT checkout done or server timeout"
@@ -42,8 +64,8 @@ pushd "$_gitname-build" &> /dev/null
msg "\E[32m" "Checking out $TAG" msg "\E[32m" "Checking out $TAG"
git checkout $TAG &> /dev/null git checkout $TAG &> /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg "\E[31m" "Checkout of $TAG failed." msg "\E[31m" "Checkout of $TAG failed."
exit 1 exit 1
fi fi
git describe --tags > "VERSION" git describe --tags > "VERSION"
@@ -51,8 +73,8 @@ git describe --tags > "VERSION"
msg "\E[32m" "Starting make..." msg "\E[32m" "Starting make..."
make prefix=/usr DESTDIR=../built install make prefix=/usr DESTDIR=../built install
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg "\E[31m" "Build failed." msg "\E[31m" "Build failed."
exit 1 exit 1
fi fi
pushd packaging &> /dev/null pushd packaging &> /dev/null
@@ -86,25 +108,25 @@ popd &> /dev/null
#Arch-Linux #Arch-Linux
msg "\E[34m" "Building Arch-Linux package." msg "\E[34m" "Building Arch-Linux package."
pushd linux/pkgbuild/ &> /dev/null pushd linux/pkgbuild/ &> /dev/null
sh buildpackage.sh "ftp.open-ra.org" "httpdocs/releases/linux" "$2" "$3" "$VERSION" &> package.log sh buildpackage.sh "ftp.open-ra.org" "$FTPPATH/linux" "$2" "$3" "$VERSION" &> package.log
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg "\E[31m" "Package build failed, refer to log." msg "\E[31m" "Package build failed, refer to log."
fi fi
popd &> /dev/null popd &> /dev/null
#RPM #RPM
msg "\E[34m" "Building RPM package." msg "\E[34m" "Building RPM package."
pushd linux/rpm/ &> /dev/null pushd linux/rpm/ &> /dev/null
sh buildpackage.sh "ftp.open-ra.org" "httpdocs/releases/linux" "$2" "$3" "$VERSION" ~/rpmbuild &> package.log sh buildpackage.sh "ftp.open-ra.org" "$FTPPATH/linux" "$2" "$3" "$VERSION" ~/rpmbuild &> package.log
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg "\E[31m" "Package build failed, refer to log." msg "\E[31m" "Package build failed, refer to log."
fi fi
popd &> /dev/null popd &> /dev/null
#deb #deb
msg "\E[34m" "Building deb package." msg "\E[34m" "Building deb package."
pushd linux/deb/ &> /dev/null pushd linux/deb/ &> /dev/null
./buildpackage.sh "ftp.open-ra.org" "httpdocs/releases/linux" "$2" "$3" "$VERSION" ~/openra-package/built ~/debpackage &> package.log ./buildpackage.sh "ftp.open-ra.org" "$FTPPATH/linux" "$2" "$3" "$VERSION" ~/openra-package/built ~/debpackage &> package.log
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg "\E[31m" "Package build failed, refer to log." msg "\E[31m" "Package build failed, refer to log."
fi fi
@@ -115,9 +137,9 @@ msg "\E[34m" "Building OSX package."
pushd osx/ &>/dev/null pushd osx/ &>/dev/null
sh package-game.sh ~/openra-package/$_gitname-build "$VERSION" &> package.log sh package-game.sh ~/openra-package/$_gitname-build "$VERSION" &> package.log
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
../uploader.sh mac "$VERSION" ~/openra-package/$_gitname-build/osxbuild/OpenRA-$VERSION.zip "$2" "$3" ../uploader.sh mac "$VERSION" ~/openra-package/$_gitname-build/osxbuild/OpenRA-$VERSION.zip $FTPPATH "$2" "$3"
else else
msg "\E[31m" "Package build failed, refer to log." msg "\E[31m" "Package build failed, refer to log."
fi fi
popd &> /dev/null popd &> /dev/null
@@ -126,10 +148,10 @@ msg "\E[34m" "Building Windows package."
pushd windows/ &> /dev/null pushd windows/ &> /dev/null
makensis -DSRCDIR=/home/openra/openra-package/$_gitname-build OpenRA.nsi &> package.log makensis -DSRCDIR=/home/openra/openra-package/$_gitname-build OpenRA.nsi &> package.log
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
mv OpenRA.exe OpenRA-$VERSION.exe mv OpenRA.exe OpenRA-$VERSION.exe
../uploader.sh windows "$VERSION" OpenRA-$VERSION.exe "$2" "$3" ../uploader.sh windows "$VERSION" OpenRA-$VERSION.exe $FTPPATH "$2" "$3"
else else
msg "\E[31m" "Package build failed, refer to log." msg "\E[31m" "Package build failed, refer to log."
fi fi
popd &> /dev/null popd &> /dev/null

View File

@@ -6,8 +6,9 @@
PLATFORM=$1 PLATFORM=$1
VERSION=$2 VERSION=$2
FILENAME=$3 FILENAME=$3
FTPPATH=$4
FTP="ftp://$4:$5@ftp.open-ra.org/httpdocs/releases/${PLATFORM}/" FTP="ftp://$5:$6@ftp.open-ra.org/${FTPPATH}/${PLATFORM}/"
if [ ! -e "${FILENAME}" ]; then if [ ! -e "${FILENAME}" ]; then
echo "File not found: ${FILENAME}" echo "File not found: ${FILENAME}"