1
0
Fork 0
forked from len0rd/rockbox

Update deployment script for git.

First and rather rough adjustment for git. There are still a lot of places
referring to svn, and various functionality might be broken which needs fixing
later.

Change-Id: Ia628f06e99f527e01f131ce674746fba77d97d23
This commit is contained in:
Dominik Riebeling 2012-02-05 22:00:57 +01:00
parent 909b96fa70
commit 001eb3b211

View file

@ -29,7 +29,6 @@
# If the required Qt installation isn't in PATH use --qmake option. # If the required Qt installation isn't in PATH use --qmake option.
# Tested on Linux and MinGW / W32 # Tested on Linux and MinGW / W32
# #
# requires pysvn package.
# requires upx.exe in PATH on Windows. # requires upx.exe in PATH on Windows.
# #
@ -45,14 +44,9 @@ import time
import hashlib import hashlib
import tempfile import tempfile
import string import string
import gitscraper
# modules that are not part of python itself. # 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 cpus = 1
try: try:
import multiprocessing import multiprocessing
@ -80,6 +74,7 @@ systemdlls = ['advapi32.dll',
'winspool.drv', 'winspool.drv',
'ws2_32.dll'] 'ws2_32.dll']
gitrepo = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
# == Functions == # == Functions ==
def usage(myself): def usage(myself):
@ -112,26 +107,9 @@ def which(executable):
return "" return ""
def getsources(svnsrv, filelist, dest): def getsources(treehash, filelist, dest):
'''Get the files listed in filelist from svnsrv and put it at dest.''' '''Get the files listed in filelist from svnsrv and put it at dest.'''
client = pysvn.Client() gitscraper.scrape_files(gitrepo, treehash, filelist, dest)
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."
return 0 return 0
@ -492,6 +470,7 @@ def deploy():
cross = "" cross = ""
buildid = None buildid = None
platform = sys.platform platform = sys.platform
treehash = gitscraper.get_refs(gitrepo)['refs/remotes/origin/HEAD']
if sys.platform != "darwin": if sys.platform != "darwin":
static = True static = True
else: else:
@ -502,9 +481,6 @@ def deploy():
if o in ("-p", "--project"): if o in ("-p", "--project"):
proj = a proj = a
cleanup = False cleanup = False
if o in ("-t", "--tag"):
tag = a
svnbase = svnserver + "tags/" + tag + "/"
if o in ("-a", "--add"): if o in ("-a", "--add"):
addfiles.append(a) addfiles.append(a)
if o in ("-n", "--makensis"): if o in ("-n", "--makensis"):
@ -517,6 +493,8 @@ def deploy():
static = False static = False
if o in ("-k", "--keep-temp"): if o in ("-k", "--keep-temp"):
keeptemp = True keeptemp = True
if o in ("-t", "--tree"):
treehash = a
if o in ("-x", "--cross") and sys.platform != "win32": if o in ("-x", "--cross") and sys.platform != "win32":
cross = a cross = a
platform = "win32" platform = "win32"
@ -546,30 +524,33 @@ def deploy():
# make sure the path doesn't contain backslashes to prevent issues # make sure the path doesn't contain backslashes to prevent issues
# later when running on windows. # later when running on windows.
workfolder = re.sub(r'\\', '/', w) 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: if buildid == None:
versionextra = "" versionextra = ""
else: else:
versionextra = "-" + buildid versionextra = "-" + buildid
if tag != "": sourcefolder = workfolder + "/" + program + "-" + str(revision) + versionextra + "/"
sourcefolder = workfolder + "/" + tag + "/" archivename = program + "-" + str(revision) + versionextra + "-src.tar.bz2"
archivename = tag + versionextra + "-src.tar.bz2" ver = str(revision)
# 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)
os.mkdir(sourcefolder) os.mkdir(sourcefolder)
else: else:
workfolder = "." workfolder = "."
sourcefolder = "." sourcefolder = "."
archivename = "" archivename = ""
# check if project file explicitly given. If yes, don't get sources from svn # check if project file explicitly given. If yes, don't get sources from svn
print "Version: %s" % revision
if proj == "": if proj == "":
proj = sourcefolder + project proj = sourcefolder + project
# get sources and pack source tarball # 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) tempclean(workfolder, cleanup and not keeptemp)
sys.exit(1) sys.exit(1)