DEVTOOLS: Rewrote dist-scummsm.sh tool to support git

This commit is contained in:
Eugene Sandulenko 2015-11-15 13:17:31 +01:00
parent b9b8eab269
commit 546ba3c09b

View file

@ -4,6 +4,7 @@
# #
# Largely based on dist-fink.sh, Copyright (c) 2001 Christoph Pfisterer. # Largely based on dist-fink.sh, Copyright (c) 2001 Christoph Pfisterer.
# Modified to use Subversion instead of CVS by Max Horn in 2007. # Modified to use Subversion instead of CVS by Max Horn in 2007.
# Modified to use git by Eugene Sandulenko in 2015.
# #
# ScummVM is the legal property of its developers, whose names # ScummVM is the legal property of its developers, whose names
# are too numerous to list here. Please refer to the COPYRIGHT # are too numerous to list here. Please refer to the COPYRIGHT
@ -26,25 +27,44 @@
### configuration ### configuration
svnroot='https://scummvm.svn.sourceforge.net/svnroot/scummvm' scummvmrepo='https://github.com/scummvm/scummvm.git'
toolsrepo='https://github.com/scummvm/scummvm-tools.git'
### init ### init
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
echo "Usage: $0 <module> <version-number> [<temporary-directory> [<tag>]]" echo "Usage: $0 <scummvm | scummvm-tools> <version-number> [<temporary-directory> [<tag>]]"
exit 1 exit 1
fi fi
echo_n() {
printf "$@"
}
module=$1 module=$1
version=$2 version=$2
tmpdir=${3:-/tmp} tmpdir=${3:-/tmp}
tag=$4 tag=$4
if [ -z "$tag" ]; then if [ -z "$tag" ]; then
tag=release-`echo $version | sed 's/\./-/g'` tag="v$version"
fi fi
fullname="$module-$version" fullname="$module-$version"
echo "packaging $module release $version, SVN tag $tag" # Check modules
case $module in
scummvm)
gitrepo=$scummvmrepo
;;
scummvm-tools)
gitrepo=$toolsrepo
;;
*)
echo "Unknown module $module. Only scummvm or scummvm-tools are supported"
exit 1
esac
echo "packaging $module release $version, GIT tag $tag"
### setup temp directory ### setup temp directory
@ -54,25 +74,39 @@ umask 022
if [ -d $fullname ]; then if [ -d $fullname ]; then
echo "There is a left-over directory in $tmpdir." echo "There is a left-over directory in $tmpdir."
echo "Remove $fullname, then try again." echo "Remove $tmpdir/$fullname, then try again."
exit 1 exit 1
fi fi
### check code out from SVN ### check code out from GIT
# TODO: Add support for making tarballs from trunk / branches?
echo "Exporting module $module, tag $tag from SVN:" echo "Cloning module $module from GIT:"
svn export "$svnroot/$module/tags/$tag" $fullname git clone $gitrepo $fullname
if [ ! -d $fullname ]; then if [ ! -d $fullname ]; then
echo "SVN export failed, directory $fullname doesn't exist!" echo "GIT clone failed, directory $fullname doesn't exist!"
exit 1 exit 1
fi fi
cd $tmpdir/$fullname
echo_n "Checking out tag $tag..."
if git checkout $tag --quiet 2>/dev/null; then
echo done
else
echo "checking out tag $tag failed."
exit 1
fi
cd $tmpdir
echo "Cleaning up .git directory"
rm -rf $fullname/.git
### roll the tarball ### roll the tarball
echo "Creating tarball $fullname.tar:" echo "Creating tarball $fullname.tar..."
rm -f $fullname.tar $fullname.tar.gz rm -f $fullname.tar $fullname.tar.gz
tar -cvf $fullname.tar $fullname tar -cf $fullname.tar $fullname
echo "Compressing (using gzip) tarball $fullname.tar.gz..." echo "Compressing (using gzip) tarball $fullname.tar.gz..."
gzip -c9 $fullname.tar > $fullname.tar.gz gzip -c9 $fullname.tar > $fullname.tar.gz
@ -89,7 +123,7 @@ if [ ! -f $fullname.tar.bz2 ]; then
fi fi
echo "Zipping $fullname.zip..." echo "Zipping $fullname.zip..."
zip -r9 $fullname.zip $fullname zip -r9 $fullname.zip $fullname >/dev/null
if [ ! -f $fullname.zip ]; then if [ ! -f $fullname.zip ]; then
echo "Packaging failed, $fullname.zip doesn't exist!" echo "Packaging failed, $fullname.zip doesn't exist!"
exit 1 exit 1
@ -100,5 +134,6 @@ fi
echo "Done:" echo "Done:"
ls -l $fullname.tar.gz $fullname.tar.bz2 $fullname.zip ls -l $fullname.tar.gz $fullname.tar.bz2 $fullname.zip
md5sum $fullname.tar.gz $fullname.tar.bz2 $fullname.zip
exit 0 exit 0