mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
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:
parent
909b96fa70
commit
001eb3b211
1 changed files with 21 additions and 40 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue