[Checkins] SVN: gocept.bsquare/trunk/ merge of the branch svn+ssh://svn.zope.org/repos/main/gocept.bsquare/branches/pcardune-setup

Adam Groszer agroszer at gmail.com
Wed May 13 02:55:19 EDT 2009


Log message for revision 99884:
  merge of the branch svn+ssh://svn.zope.org/repos/main/gocept.bsquare/branches/pcardune-setup
  which had lots of changes, see CHANGES.txt

Changed:
  _U  gocept.bsquare/trunk/
  A   gocept.bsquare/trunk/CHANGES.txt
  D   gocept.bsquare/trunk/__init__.py
  A   gocept.bsquare/trunk/bootstrap.py
  A   gocept.bsquare/trunk/buildout.cfg
  D   gocept.bsquare/trunk/master.py
  A   gocept.bsquare/trunk/setup.py
  A   gocept.bsquare/trunk/src/
  U   gocept.bsquare/trunk/src/gocept/bsquare/master.py
  D   gocept.bsquare/trunk/static/
  D   gocept.bsquare/trunk/status.py
  A   gocept.bsquare/trunk/update-config.py
  U   gocept.bsquare/trunk/update-config.sh

-=-

Property changes on: gocept.bsquare/trunk
___________________________________________________________________
Added: svn:ignore
   + bin
.installed.cfg
develop-eggs
parts


Copied: gocept.bsquare/trunk/CHANGES.txt (from rev 99608, gocept.bsquare/branches/pcardune-setup/CHANGES.txt)
===================================================================
--- gocept.bsquare/trunk/CHANGES.txt	                        (rev 0)
+++ gocept.bsquare/trunk/CHANGES.txt	2009-05-13 06:55:18 UTC (rev 99884)
@@ -0,0 +1,36 @@
+0.1.0 2009-04-25
+----------------
+Added svnbin parameter, win32 seems to be picky about the svn.exe location
+
+Different commands for win32
+
+pythonic version of update-config.sh -- for win32
+
+0.1.0 2008-04-14
+----------------
+Added "-1" parameter to 'bin/test --exit-with-status'
+
+0.1.0 2008-04-09
+----------------
+Added links to cruise builders
+
+0.1.0 2008-04-09
+----------------
+More options for configure:
+- maxConcurrent: maximum number of concurrent builds
+
+0.1.0 2008-04-08
+----------------
+More options for configure:
+- nightlyhour
+- makefactory
+Added docs for options
+
+0.1.0 2008-04-07
+----------------
+Added the options to configure:
+- svnuser = None, svnpassword = None,
+- pollinterval = 30,
+- poller = None,
+- makefactory = make_factory
+to help override them
\ No newline at end of file

Copied: gocept.bsquare/trunk/bootstrap.py (from rev 99608, gocept.bsquare/branches/pcardune-setup/bootstrap.py)
===================================================================
--- gocept.bsquare/trunk/bootstrap.py	                        (rev 0)
+++ gocept.bsquare/trunk/bootstrap.py	2009-05-13 06:55:18 UTC (rev 99884)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 77221 2007-06-29 06:56:54Z srichter $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                     ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+    cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+    os.P_WAIT, sys.executable, sys.executable,
+    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+    dict(os.environ,
+         PYTHONPATH=
+         ws.find(pkg_resources.Requirement.parse('setuptools')).location
+         ),
+    ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)

Copied: gocept.bsquare/trunk/buildout.cfg (from rev 99608, gocept.bsquare/branches/pcardune-setup/buildout.cfg)
===================================================================
--- gocept.bsquare/trunk/buildout.cfg	                        (rev 0)
+++ gocept.bsquare/trunk/buildout.cfg	2009-05-13 06:55:18 UTC (rev 99884)
@@ -0,0 +1,8 @@
+[buildout]
+develop = .
+parts =  buildbot
+
+[buildbot]
+recipe = zc.recipe.egg
+eggs = gocept.bsquare
+interpreter = python
\ No newline at end of file

Deleted: gocept.bsquare/trunk/master.py
===================================================================
--- gocept.bsquare/trunk/master.py	2009-05-12 19:44:45 UTC (rev 99883)
+++ gocept.bsquare/trunk/master.py	2009-05-13 06:55:18 UTC (rev 99884)
@@ -1,89 +0,0 @@
-# A buildbot master configuration for buildout-based project repositories
-
-import os.path
-import subprocess
-from twisted.python import log
-
-from buildbot import locks
-
-from buildbot.changes.svnpoller import SVNPoller, split_file_branches
-from buildbot.steps.source import SVN
-from buildbot.steps.shell import Compile
-from buildbot.process.factory import BuildFactory
-
-from buildbot.process.base import Build
-from buildbot.status import html
-from buildbot.scheduler import Scheduler, Nightly
-
-import bsquare.status
-
-
-def split_file(path):
-    pieces = path.split("/")
-    if len(pieces) < 2:
-        return None
-    project, branch = pieces[0], pieces[1]
-    if branch != "trunk":
-        return None
-    return ("%s/%s" % (project, branch), "/".join(pieces[2:]))
-
-
-def make_factory(svn_url):
-    f = BuildFactory()
-    f.addStep(SVN(baseURL=svn_url, mode='clobber'))
-    f.addStep(Compile(name='bootstrap',
-                command='buildout bootstrap .',
-                description=['bootstrapping'],
-                descriptionDone=['bootstrap']))
-    f.addStep(Compile(name="buildout",
-                command='bin/buildout',
-                description=['building'],
-                descriptionDone=['build']))
-    f.addStep(Compile(name="test",
-                command='if [ -e bin/test ]; then bin/test --exit-with-status; fi',
-                description=['testing'],
-                descriptionDone=['tests']))
-
-    f.treeStableTimer = 300
-    return f
-
-
-def configure(svn_url, http_port=8010, allowForce=False):
-    """Creates a buildout master configuration.
-
-    The configuration returned is almost functional. You just need to add
-    slaves.
-
-    """
-    c = {}
-    c['slavePortnum'] = 8989
-    c['change_source'] = SVNPoller(svn_url, split_file=split_file, pollinterval=30)
-    c['schedulers'] = [] 
-    c['builders'] = []
-
-    slow_lock = locks.SlaveLock("cpu", maxCount=2)
-
-    projects = open("project-list.cfg", "rb").readlines()
-    projects = [x.strip() for x in projects]
-    for project in projects:
-        f = make_factory(svn_url)
-        c['builders'].append({
-            'name': project,
-            'slavename': 'local',
-            'builddir': project,
-            'factory': f,
-            'locks': [slow_lock],
-        })
-        del f
-
-        c['schedulers'].append(Scheduler(
-            project, "%s/trunk" % project, 30, [project]))
-        c['schedulers'].append(Nightly(
-            "%s nightly" % project, [project], hour=[3],
-            branch="%s/trunk" % project))
-
-    # Status display(s)
-    c['status'] = []
-    c['status'].append(bsquare.status.ExtendedWebStatus(http_port=http_port,
-                                                        allowForce=allowForce))
-    return c

Copied: gocept.bsquare/trunk/setup.py (from rev 99608, gocept.bsquare/branches/pcardune-setup/setup.py)
===================================================================
--- gocept.bsquare/trunk/setup.py	                        (rev 0)
+++ gocept.bsquare/trunk/setup.py	2009-05-13 06:55:18 UTC (rev 99884)
@@ -0,0 +1,20 @@
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+setup(
+    name='gocept.bsquare',
+    version = '0.1.0-dev',
+    author='GoCept',
+    packages=find_packages('src'),
+    package_dir = {'': 'src'},
+    license = "ZPL",
+    install_requires=[
+        'setuptools',
+        'buildbot',
+        ],
+    include_package_data = True,
+    zip_safe = False,
+    )


Property changes on: gocept.bsquare/trunk/src
___________________________________________________________________
Added: svn:ignore
   + gocept.bsquare.egg-info


Modified: gocept.bsquare/trunk/src/gocept/bsquare/master.py
===================================================================
--- gocept.bsquare/branches/pcardune-setup/src/gocept/bsquare/master.py	2009-04-30 13:49:47 UTC (rev 99608)
+++ gocept.bsquare/trunk/src/gocept/bsquare/master.py	2009-05-13 06:55:18 UTC (rev 99884)
@@ -45,10 +45,11 @@
                 command=command,
                 description=['building'],
                 descriptionDone=['build']))
+    #-1 == stop on first error
     if is_win32:
-        command = "bin\\test.exe --exit-with-status -1"
+        command = "if EXIST bin\\test.exe bin\\test.exe --exit-with-status -1"
     else:
-        command = 'bin/test --exit-with-status -1' #-1 == stop on first error
+        command = 'if [ -e bin/test ]; then bin/test --exit-with-status -1; fi'
     f.addStep(Compile(name="test",
                 command=command,
                 description=['testing'],

Deleted: gocept.bsquare/trunk/status.py
===================================================================
--- gocept.bsquare/trunk/status.py	2009-05-12 19:44:45 UTC (rev 99883)
+++ gocept.bsquare/trunk/status.py	2009-05-13 06:55:18 UTC (rev 99884)
@@ -1,130 +0,0 @@
-# An extended web status display providing a cruise-control-like UI.
-
-import buildbot.status.web.base
-import datetime
-import os.path
-import twisted.web.static
-
-
-STATIC_DIR = os.path.join(os.path.dirname(__file__), 'static')
-
-
-class OverviewStatusResource(buildbot.status.web.base.HtmlResource):
-
-    title = "Buildbot Cruise-control"
-
-    def _builder_status(self, builder):
-        build = builder.getLastFinishedBuild()
-        if build is None:
-            stat = 'never'
-        else:
-            stat = build.getColor()
-        return stat
-
-    def head(self, request):
-        return ('<link href="%s" rel="stylesheet" type="text/css" />' % 
-                request.sibLink('cruise.css'))
-
-    def body(self, request):
-        "This method builds the main waterfall display."
-
-        data = ''
-
-        status = self.getStatus(request)
-
-        projectName = status.getProjectName()
-        projectURL = status.getProjectURL()
-
-        data += "<h1>%s</h1>" % projectName
-
-        builders = [status.getBuilder(x) for x in 
-                status.getBuilderNames()]
-
-        # Setup filters
-        filters = []
-        filter_status = request.args.get('status', [None])[0] or 'red'
-        # Gah.
-        if filter_status == 'None':
-            filter_status = None
-        # Double-gah!
-        if filter_status != "any":
-            filters.append(lambda x:self._builder_status(x) == filter_status)
-
-        filter_prefix = request.args.get('prefix', [None])[0] or ''
-        filters.append(lambda x:x.getName().startswith(filter_prefix))
-
-        # Create totals
-        status = {}
-        for builder in builders:
-            stat = self._builder_status(builder)
-            if not stat in status:
-                status[stat] = []
-            status[stat].append(builder)
-
-        data += '<form id="filter" action="%s">' % request.sibLink('cruise')
-        data += '<div id="status-blocks">'
-        for stat, affected in status.items():
-            if stat == filter_status:
-                selected = 'checked="checked"'
-            else:
-                selected = ""
-            data += '<div class="%s"><h3><label><input type="radio" name="status" value="%s" %s/> %s</label></h3><p>%s projects</p></div>' % (stat, stat, selected, stat, len(affected))
-
-        if filter_status == "any":
-            selected = 'checked="checked"'
-        else:
-            selected = ''
-        data += '<div><h3><label><input type="radio" name="status" value="any" %s/> Any</label></h3><p>&nbsp;</p></div>' % selected
-
-        data += "</div>"
-        data += '<div class="clear"/>'
-        data += '<div><label for="prefix">Show only projects starting with</label> <input type="text" name="prefix" value="%s"/> <input type="submit" value="Set filter"/></div>' % filter_prefix
-        data += '</form>'
-
-        # Apply filters on builders
-        for f in filters:
-            builders = filter(f, builders)
-        data += "<p>Showing %i projects matching the current filter.</p>" % len(builders)
-
-        # Create detail view panels
-        for builder in builders:
-            activity = builder.getState()[0]
-            data += '<div class="project %s %s"><h2>%s</h2>' % (self._builder_status(builder),
-                    activity, builder.getName())
-            data += '<p>This builder is currently %s.</p>' % activity
-            data += "<ul>"
-            for x in range(1,6):
-                build = builder.getBuild(-x)
-                if build is None:
-                    break
-                reason = build.reason
-                started = datetime.datetime.fromtimestamp(build.started)
-                started = started.strftime('%d %b, %H:%M')
-                if build.source.changes:
-                    change = build.source.changes[0]
-                    reason = "%s by %s: %s" % (change.revision, change.who, change.comments)
-                data += '<li style="color:%s;">%s &ndash; %s</li>' % (
-                        build.color, started, reason)
-            data += "</ul>"
-            data += "</div>"
-
-        return data
-
-
-
-class ExtendedWebStatus(buildbot.status.web.baseweb.WebStatus):
-
-    def __init__(self, *args, **kw):
-        buildbot.status.web.baseweb.WebStatus.__init__(self, *args, **kw)
-
-    def setupUsualPages(self):
-        buildbot.status.web.baseweb.WebStatus.setupUsualPages(self)
-        self.putChild('cruise', OverviewStatusResource())
-
-        css = open(os.path.join(STATIC_DIR, 'cruise.css')).read()
-        self.putChild('cruise.css', twisted.web.static.Data(css, 'text/css'))
-
-        for image in ['headerbg.png', 'headerbg2.png', 'errorbg.png']:
-            data = open(os.path.join(STATIC_DIR, image)).read()
-            self.putChild(image, twisted.web.static.Data(data, 'image/png'))
-

Copied: gocept.bsquare/trunk/update-config.py (from rev 99608, gocept.bsquare/branches/pcardune-setup/update-config.py)
===================================================================
--- gocept.bsquare/trunk/update-config.py	                        (rev 0)
+++ gocept.bsquare/trunk/update-config.py	2009-05-13 06:55:18 UTC (rev 99884)
@@ -0,0 +1,117 @@
+#!/usr/bin/env python
+##############################################################################
+#
+# Copyright (c) 2009 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Update bsquare package list
+
+$Id$
+"""
+import sys
+import os
+import subprocess
+
+SVNBIN = 'svn'
+#usually authentication will be cached by svn, in case not fill in below
+SVNUSER = ''
+SVNPASS = ''
+
+is_win32 = sys.platform == 'win32'
+
+def system(command, input=''):
+    print command
+
+    p = subprocess.Popen(command,
+                         shell=True,
+                         stdin=subprocess.PIPE,
+                         stdout=subprocess.PIPE,
+                         stderr=subprocess.PIPE,
+                         close_fds=not is_win32)
+    sts = p.wait()
+    if sts != 0:
+        raise OSError(
+            u'An error occurred while running command: %s, error: %s' % (
+                command, p.stderr.read()))
+    i, o, e = (p.stdin, p.stdout, p.stderr)
+    if input:
+        i.write(input)
+    i.close()
+    result = o.read() + e.read()
+    o.close()
+    e.close()
+    return result
+
+
+def do(cmd):
+    p = subprocess.Popen(cmd, shell=True,
+                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    sts = os.waitpid(p.pid, 0)[1]
+    if sts != 0:
+        raise OSError(
+            u'An error occurred while running command: %s, error: %s' % (
+                cmd, p.stderr.read()))
+
+    return p.stdout.read()
+
+def svnls(url):
+    if SVNUSER:
+        svnuser = " --username %s" % SVNUSER
+    else:
+        svnuser = ''
+
+    if SVNPASS:
+        svnpass = " --password %s" % SVNPASS
+    else:
+        svnpass = ''
+
+    return system("svn ls %s%s%s" % (url, svnuser, svnpass))
+
+def main():
+    if len(sys.argv) < 3:
+        print "Usage: %s buildbot-config-home-dir svn-base-url" % sys.argv[0]
+        sys.exit(1)
+
+    home = sys.argv[1]
+    base = sys.argv[2]
+
+    projects = svnls(base)
+    cleaned = []
+    for project in projects.splitlines():
+        if project.endswith('/'):
+            project = project[:-1]
+
+        try:
+            svnls("%s/%s/trunk/buildout.cfg" % (base, project))
+            cleaned.append(project)
+        except OSError:
+            pass
+
+    open(os.path.join(home, 'project-list.cfg'), 'wb').write(
+        '\n'.join(cleaned) )
+
+    if sys.platform == 'win32':
+        #there is no make usually on win32 and reconfig is also not supported
+        #the only chance is to restart the win32 service
+        bbservice = os.path.join(os.path.dirname(sys.executable),
+                                 'scripts', 'buildbot_service.py')
+        if os.path.exists(bbservice):
+            system('%s restart "%s"' % (bbservice, home))
+        else:
+            print "Missing %s, unable to reconfig buildbot!" % bbservice
+            sys.exit(1)
+    else:
+        #let's assume anything else is posix
+        system("cd %s; make reconfig > /dev/null" % home)
+
+
+if __name__ == "__main__":
+    main()
\ No newline at end of file

Modified: gocept.bsquare/trunk/update-config.sh
===================================================================
--- gocept.bsquare/trunk/update-config.sh	2009-05-12 19:44:45 UTC (rev 99883)
+++ gocept.bsquare/trunk/update-config.sh	2009-05-13 06:55:18 UTC (rev 99884)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -x
 
 HOME=$1
 BASE=$2
@@ -8,7 +8,7 @@
 for PROJECT in `svn ls $BASE`; do
     svn ls $BASE/$PROJECT/trunk/buildout.cfg &> /dev/null
     if [ "$?" != "0" ]; then
-        continue; 
+        continue;
     fi
     echo $PROJECT >> project-updates
 done
@@ -20,4 +20,4 @@
 # Restart the master
 make reconfig > /dev/null
 
-# vi: 
+# vi:
\ No newline at end of file



More information about the Checkins mailing list