summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/common/deploy-rbutil.py5
-rwxr-xr-xutils/common/deploy.py52
2 files changed, 37 insertions, 20 deletions
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 = {
53 "linux2" : "RockboxUtility" 53 "linux2" : "RockboxUtility"
54} 54}
55deploy.regreplace = { 55deploy.regreplace = {
56 "rbutil/rbutilqt/version.h" : ["SVN \$.*\$", "SVN r%REVISION%"], 56 "rbutil/rbutilqt/version.h" : [["SVN \$.*\$", "SVN r%REVISION%"],
57 "rbutil/rbutilqt/Info.plist" : ["SVN \$.*\$", "SVN r%REVISION%"] 57 ["(^#define BUILDID).*", "\\1 \"-%BUILDID%\""]],
58 "rbutil/rbutilqt/Info.plist" : [["SVN \$.*\$", "SVN r%REVISION%"]],
58} 59}
59# OS X 10.6 defaults to gcc 4.2. Building universal binaries that are 60# OS X 10.6 defaults to gcc 4.2. Building universal binaries that are
60# compatible with 10.4 requires using gcc-4.0. 61# 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():
469 startup = time.time() 469 startup = time.time()
470 470
471 try: 471 try:
472 opts, args = getopt.getopt(sys.argv[1:], "q:p:t:a:n:sbdkx:h", 472 opts, args = getopt.getopt(sys.argv[1:], "q:p:t:a:n:sbdkx:i:h",
473 ["qmake=", "project=", "tag=", "add=", "makensis=", "source-only", 473 ["qmake=", "project=", "tag=", "add=", "makensis=", "source-only",
474 "binary-only", "dynamic", "keep-temp", "cross=", "help"]) 474 "binary-only", "dynamic", "keep-temp", "cross=", "buildid=", "help"])
475 except getopt.GetoptError, err: 475 except getopt.GetoptError, err:
476 print str(err) 476 print str(err)
477 usage(sys.argv[0]) 477 usage(sys.argv[0])
@@ -487,6 +487,7 @@ def deploy():
487 keeptemp = False 487 keeptemp = False
488 makensis = "" 488 makensis = ""
489 cross = "" 489 cross = ""
490 buildid = None
490 platform = sys.platform 491 platform = sys.platform
491 if sys.platform != "darwin": 492 if sys.platform != "darwin":
492 static = True 493 static = True
@@ -516,6 +517,8 @@ def deploy():
516 if o in ("-x", "--cross") and sys.platform != "win32": 517 if o in ("-x", "--cross") and sys.platform != "win32":
517 cross = a 518 cross = a
518 platform = "win32" 519 platform = "win32"
520 if o in ("-i", "--buildid"):
521 buildid = a
519 if o in ("-h", "--help"): 522 if o in ("-h", "--help"):
520 usage(sys.argv[0]) 523 usage(sys.argv[0])
521 sys.exit(0) 524 sys.exit(0)
@@ -540,15 +543,19 @@ def deploy():
540 # make sure the path doesn't contain backslashes to prevent issues 543 # make sure the path doesn't contain backslashes to prevent issues
541 # later when running on windows. 544 # later when running on windows.
542 workfolder = re.sub(r'\\', '/', w) 545 workfolder = re.sub(r'\\', '/', w)
546 if buildid == None:
547 versionextra = ""
548 else:
549 versionextra = "-" + buildid
543 if not tag == "": 550 if not tag == "":
544 sourcefolder = workfolder + "/" + tag + "/" 551 sourcefolder = workfolder + "/" + tag + "/"
545 archivename = tag + "-src.tar.bz2" 552 archivename = tag + versionextra + "-src.tar.bz2"
546 # get numeric version part from tag 553 # get numeric version part from tag
547 ver = "v" + re.sub('^[^\d]+', '', tag) 554 ver = "v" + re.sub('^[^\d]+', '', tag)
548 else: 555 else:
549 trunk = gettrunkrev(svnbase) 556 trunk = gettrunkrev(svnbase)
550 sourcefolder = workfolder + "/" + program + "-r" + str(trunk) + "/" 557 sourcefolder = workfolder + "/" + program + "-r" + str(trunk) + versionextra + "/"
551 archivename = program + "-r" + str(trunk) + "-src.tar.bz2" 558 archivename = program + "-r" + str(trunk) + versionextra + "-src.tar.bz2"
552 ver = "r" + str(trunk) 559 ver = "r" + str(trunk)
553 os.mkdir(sourcefolder) 560 os.mkdir(sourcefolder)
554 else: 561 else:
@@ -563,23 +570,29 @@ def deploy():
563 tempclean(workfolder, cleanup and not keeptemp) 570 tempclean(workfolder, cleanup and not keeptemp)
564 sys.exit(1) 571 sys.exit(1)
565 572
566 # replace version strings. Only done when building from trunk 573 # replace version strings.
567 if tag == "": 574 print "Updating version information in sources"
568 print "Updating version information in sources" 575 for f in regreplace:
569 for f in regreplace: 576 infile = open(sourcefolder + "/" + f, "r")
570 infile = open(sourcefolder + "/" + f, "r") 577 incontents = infile.readlines()
571 incontents = infile.readlines() 578 infile.close()
572 infile.close() 579
573 580 outfile = open(sourcefolder + "/" + f, "w")
574 outfile = open(sourcefolder + "/" + f, "w") 581 for line in incontents:
575 for line in incontents: 582 newline = line
583 for r in regreplace[f]:
576 # replacements made on the replacement string: 584 # replacements made on the replacement string:
577 # %REVISION% is replaced with the revision number 585 # %REVISION% is replaced with the revision number
578 replacement = re.sub("%REVISION%", str(trunk), regreplace[f][1]) 586 replacement = re.sub("%REVISION%", str(trunk), r[1])
579 outfile.write(re.sub(regreplace[f][0], replacement, line)) 587 # %BUILD% is replace with buildid as passed on the command line
580 outfile.close() 588 if buildid != None:
589 replacement = re.sub("%BUILDID%", str(buildid), replacement)
590 newline = re.sub(r[0], replacement, newline)
591 outfile.write(newline)
592 outfile.close()
581 593
582 if source == True: 594 if source == True:
595 print "Creating source tarball %s\n" % archivename
583 tf = tarfile.open(archivename, mode='w:bz2') 596 tf = tarfile.open(archivename, mode='w:bz2')
584 tf.add(sourcefolder, os.path.basename(re.subn('/$', '', sourcefolder)[0])) 597 tf.add(sourcefolder, os.path.basename(re.subn('/$', '', sourcefolder)[0]))
585 tf.close() 598 tf.close()
@@ -590,6 +603,9 @@ def deploy():
590 # figure version from sources. Need to take path to project file into account. 603 # figure version from sources. Need to take path to project file into account.
591 versionfile = re.subn('[\w\.]+$', "version.h", proj)[0] 604 versionfile = re.subn('[\w\.]+$', "version.h", proj)[0]
592 ver = findversion(versionfile) 605 ver = findversion(versionfile)
606 # append buildid if any.
607 if buildid != None:
608 ver += "-" + buildid
593 609
594 # check project file 610 # check project file
595 if not os.path.exists(proj): 611 if not os.path.exists(proj):