From 546ba3c09bf6975d051bc05be91783ca7f1bed3e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 15 Nov 2015 13:17:31 +0100 Subject: DEVTOOLS: Rewrote dist-scummsm.sh tool to support git --- devtools/dist-scummvm.sh | 61 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 13 deletions(-) (limited to 'devtools') diff --git a/devtools/dist-scummvm.sh b/devtools/dist-scummvm.sh index ac411c55a3..cc330324b9 100755 --- a/devtools/dist-scummvm.sh +++ b/devtools/dist-scummvm.sh @@ -4,6 +4,7 @@ # # 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 git by Eugene Sandulenko in 2015. # # ScummVM is the legal property of its developers, whose names # are too numerous to list here. Please refer to the COPYRIGHT @@ -26,25 +27,44 @@ ### 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 if [ $# -lt 2 ]; then - echo "Usage: $0 [ []]" + echo "Usage: $0 [ []]" exit 1 fi +echo_n() { + printf "$@" +} + module=$1 version=$2 tmpdir=${3:-/tmp} tag=$4 if [ -z "$tag" ]; then - tag=release-`echo $version | sed 's/\./-/g'` + tag="v$version" fi 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 @@ -54,25 +74,39 @@ umask 022 if [ -d $fullname ]; then echo "There is a left-over directory in $tmpdir." - echo "Remove $fullname, then try again." + echo "Remove $tmpdir/$fullname, then try again." exit 1 fi -### check code out from SVN -# TODO: Add support for making tarballs from trunk / branches? +### check code out from GIT -echo "Exporting module $module, tag $tag from SVN:" -svn export "$svnroot/$module/tags/$tag" $fullname +echo "Cloning module $module from GIT:" +git clone $gitrepo $fullname if [ ! -d $fullname ]; then - echo "SVN export failed, directory $fullname doesn't exist!" + echo "GIT clone failed, directory $fullname doesn't exist!" exit 1 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 -echo "Creating tarball $fullname.tar:" +echo "Creating tarball $fullname.tar..." 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..." gzip -c9 $fullname.tar > $fullname.tar.gz @@ -89,7 +123,7 @@ if [ ! -f $fullname.tar.bz2 ]; then fi echo "Zipping $fullname.zip..." -zip -r9 $fullname.zip $fullname +zip -r9 $fullname.zip $fullname >/dev/null if [ ! -f $fullname.zip ]; then echo "Packaging failed, $fullname.zip doesn't exist!" exit 1 @@ -100,5 +134,6 @@ fi echo "Done:" ls -l $fullname.tar.gz $fullname.tar.bz2 $fullname.zip +md5sum $fullname.tar.gz $fullname.tar.bz2 $fullname.zip exit 0 -- cgit v1.2.3