Skip to content

Commit

Permalink
Builder: Pilot can build from the stable branch
Browse files Browse the repository at this point in the history
The --branch option is given to every invocation of autobuild.py.�
  • Loading branch information
skyjake committed Mar 14, 2012
1 parent f1b1612 commit 1355f28
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions distrib/pilot.py
Expand Up @@ -94,6 +94,22 @@ def checkHome():
raise Exception(".pilot home directory does not exist.")


def branchFileName():
return os.path.join(homeDir(), 'branch')


def currentBranch():
if not os.path.exists(branchFileName()):
return 'master' # default branch
return file(branchFileName(), 'rt').strip()


def switchToBranch(branch):
f = file(branchFileName(), 'wt')
print >> f, branch
f.close()


def checkMasterActions():
"""Special master actions."""
if len(sys.argv) < 2: return
Expand Down Expand Up @@ -282,8 +298,21 @@ def doTask(task):
task in pilotcfg.IGNORED_TASKS:
return True

if task == 'tag_build':
msg("TAG NEW BUILD")
if task == 'patch':
msg("PATCH")
switchToBranch('stable')
return True

elif task == 'branch_stable':
msg("SWITCH TO STABLE BRANCH")
switchToBranch('stable')

elif task == 'branch_master':
msg("SWITCH TO MASTER BRANCH")
switchToBranch('master')

elif task == 'tag_build':
msg("TAG MASTER BRANCH")
return autobuild('create')

elif task == 'deb_changes':
Expand Down Expand Up @@ -318,6 +347,10 @@ def doTask(task):
elif task == 'generate_apidoc':
msg("GENERATE API DOCUMENTATION")
return autobuild('apidoc')

elif task == 'mirror':
msg("MIRROR")
systemCommand('mirror-buildmaster-to-idisk.sh')

return True

Expand All @@ -336,7 +369,15 @@ def handleCompletedTasks():

print "Task '%s' has been completed (noticed at %s)" % (task, time.asctime())

if task == 'tag_build':
if task == 'patch':
# Everyone must switch to the stable branch.
newTask('branch_stable', allClients=True)

elif task == 'branch_stable':
# Commence with a build when everyone is ready.
newTask('tag_build', forClient='master')

elif task == 'tag_build':
newTask('deb_changes', forClient='ubuntu')
newTask('generate_readme', forClient='clikits')

Expand All @@ -346,9 +387,14 @@ def handleCompletedTasks():
elif task == 'build':
newTask('publish', forClient='master')
newTask('apt_refresh', forClient='ubuntu')
# After the build we can switch to the master again.
newTask('branch_master', allClients=True)

elif task == 'publish':
newTask('update_feed', forClient='master')

elif task == 'update_feed':
newTask('mirror', forClient='master')


def autobuild(cmd):
Expand All @@ -360,6 +406,8 @@ def autobuild(cmd):
if 'APT_DIR' in dir(pilotcfg):
cmdLine += " --apt %s" % pilotcfg.APT_DIR

cmdLine += " --branch %s" % currentBranch()

systemCommand(cmdLine)
return True

Expand Down

0 comments on commit 1355f28

Please sign in to comment.