summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/deploy-release.py
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2010-03-31 20:52:07 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2010-03-31 20:52:07 +0000
commitaae2213e0aeb2df1a20c2651484cca6644bb3da6 (patch)
treea458f5d01b52ddec118ed2e377eb39098c37e13f /rbutil/rbutilqt/deploy-release.py
parenta3d5f95981936f33dce378d8b989263cef06813e (diff)
downloadrockbox-aae2213e0aeb2df1a20c2651484cca6644bb3da6.tar.gz
rockbox-aae2213e0aeb2df1a20c2651484cca6644bb3da6.zip
Add build folder cleanup on build errors and add option to keep it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25411 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/deploy-release.py')
-rwxr-xr-xrbutil/rbutilqt/deploy-release.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/rbutil/rbutilqt/deploy-release.py b/rbutil/rbutilqt/deploy-release.py
index f37535ea69..65eedf46ad 100755
--- a/rbutil/rbutilqt/deploy-release.py
+++ b/rbutil/rbutilqt/deploy-release.py
@@ -115,6 +115,7 @@ def usage(myself):
115 print " -b, --binary-only only create binary archive" 115 print " -b, --binary-only only create binary archive"
116 if sys.platform != "darwin": 116 if sys.platform != "darwin":
117 print " -d, --dynamic link dynamically instead of static" 117 print " -d, --dynamic link dynamically instead of static"
118 print " -k, --keep-temp keep temporary folder on build failure"
118 print " -h, --help this help" 119 print " -h, --help this help"
119 print " If neither a project file nor tag is specified trunk will get downloaded" 120 print " If neither a project file nor tag is specified trunk will get downloaded"
120 print " from svn." 121 print " from svn."
@@ -353,11 +354,20 @@ def filestats(filename):
353 print "-" * len(filename), "\n" 354 print "-" * len(filename), "\n"
354 355
355 356
357def tempclean(workfolder, nopro):
358 if nopro == True:
359 print "Cleaning up working folder %s" % workfolder
360 shutil.rmtree(workfolder)
361 else:
362 print "Project file specified or cleanup disabled!"
363 print "Temporary files kept at %s" % workfolder
364
365
356def main(): 366def main():
357 startup = time.time() 367 startup = time.time()
358 try: 368 try:
359 opts, args = getopt.getopt(sys.argv[1:], "q:p:t:a:sbdh", 369 opts, args = getopt.getopt(sys.argv[1:], "q:p:t:a:sbdkh",
360 ["qmake=", "project=", "tag=", "add=", "source-only", "binary-only", "dynamic", "help"]) 370 ["qmake=", "project=", "tag=", "add=", "source-only", "binary-only", "dynamic", "keep-temp", "help"])
361 except getopt.GetoptError, err: 371 except getopt.GetoptError, err:
362 print str(err) 372 print str(err)
363 usage(sys.argv[0]) 373 usage(sys.argv[0])
@@ -370,6 +380,7 @@ def main():
370 cleanup = True 380 cleanup = True
371 binary = True 381 binary = True
372 source = True 382 source = True
383 keeptemp = False
373 if sys.platform != "darwin": 384 if sys.platform != "darwin":
374 static = True 385 static = True
375 else: 386 else:
@@ -391,6 +402,8 @@ def main():
391 source = False 402 source = False
392 if o in ("-d", "--dynamic") and sys.platform != "darwin": 403 if o in ("-d", "--dynamic") and sys.platform != "darwin":
393 static = False 404 static = False
405 if o in ("-k", "--keep-temp"):
406 keeptemp = True
394 if o in ("-h", "--help"): 407 if o in ("-h", "--help"):
395 usage(sys.argv[0]) 408 usage(sys.argv[0])
396 sys.exit(0) 409 sys.exit(0)
@@ -434,6 +447,7 @@ def main():
434 proj = sourcefolder + project 447 proj = sourcefolder + project
435 # get sources and pack source tarball 448 # get sources and pack source tarball
436 if not getsources(svnbase, svnpaths, sourcefolder) == 0: 449 if not getsources(svnbase, svnpaths, sourcefolder) == 0:
450 tempclean(workfolder, cleanup and not keeptemp)
437 sys.exit(1) 451 sys.exit(1)
438 452
439 if source == True: 453 if source == True:
@@ -463,11 +477,14 @@ def main():
463 477
464 # build it. 478 # build it.
465 if not qmake(qm, proj, sourcefolder, static) == 0: 479 if not qmake(qm, proj, sourcefolder, static) == 0:
480 tempclean(workfolder, cleanup and not keeptemp)
466 sys.exit(1) 481 sys.exit(1)
467 if not build(sourcefolder) == 0: 482 if not build(sourcefolder) == 0:
483 tempclean(workfolder, cleanup and not keeptemp)
468 sys.exit(1) 484 sys.exit(1)
469 if sys.platform == "win32": 485 if sys.platform == "win32":
470 if not upxfile(sourcefolder) == 0: 486 if not upxfile(sourcefolder) == 0:
487 tempclean(workfolder, cleanup and not keeptemp)
471 sys.exit(1) 488 sys.exit(1)
472 archive = zipball(ver, sourcefolder) 489 archive = zipball(ver, sourcefolder)
473 elif sys.platform == "darwin": 490 elif sys.platform == "darwin":
@@ -476,11 +493,7 @@ def main():
476 archive = tarball(ver, sourcefolder) 493 archive = tarball(ver, sourcefolder)
477 494
478 # remove temporary files 495 # remove temporary files
479 print "Cleaning up working folder %s" % workfolder 496 tempclean(workfolder, cleanup)
480 if cleanup == True:
481 shutil.rmtree(workfolder)
482 else:
483 print "Project file specified, not cleaning up!"
484 497
485 # display summary 498 # display summary
486 headline = "Build Summary for %s" % program 499 headline = "Build Summary for %s" % program