jhbuild r2223 - in trunk: . buildbot buildbot/jhbuildbot jhbuild/buildbot jhbuild/buildbot/status/web jhbuild/commands



Author: fpeters
Date: Wed Aug 13 20:53:32 2008
New Revision: 2223
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2223&view=rev

Log:
* jhbuild/buildbot/__init__.py, jhbuild/buildbot/factory.py,
jhbuild/buildbot/status/web/__init__.py, jhbuild/commands/bot.py:
added a new jhbuild bot --start-server command to start the buildbot
server; moved custom buildbot modules from buildbot/jhbuildbot/ to
jhbuild/buildbot/.



Added:
   trunk/jhbuild/buildbot/   (props changed)
      - copied from r2214, /trunk/buildbot/jhbuildbot/
Removed:
   trunk/buildbot/jhbuildbot/
Modified:
   trunk/ChangeLog
   trunk/buildbot/ChangeLog
   trunk/buildbot/master.cfg
   trunk/jhbuild/buildbot/__init__.py
   trunk/jhbuild/buildbot/factory.py
   trunk/jhbuild/buildbot/status/web/__init__.py
   trunk/jhbuild/commands/bot.py

Modified: trunk/buildbot/master.cfg
==============================================================================
--- trunk/buildbot/master.cfg	(original)
+++ trunk/buildbot/master.cfg	Wed Aug 13 20:53:32 2008
@@ -16,13 +16,6 @@
 # a shorter alias to save typing.
 c = BuildmasterConfig = {}
 
-####### JHBUILD
-
-c['jhbuild'] = "~/bin/jhbuild"
-c['jhbuildrc'] = "/home/fred/.jhbuildrc"
-c['moduleset'] = "gnome-2.24"
-c['modules'] = "meta-gnome-desktop"
-
 ####### BUILDSLAVES
 
 # the 'slaves' list is read from the 'slaves.csv' file in the current directory
@@ -53,8 +46,8 @@
 ####### PROJECTS
 
 # the 'projects' list defines which jhbuild modules that to build
-from jhbuildbot import jhbuild_list
-c['projects'] = jhbuild_list(c, c['moduleset'], c['modules'])
+from jhbuild.buildbot import jhbuild_list
+c['projects'] = jhbuild_list()
 
 ####### CHANGESOURCES
 
@@ -94,7 +87,7 @@
 ####### SCHEDULERS
 
 ## configure the Schedulers
-from jhbuildbot.scheduler import SerialScheduler
+from jhbuild.buildbot.scheduler import SerialScheduler
 c['schedulers'] = []
 for slave in c['slaves']:
     s = None
@@ -124,11 +117,11 @@
 # sources. There are source-obtaining Steps in buildbot/steps/source.py for
 # CVS, SVN, and others.
 
-from jhbuildbot.factory import JHBuildFactory
+from jhbuild.buildbot.factory import JHBuildFactory
 c['builders'] = []
 for project in c['projects']:
     for slave in c['slaves']:
-        f = JHBuildFactory(project, c['moduleset'])
+        f = JHBuildFactory(project)
 	c['builders'].append({
             'name' : "%s-%s" % (project, slave.slavename),
             'slavename' : slave.slavename,
@@ -145,10 +138,13 @@
 
 c['status'] = []
 
-from jhbuildbot.status.web import JHBuildWebStatus
+from jhbuild.buildbot.status.web import JHBuildWebStatus
 c['status'].append(
-    JHBuildWebStatus(c['moduleset'], c['projects'], [x.slavename for x in c['slaves']],
-                     http_port=8080, allowForce=True)
+    JHBuildWebStatus(
+        jhbuild_config.moduleset,
+    	c['projects'],
+        [x.slavename for x in c['slaves']],
+        http_port=8080, allowForce=True)
 )
 
 # from buildbot.status import mail

Modified: trunk/jhbuild/buildbot/__init__.py
==============================================================================
--- /trunk/buildbot/jhbuildbot/__init__.py	(original)
+++ trunk/jhbuild/buildbot/__init__.py	Wed Aug 13 20:53:32 2008
@@ -1,9 +1,8 @@
+import jhbuild.moduleset
 
-import commands
-
-def jhbuild_list(c, moduleset, modules):
-    command = c['jhbuild'] + " --file="+ c['jhbuildrc'] +" --moduleset=" + moduleset + " " + "list" + " " + modules
-    (status, output) = commands.getstatusoutput(command)
-    if (status == 0):
-        return [x for x in output.split('\n') if x[:5] != "meta-"]
-    return []
+def jhbuild_list():
+    config = jhbuild.config.Config()
+    module_set = jhbuild.moduleset.load(jhbuild_config)
+    module_list = module_set.get_module_list(config.modules,
+            include_optional_modules=True)
+    return [x.name for x in module_list if not x.name.startswith('meta-')]

Modified: trunk/jhbuild/buildbot/factory.py
==============================================================================
--- /trunk/buildbot/jhbuildbot/factory.py	(original)
+++ trunk/jhbuild/buildbot/factory.py	Wed Aug 13 20:53:32 2008
@@ -1,5 +1,5 @@
 from buildbot.process import factory
-from jhbuildbot.steps import JHBuildSource, JHBuildCommand, JHBuildModulePathTestCommand, JHBuildModulePathCommand
+from steps import JHBuildSource, JHBuildCommand, JHBuildModulePathTestCommand, JHBuildModulePathCommand
 
 # This is the JHBuild factory. It creates a standard procedure to compile modules, run
 # checks and create reports.
@@ -10,9 +10,9 @@
     targets = []
     steps = []
 
-    def __init__(self, module, moduleset=None):
+    def __init__(self, module):
         factory.BuildFactory.__init__(self)
-        self.moduleset = moduleset
+        self.moduleset = jhbuild_config.moduleset
         self.module = module
         self.getSteps()
 

Modified: trunk/jhbuild/buildbot/status/web/__init__.py
==============================================================================
--- /trunk/buildbot/jhbuildbot/status/web/__init__.py	(original)
+++ trunk/jhbuild/buildbot/status/web/__init__.py	Wed Aug 13 20:53:32 2008
@@ -15,7 +15,7 @@
 HtmlResource.content = content
 
 from buildbot.status.web.baseweb import WebStatus
-from jhbuildbot.status.web.feeder import WaterfallWithFeeds
+from feeder import WaterfallWithFeeds
 
 class ProjectsSummary(HtmlResource):
 

Modified: trunk/jhbuild/commands/bot.py
==============================================================================
--- trunk/jhbuild/commands/bot.py	(original)
+++ trunk/jhbuild/commands/bot.py	Wed Aug 13 20:53:32 2008
@@ -103,6 +103,9 @@
             make_option('--step',
                         action='store_true', dest='step', default=False,
                         help=_('exec a buildbot step (internal use)')),
+            make_option('--start-server',
+                        action='store_true', dest='start_server', default=False,
+                        help=_('start a buildbot server')),
             ])
 
     def run(self, config, options, args):
@@ -145,6 +148,9 @@
             os.environ['TERM'] = 'dumb'
             rc = jhbuild.commands.run(command, config, args[1:])
             sys.exit(rc)
+        if options.start_server:
+            return self.start_server(config)
+
 
     def setup(self, config):
         module_set = jhbuild.moduleset.load(config, 'buildbot')
@@ -175,6 +181,7 @@
         usepty = 1
         umask = None
         basedir = os.path.join(config.checkoutroot, 'jhbuildbot')
+        os.chdir(basedir)
         if not os.path.exists(os.path.join(basedir, 'builddir')):
             os.makedirs(os.path.join(basedir, 'builddir'))
 
@@ -199,5 +206,39 @@
         JhBuildbotApplicationRunner.application = application
         JhBuildbotApplicationRunner(options).run()
 
+    def start_server(self, config):
+
+        from twisted.scripts._twistd_unix import UnixApplicationRunner, ServerOptions
+
+        options = ServerOptions()
+        options.parseOptions(['--no_save', '--nodaemon'])
+
+        class JhBuildbotApplicationRunner(UnixApplicationRunner):
+            application = None
+
+            def createOrGetApplication(self):
+                return self.application
+
+        from twisted.application import service
+        from buildbot.master import BuildMaster
+        application = service.Application('buildmaster')
+
+        basedir = os.path.join(
+                os.path.dirname(os.path.abspath(__file__)),
+                '../../buildbot/')
+        os.chdir(basedir)
+        if not os.path.exists(os.path.join(basedir, 'builddir')):
+            os.makedirs(os.path.join(basedir, 'builddir'))
+        master_cfg_path = os.path.join(basedir, 'master.cfg')
+
+        # make jhbuild config file accessible in master.cfg
+        __builtin__.__dict__['jhbuild_config'] = config
+
+        BuildMaster(basedir, master_cfg_path).setServiceParent(application)
+
+        JhBuildbotApplicationRunner.application = application
+        JhBuildbotApplicationRunner(options).run()
+
+
 register_command(cmd_bot)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]