diff --git a/buildbot/contrib/reboot.py b/buildbot/contrib/reboot.py new file mode 100644 index 0000000..7a00fb2 --- /dev/null +++ b/buildbot/contrib/reboot.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# Really cut down version of count_and_reboot.py (from Chris AtLee) +# This is for jhbuildbot to use as a run_post_hook script. + +import os, sys + +if sys.platform in ('darwin', 'linux2'): + def reboot(): + # -S means accept password from stdin, which we redirect + # from /dev/null + # This results in sudo not waiting forever for a password. + # If sudoers isnt set up properly, we fail immediately. + os.system("sudo -S reboot < /dev/null") + # After starting shutdown, go to sleep so buildbot doesnt + # build anything else while shutdown is happening. + time.sleep(600) + +elif sys.platform == "win32": + def reboot(): + os.system("shudown -r") + time.sleep(600) + + +if __name__ == "__main__": + reboot() diff --git a/jhbuild/buildbot/factory.py b/jhbuild/buildbot/factory.py index 2e39e4d..fe5b722 100644 --- a/jhbuild/buildbot/factory.py +++ b/jhbuild/buildbot/factory.py @@ -45,6 +45,10 @@ class JHBuildFactory(factory.BuildFactory): if self.slave.run_clean_afterwards: self.addStep(JHBuildCommand, stage='clean', moduleset=self.moduleset, module=self.module) + if self.slave.run_post_hook: + self.addStep(JHBuildModulePathCommand, moduleset=self.moduleset, + module=self.module, action=self.slave.run_post_hook, + actionName='Post Build', flunkOnFailure=False, warnOnFailure=False) def newBuild(self, request): return factory.BuildFactory.newBuild(self, request) diff --git a/jhbuild/commands/bot.py b/jhbuild/commands/bot.py index dcdf99a..d4a210c 100644 --- a/jhbuild/commands/bot.py +++ b/jhbuild/commands/bot.py @@ -280,6 +280,7 @@ class cmd_bot(Command): run_checks = True run_coverage_report = False run_clean_afterwards = False + run_post_hook = "" def load_extra_configuration(self, slaves_dir): slave_xml_file = os.path.join(slaves_dir, self.slavename + '.xml') @@ -292,7 +293,7 @@ class cmd_bot(Command): for attribute in ('config/max_builds', 'config/missing_timeout', 'config/run_checks', 'config/run_coverage_report', - 'config/run_clean_afterwards', + 'config/run_clean_afterwards', 'config/run_post_hook', 'info/contact_name', 'info/contact_email', 'info/url', 'info/distribution', 'info/architecture', 'info/version'):