Author: David Schneider <david.schnei...@picle.org> Branch: buildbot-0.8.7 Changeset: r813:9f8ceeb704d5 Date: 2013-04-29 19:21 +0200 http://bitbucket.org/pypy/buildbot/changeset/9f8ceeb704d5/
Log: use the builtin mercurial support diff --git a/bot2/pypybuildbot/builds.py b/bot2/pypybuildbot/builds.py --- a/bot2/pypybuildbot/builds.py +++ b/bot2/pypybuildbot/builds.py @@ -1,3 +1,4 @@ +from buildbot.steps.source.mercurial import Mercurial from buildbot.process import factory from buildbot.steps import shell, transfer from buildbot.steps.trigger import Trigger @@ -59,8 +60,8 @@ if not os.path.exists(masterdest): os.makedirs(masterdest) # - assert '%(final_file_name)s' in self.basename - symname = self.basename.replace('%(final_file_name)s', 'latest') + assert '%(got_revision)s' in self.basename + symname = self.basename.replace('%(got_revision)s', 'latest') assert '%' not in symname self.symlinkname = os.path.join(masterdest, symname) # @@ -178,92 +179,18 @@ # _______________________________________________________________ -class UpdateCheckout(ShellCmd): - description = 'hg update' - command = 'UNKNOWN' - - def __init__(self, workdir=None, haltOnFailure=True, force_branch=None, - **kwargs): - ShellCmd.__init__(self, workdir=workdir, haltOnFailure=haltOnFailure, - **kwargs) - self.force_branch = force_branch - self.addFactoryArguments(force_branch=force_branch) - - def start(self): - if self.force_branch is not None: - branch = self.force_branch - # Note: We could add a warning to the output if we - # ignore the branch set by the user. - else: - properties = self.build.getProperties() - branch = properties['branch'] or 'default' - command = ["hg", "update", "--clean", "-r", branch] - self.setCommand(command) - ShellCmd.start(self) - - -class CheckGotRevision(ShellCmd): - description = 'got_revision' - command = ['hg', 'parents', '--template', 'got_revision:{rev}:{node}'] - - def commandComplete(self, cmd): - if cmd.rc == 0: - got_revision = cmd.logs['stdio'].getText() - got_revision = got_revision.split('got_revision:')[-1] - # manually get the effect of {node|short} without using a - # '|' in the command-line, because it doesn't work on Windows - num = got_revision.find(':') - if num > 0: - got_revision = got_revision[:num + 13] - # - final_file_name = got_revision.replace(':', '-') - # ':' should not be part of filenames --- too many issues - self.build.setProperty('got_revision', got_revision, - 'got_revision') - self.build.setProperty('final_file_name', final_file_name, - 'got_revision') - - def update_hg(platform, factory, repourl, workdir, use_branch, force_branch=None): - if platform == 'win32': - command = "if not exist .hg rmdir /q /s ." - else: - command = "if [ ! -d .hg ]; then rm -fr * .[a-z]*; fi" - factory.addStep(ShellCmd(description="rmdir?", - command=command, - workdir=workdir, - haltOnFailure=False)) - # - if platform == "win32": - command = "if not exist .hg %s" - else: - command = "if [ ! -d .hg ]; then %s; fi" - command = command % ("hg clone -U " + repourl + " .") - factory.addStep(ShellCmd(description="hg clone", - command=command, - workdir=workdir, - timeout=3600, - haltOnFailure=True)) - # factory.addStep( - ShellCmd(description="hg purge", - command="hg --config extensions.purge= purge --all", - workdir=workdir, - haltOnFailure=True)) - # - factory.addStep(ShellCmd(description="hg pull", - command="hg pull", - workdir=workdir)) - # - if use_branch or force_branch: - factory.addStep(UpdateCheckout(workdir=workdir, - haltOnFailure=True, - force_branch=force_branch)) - else: - factory.addStep(ShellCmd(description="hg update", - command=WithProperties("hg update --clean %(revision)s"), - workdir=workdir)) + Mercurial( + repourl=repourl, + mode='incremental', + method='fresh', + defaultBranch=force_branch, + branchType='inrepo', + clobberOnBranchChange=False, + workdir=workdir, + logEnviron=False)) def setup_steps(platform, factory, workdir=None, @@ -278,11 +205,11 @@ update_hg(platform, factory, repourl, workdir, use_branch=True, force_branch=force_branch) # - factory.addStep(CheckGotRevision(workdir=workdir)) + def build_name(platform, jit=False, flags=[], placeholder=None): if placeholder is None: - placeholder = '%(final_file_name)s' + placeholder = '%(got_revision)s' if jit or '-Ojit' in flags: kind = 'jit' else: _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit