summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xutils/common/deploy.py61
1 files changed, 21 insertions, 40 deletions
diff --git a/utils/common/deploy.py b/utils/common/deploy.py
index 6a8b2580da..a01954c42d 100755
--- a/utils/common/deploy.py
+++ b/utils/common/deploy.py
@@ -29,7 +29,6 @@
# If the required Qt installation isn't in PATH use --qmake option.
# Tested on Linux and MinGW / W32
#
-# requires pysvn package.
# requires upx.exe in PATH on Windows.
#
@@ -45,14 +44,9 @@ import time
import hashlib
import tempfile
import string
+import gitscraper
# modules that are not part of python itself.
-try:
- import pysvn
-except ImportError:
- print "Fatal: This script requires the pysvn package to run."
- print " See http://pysvn.tigris.org/."
- sys.exit(-5)
cpus = 1
try:
import multiprocessing
@@ -80,6 +74,7 @@ systemdlls = ['advapi32.dll',
'winspool.drv',
'ws2_32.dll']
+gitrepo = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
# == Functions ==
def usage(myself):
@@ -112,26 +107,9 @@ def which(executable):
return ""
-def getsources(svnsrv, filelist, dest):
+def getsources(treehash, filelist, dest):
'''Get the files listed in filelist from svnsrv and put it at dest.'''
- client = pysvn.Client()
- print "Checking out sources from %s, please wait." % svnsrv
-
- for elem in filelist:
- url = re.subn('/$', '', svnsrv + elem)[0]
- destpath = re.subn('/$', '', dest + elem)[0]
- # make sure the destination path does exist
- d = os.path.dirname(destpath)
- if not os.path.exists(d):
- os.makedirs(d)
- # get from svn
- try:
- client.export(url, destpath)
- except:
- print "SVN client error: %s" % sys.exc_value
- print "URL: %s, destination: %s" % (url, destpath)
- return -1
- print "Checkout finished."
+ gitscraper.scrape_files(gitrepo, treehash, filelist, dest)
return 0
@@ -492,6 +470,7 @@ def deploy():
cross = ""
buildid = None
platform = sys.platform
+ treehash = gitscraper.get_refs(gitrepo)['refs/remotes/origin/HEAD']
if sys.platform != "darwin":
static = True
else:
@@ -502,9 +481,6 @@ def deploy():
if o in ("-p", "--project"):
proj = a
cleanup = False
- if o in ("-t", "--tag"):
- tag = a
- svnbase = svnserver + "tags/" + tag + "/"
if o in ("-a", "--add"):
addfiles.append(a)
if o in ("-n", "--makensis"):
@@ -517,6 +493,8 @@ def deploy():
static = False
if o in ("-k", "--keep-temp"):
keeptemp = True
+ if o in ("-t", "--tree"):
+ treehash = a
if o in ("-x", "--cross") and sys.platform != "win32":
cross = a
platform = "win32"
@@ -546,30 +524,33 @@ def deploy():
# make sure the path doesn't contain backslashes to prevent issues
# later when running on windows.
workfolder = re.sub(r'\\', '/', w)
- revision = getfolderrev(svnbase)
+ revision = gitscraper.describe_treehash(gitrepo, treehash)
+ # try to find a version number from describe output.
+ # WARNING: this is broken and just a temporary workaround!
+ v = re.findall('([\d\.a-f]+)', revision)
+ if v:
+ if v[-1].find('.') >= 0:
+ revision = "v" + v[-1]
+ else:
+ revision = v[-1]
if buildid == None:
versionextra = ""
else:
versionextra = "-" + buildid
- if tag != "":
- sourcefolder = workfolder + "/" + tag + "/"
- archivename = tag + versionextra + "-src.tar.bz2"
- # get numeric version part from tag
- ver = "v" + re.sub('^[^\d]+', '', tag)
- else:
- sourcefolder = workfolder + "/" + program + "-r" + str(revision) + versionextra + "/"
- archivename = program + "-r" + str(revision) + versionextra + "-src.tar.bz2"
- ver = "r" + str(revision)
+ sourcefolder = workfolder + "/" + program + "-" + str(revision) + versionextra + "/"
+ archivename = program + "-" + str(revision) + versionextra + "-src.tar.bz2"
+ ver = str(revision)
os.mkdir(sourcefolder)
else:
workfolder = "."
sourcefolder = "."
archivename = ""
# check if project file explicitly given. If yes, don't get sources from svn
+ print "Version: %s" % revision
if proj == "":
proj = sourcefolder + project
# get sources and pack source tarball
- if not getsources(svnbase, svnpaths, sourcefolder) == 0:
+ if not getsources(treehash, svnpaths, sourcefolder) == 0:
tempclean(workfolder, cleanup and not keeptemp)
sys.exit(1)