forked from len0rd/rockbox
deploy.py: support adding a build id.
Add support for passing and injecting a build ID to the souces prior to compiling. Allows to easily create rebuilds of Rockbox Utility without creating false positives on update detection. Fix a typo in version.h. Thanks to sideral for noting. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29825 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e90d53cea8
commit
6ba552cc5d
3 changed files with 39 additions and 22 deletions
|
@ -23,9 +23,9 @@
|
|||
// contain a build timestamp because it needs to be the same in different
|
||||
// files
|
||||
// VERSION is the plain version number, used for http User-Agent string.
|
||||
// BUILD is an additional build string to handle package updates (i.e. rebuilds
|
||||
// because of issues like dependency problems or library updates). Usually
|
||||
// empty.
|
||||
// BUILDID is an additional build string to handle package updates (i.e.
|
||||
// rebuilds because of issues like dependency problems or library updates).
|
||||
// Usually empty.
|
||||
#define BUILDID ""
|
||||
#define VERSION "1.2.9" BUILDID
|
||||
#define PUREVERSION "SVN $Revision$"
|
||||
|
|
|
@ -53,8 +53,9 @@ deploy.progexe = {
|
|||
"linux2" : "RockboxUtility"
|
||||
}
|
||||
deploy.regreplace = {
|
||||
"rbutil/rbutilqt/version.h" : ["SVN \$.*\$", "SVN r%REVISION%"],
|
||||
"rbutil/rbutilqt/Info.plist" : ["SVN \$.*\$", "SVN r%REVISION%"]
|
||||
"rbutil/rbutilqt/version.h" : [["SVN \$.*\$", "SVN r%REVISION%"],
|
||||
["(^#define BUILDID).*", "\\1 \"-%BUILDID%\""]],
|
||||
"rbutil/rbutilqt/Info.plist" : [["SVN \$.*\$", "SVN r%REVISION%"]],
|
||||
}
|
||||
# OS X 10.6 defaults to gcc 4.2. Building universal binaries that are
|
||||
# compatible with 10.4 requires using gcc-4.0.
|
||||
|
|
|
@ -469,9 +469,9 @@ def deploy():
|
|||
startup = time.time()
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "q:p:t:a:n:sbdkx:h",
|
||||
opts, args = getopt.getopt(sys.argv[1:], "q:p:t:a:n:sbdkx:i:h",
|
||||
["qmake=", "project=", "tag=", "add=", "makensis=", "source-only",
|
||||
"binary-only", "dynamic", "keep-temp", "cross=", "help"])
|
||||
"binary-only", "dynamic", "keep-temp", "cross=", "buildid=", "help"])
|
||||
except getopt.GetoptError, err:
|
||||
print str(err)
|
||||
usage(sys.argv[0])
|
||||
|
@ -487,6 +487,7 @@ def deploy():
|
|||
keeptemp = False
|
||||
makensis = ""
|
||||
cross = ""
|
||||
buildid = None
|
||||
platform = sys.platform
|
||||
if sys.platform != "darwin":
|
||||
static = True
|
||||
|
@ -516,6 +517,8 @@ def deploy():
|
|||
if o in ("-x", "--cross") and sys.platform != "win32":
|
||||
cross = a
|
||||
platform = "win32"
|
||||
if o in ("-i", "--buildid"):
|
||||
buildid = a
|
||||
if o in ("-h", "--help"):
|
||||
usage(sys.argv[0])
|
||||
sys.exit(0)
|
||||
|
@ -540,15 +543,19 @@ def deploy():
|
|||
# make sure the path doesn't contain backslashes to prevent issues
|
||||
# later when running on windows.
|
||||
workfolder = re.sub(r'\\', '/', w)
|
||||
if buildid == None:
|
||||
versionextra = ""
|
||||
else:
|
||||
versionextra = "-" + buildid
|
||||
if not tag == "":
|
||||
sourcefolder = workfolder + "/" + tag + "/"
|
||||
archivename = tag + "-src.tar.bz2"
|
||||
archivename = tag + versionextra + "-src.tar.bz2"
|
||||
# get numeric version part from tag
|
||||
ver = "v" + re.sub('^[^\d]+', '', tag)
|
||||
else:
|
||||
trunk = gettrunkrev(svnbase)
|
||||
sourcefolder = workfolder + "/" + program + "-r" + str(trunk) + "/"
|
||||
archivename = program + "-r" + str(trunk) + "-src.tar.bz2"
|
||||
sourcefolder = workfolder + "/" + program + "-r" + str(trunk) + versionextra + "/"
|
||||
archivename = program + "-r" + str(trunk) + versionextra + "-src.tar.bz2"
|
||||
ver = "r" + str(trunk)
|
||||
os.mkdir(sourcefolder)
|
||||
else:
|
||||
|
@ -563,8 +570,7 @@ def deploy():
|
|||
tempclean(workfolder, cleanup and not keeptemp)
|
||||
sys.exit(1)
|
||||
|
||||
# replace version strings. Only done when building from trunk
|
||||
if tag == "":
|
||||
# replace version strings.
|
||||
print "Updating version information in sources"
|
||||
for f in regreplace:
|
||||
infile = open(sourcefolder + "/" + f, "r")
|
||||
|
@ -573,13 +579,20 @@ def deploy():
|
|||
|
||||
outfile = open(sourcefolder + "/" + f, "w")
|
||||
for line in incontents:
|
||||
newline = line
|
||||
for r in regreplace[f]:
|
||||
# replacements made on the replacement string:
|
||||
# %REVISION% is replaced with the revision number
|
||||
replacement = re.sub("%REVISION%", str(trunk), regreplace[f][1])
|
||||
outfile.write(re.sub(regreplace[f][0], replacement, line))
|
||||
replacement = re.sub("%REVISION%", str(trunk), r[1])
|
||||
# %BUILD% is replace with buildid as passed on the command line
|
||||
if buildid != None:
|
||||
replacement = re.sub("%BUILDID%", str(buildid), replacement)
|
||||
newline = re.sub(r[0], replacement, newline)
|
||||
outfile.write(newline)
|
||||
outfile.close()
|
||||
|
||||
if source == True:
|
||||
print "Creating source tarball %s\n" % archivename
|
||||
tf = tarfile.open(archivename, mode='w:bz2')
|
||||
tf.add(sourcefolder, os.path.basename(re.subn('/$', '', sourcefolder)[0]))
|
||||
tf.close()
|
||||
|
@ -590,6 +603,9 @@ def deploy():
|
|||
# figure version from sources. Need to take path to project file into account.
|
||||
versionfile = re.subn('[\w\.]+$', "version.h", proj)[0]
|
||||
ver = findversion(versionfile)
|
||||
# append buildid if any.
|
||||
if buildid != None:
|
||||
ver += "-" + buildid
|
||||
|
||||
# check project file
|
||||
if not os.path.exists(proj):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue