diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-05-05 17:19:00 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-05-05 17:19:00 +0000 |
commit | 6ba552cc5dafcf20522a177095447fb82cfa2040 (patch) | |
tree | ea1aae9107d2731469fd46901c8d2544225d740d | |
parent | e90d53cea8e5e7add86fc03918d720a145dbf462 (diff) |
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
-rw-r--r-- | rbutil/rbutilqt/version.h | 6 | ||||
-rwxr-xr-x | utils/common/deploy-rbutil.py | 5 | ||||
-rwxr-xr-x | utils/common/deploy.py | 52 |
3 files changed, 40 insertions, 23 deletions
diff --git a/rbutil/rbutilqt/version.h b/rbutil/rbutilqt/version.h index 78db1d2f90..da498ac1a4 100644 --- a/rbutil/rbutilqt/version.h +++ b/rbutil/rbutilqt/version.h @@ -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$" diff --git a/utils/common/deploy-rbutil.py b/utils/common/deploy-rbutil.py index 3273a295e8..31b33da4fb 100755 --- a/utils/common/deploy-rbutil.py +++ b/utils/common/deploy-rbutil.py @@ -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. diff --git a/utils/common/deploy.py b/utils/common/deploy.py index 1e48f8a56f..db97c9b291 100755 --- a/utils/common/deploy.py +++ b/utils/common/deploy.py @@ -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,23 +570,29 @@ def deploy(): tempclean(workfolder, cleanup and not keeptemp) sys.exit(1) - # replace version strings. Only done when building from trunk - if tag == "": - print "Updating version information in sources" - for f in regreplace: - infile = open(sourcefolder + "/" + f, "r") - incontents = infile.readlines() - infile.close() - - outfile = open(sourcefolder + "/" + f, "w") - for line in incontents: + # replace version strings. + print "Updating version information in sources" + for f in regreplace: + infile = open(sourcefolder + "/" + f, "r") + incontents = infile.readlines() + infile.close() + + 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)) - outfile.close() + 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): |