From a5b0e34dea544ffcc61cb4f587e32cbebce3d727 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 12 May 2013 15:31:33 +0100 Subject: [PATCH] Update release scripts to use git instead of svn --- Tools/mkdist.py | 39 ++++++++++++++++++++++++++++++++++++--- Tools/mkrelease.py | 5 +---- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Tools/mkdist.py b/Tools/mkdist.py index f2a04542c..1585523cf 100755 --- a/Tools/mkdist.py +++ b/Tools/mkdist.py @@ -6,6 +6,7 @@ import sys import string import os +import subprocess def failed(): print "mkdist.py failed to complete" @@ -34,10 +35,42 @@ os.system("rm -f "+dirname+".tar.gz") print "Removing "+dirname+".tar.gz if exists" os.system("rm -f "+dirname+".tar") -# Do a SVN export into the directory name +# Grab the code from git -print "Grabbing latest SWIG from svn" -os.system("svn export -r HEAD https://swig.svn.sourceforge.net/svnroot/swig/trunk "+dirname) == 0 or failed() +print "Checking git repository is in sync with remote repository" +os.system("git remote update") == 0 or failed() +command = ["git", "status", "--porcelain", "-uno"] +out = subprocess.check_output(command) +if out.strip() != "": + print "Local git repository has modifications" + print " ".join(command) + print out + sys.exit(3) + +command = ["git", "log", "--oneline", "master..origin/master"] +out = subprocess.check_output(command) +if out.strip() != "": + print "Remote repository has additional modifications to local repository" + print " ".join(command) + print out + sys.exit(3) + +command = ["git", "log", "--oneline", "origin/master..master"] +out = subprocess.check_output(command) +if out.strip() != "": + print "Local repository has modifications not pushed to the remote repository" + print "These should be pushed and checked that they pass Continuous Integration testing before continuing" + print " ".join(command) + print out + sys.exit(3) + +print "Tagging release" +tag = "'rel-" + version + "'" +os.system("git tag -a -m " + tag + " " + tag) == 0 or failed() + +print "Grabbing tagged release git repository using 'git archive' into " + outdir +outdir = os.path.basename(os.getcwd()) + "/" + dirname + "/" +os.system("(cd .. && git archive --prefix=" + outdir + tag + " . | tar -xf -)") == 0 or failed() # Remove the debian directory -- it's not official diff --git a/Tools/mkrelease.py b/Tools/mkrelease.py index 9ca96bc6f..9eceba07e 100755 --- a/Tools/mkrelease.py +++ b/Tools/mkrelease.py @@ -43,9 +43,6 @@ os.system("cat swig-" + version + "/README " + "swig-" + version + "/CHANGES.cur os.system("rsync --archive --verbose -P --times -e ssh " + "swig-" + version + ".tar.gz " + full_readme_file + " " + swig_dir_sf) and failed("") os.system("rsync --archive --verbose -P --times -e ssh " + "swigwin-" + version + ".zip " + full_readme_file + " " + swigwin_dir_sf) and failed("") -print "Tagging release" -os.system("svn copy -m \"rel-" + version + "\" https://swig.svn.sourceforge.net/svnroot/swig/trunk https://swig.svn.sourceforge.net/svnroot/swig/tags/rel-" + version + "/") - print "Finished" -print "Now log in to SourceForge and set the operating systems applicable to the newly uploaded tarball and zip file." +print "Now log in to SourceForge and set the operating systems applicable to the newly uploaded tarball and zip file. Also remember to do a 'git push'."