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
|
// contain a build timestamp because it needs to be the same in different
|
||||||
// files
|
// files
|
||||||
// VERSION is the plain version number, used for http User-Agent string.
|
// 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
|
// BUILDID is an additional build string to handle package updates (i.e.
|
||||||
// because of issues like dependency problems or library updates). Usually
|
// rebuilds because of issues like dependency problems or library updates).
|
||||||
// empty.
|
// Usually empty.
|
||||||
#define BUILDID ""
|
#define BUILDID ""
|
||||||
#define VERSION "1.2.9" BUILDID
|
#define VERSION "1.2.9" BUILDID
|
||||||
#define PUREVERSION "SVN $Revision$"
|
#define PUREVERSION "SVN $Revision$"
|
||||||
|
|
|
@ -53,8 +53,9 @@ deploy.progexe = {
|
||||||
"linux2" : "RockboxUtility"
|
"linux2" : "RockboxUtility"
|
||||||
}
|
}
|
||||||
deploy.regreplace = {
|
deploy.regreplace = {
|
||||||
"rbutil/rbutilqt/version.h" : ["SVN \$.*\$", "SVN r%REVISION%"],
|
"rbutil/rbutilqt/version.h" : [["SVN \$.*\$", "SVN r%REVISION%"],
|
||||||
"rbutil/rbutilqt/Info.plist" : ["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
|
# OS X 10.6 defaults to gcc 4.2. Building universal binaries that are
|
||||||
# compatible with 10.4 requires using gcc-4.0.
|
# compatible with 10.4 requires using gcc-4.0.
|
||||||
|
|
|
@ -469,9 +469,9 @@ def deploy():
|
||||||
startup = time.time()
|
startup = time.time()
|
||||||
|
|
||||||
try:
|
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",
|
["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:
|
except getopt.GetoptError, err:
|
||||||
print str(err)
|
print str(err)
|
||||||
usage(sys.argv[0])
|
usage(sys.argv[0])
|
||||||
|
@ -487,6 +487,7 @@ def deploy():
|
||||||
keeptemp = False
|
keeptemp = False
|
||||||
makensis = ""
|
makensis = ""
|
||||||
cross = ""
|
cross = ""
|
||||||
|
buildid = None
|
||||||
platform = sys.platform
|
platform = sys.platform
|
||||||
if sys.platform != "darwin":
|
if sys.platform != "darwin":
|
||||||
static = True
|
static = True
|
||||||
|
@ -516,6 +517,8 @@ def deploy():
|
||||||
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"
|
||||||
|
if o in ("-i", "--buildid"):
|
||||||
|
buildid = a
|
||||||
if o in ("-h", "--help"):
|
if o in ("-h", "--help"):
|
||||||
usage(sys.argv[0])
|
usage(sys.argv[0])
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
@ -540,15 +543,19 @@ 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)
|
||||||
|
if buildid == None:
|
||||||
|
versionextra = ""
|
||||||
|
else:
|
||||||
|
versionextra = "-" + buildid
|
||||||
if not tag == "":
|
if not tag == "":
|
||||||
sourcefolder = workfolder + "/" + tag + "/"
|
sourcefolder = workfolder + "/" + tag + "/"
|
||||||
archivename = tag + "-src.tar.bz2"
|
archivename = tag + versionextra + "-src.tar.bz2"
|
||||||
# get numeric version part from tag
|
# get numeric version part from tag
|
||||||
ver = "v" + re.sub('^[^\d]+', '', tag)
|
ver = "v" + re.sub('^[^\d]+', '', tag)
|
||||||
else:
|
else:
|
||||||
trunk = gettrunkrev(svnbase)
|
trunk = gettrunkrev(svnbase)
|
||||||
sourcefolder = workfolder + "/" + program + "-r" + str(trunk) + "/"
|
sourcefolder = workfolder + "/" + program + "-r" + str(trunk) + versionextra + "/"
|
||||||
archivename = program + "-r" + str(trunk) + "-src.tar.bz2"
|
archivename = program + "-r" + str(trunk) + versionextra + "-src.tar.bz2"
|
||||||
ver = "r" + str(trunk)
|
ver = "r" + str(trunk)
|
||||||
os.mkdir(sourcefolder)
|
os.mkdir(sourcefolder)
|
||||||
else:
|
else:
|
||||||
|
@ -563,8 +570,7 @@ def deploy():
|
||||||
tempclean(workfolder, cleanup and not keeptemp)
|
tempclean(workfolder, cleanup and not keeptemp)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# replace version strings. Only done when building from trunk
|
# replace version strings.
|
||||||
if tag == "":
|
|
||||||
print "Updating version information in sources"
|
print "Updating version information in sources"
|
||||||
for f in regreplace:
|
for f in regreplace:
|
||||||
infile = open(sourcefolder + "/" + f, "r")
|
infile = open(sourcefolder + "/" + f, "r")
|
||||||
|
@ -573,13 +579,20 @@ def deploy():
|
||||||
|
|
||||||
outfile = open(sourcefolder + "/" + f, "w")
|
outfile = open(sourcefolder + "/" + f, "w")
|
||||||
for line in incontents:
|
for line in incontents:
|
||||||
|
newline = line
|
||||||
|
for r in regreplace[f]:
|
||||||
# replacements made on the replacement string:
|
# replacements made on the replacement string:
|
||||||
# %REVISION% is replaced with the revision number
|
# %REVISION% is replaced with the revision number
|
||||||
replacement = re.sub("%REVISION%", str(trunk), regreplace[f][1])
|
replacement = re.sub("%REVISION%", str(trunk), r[1])
|
||||||
outfile.write(re.sub(regreplace[f][0], replacement, line))
|
# %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()
|
outfile.close()
|
||||||
|
|
||||||
if source == True:
|
if source == True:
|
||||||
|
print "Creating source tarball %s\n" % archivename
|
||||||
tf = tarfile.open(archivename, mode='w:bz2')
|
tf = tarfile.open(archivename, mode='w:bz2')
|
||||||
tf.add(sourcefolder, os.path.basename(re.subn('/$', '', sourcefolder)[0]))
|
tf.add(sourcefolder, os.path.basename(re.subn('/$', '', sourcefolder)[0]))
|
||||||
tf.close()
|
tf.close()
|
||||||
|
@ -590,6 +603,9 @@ def deploy():
|
||||||
# figure version from sources. Need to take path to project file into account.
|
# figure version from sources. Need to take path to project file into account.
|
||||||
versionfile = re.subn('[\w\.]+$', "version.h", proj)[0]
|
versionfile = re.subn('[\w\.]+$', "version.h", proj)[0]
|
||||||
ver = findversion(versionfile)
|
ver = findversion(versionfile)
|
||||||
|
# append buildid if any.
|
||||||
|
if buildid != None:
|
||||||
|
ver += "-" + buildid
|
||||||
|
|
||||||
# check project file
|
# check project file
|
||||||
if not os.path.exists(proj):
|
if not os.path.exists(proj):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue