[152491] contrib/buildbot-test/master.cfg

raimue at macports.org raimue at macports.org
Sun Sep 11 06:32:09 PDT 2016


Revision: 152491
          https://trac.macports.org/changeset/152491
Author:   raimue at macports.org
Date:     2016-09-11 06:32:09 -0700 (Sun, 11 Sep 2016)
Log Message:
-----------
buildbot: explicit use config.json variables

Modified Paths:
--------------
    contrib/buildbot-test/master.cfg

Modified: contrib/buildbot-test/master.cfg
===================================================================
--- contrib/buildbot-test/master.cfg	2016-09-11 12:34:55 UTC (rev 152490)
+++ contrib/buildbot-test/master.cfg	2016-09-11 13:32:09 UTC (rev 152491)
@@ -20,28 +20,29 @@
 # (where /opt/local shouldn't be messed with) and the production server (where
 # it has to be)
 
-production   = False
-privkey      = ''
-slaveport    = 9989
-httpport     = 8010
-buildboturl  = "http://localhost:8010/"
-htpasswdfile = "htpasswd"
-mpbbsvnurl   = "https://svn.macports.org/repository/macports/contrib/mp-buildbot"
-svnurl       = "https://svn.macports.org/repository/macports/trunk"
-archivesite  = "https://packages.macports.org"
-slaveprefix  = "/opt/local"
-toolsprefix  = "/opt/mports"
+config = {
+    'production':   False,
+    'privkey':      "",
+    'slaveport':    9989,
+    'httpport':     8010,
+    'buildboturl':  "http://localhost:8010/",
+    'htpasswdfile': "htpasswd",
+    'mpbbsvnurl':   "https://svn.macports.org/repository/macports/contrib/mp-buildbot",
+    'svnurl':       "https://svn.macports.org/repository/macports/trunk",
+    'archivesite':  "https://packages.macports.org",
+    'slaveprefix':  "/opt/local",
+    'toolsprefix':  "/opt/mports"
+}
 
 if os.path.exists(_path('config.json')):
     with open(_path('config.json')) as f:
         configdata = json.load(f)
-    locals = locals()
-    for key in ["production", "privkey", "slaveport", "httpport", "buildboturl", "htpasswdfile", "mpbbsvnurl", "svnurl", "archivesite", "slaveprefix", "toolsprefix"]:
+    for key in config:
         if configdata[key]:
-            locals[key] = configdata[key]
+            config[key] = configdata[key]
 
 path_base  = "/usr/bin:/bin:/usr/sbin:/sbin"
-path_ports = os.path.join(toolsprefix, "bin") + ":" + path_base
+path_ports = os.path.join(config['toolsprefix'], "bin") + ":" + path_base
 
 # Allow spaces and tabs in property values
 import re
@@ -72,7 +73,7 @@
 # 'slavePortnum' defines the TCP port to listen on for connections from slaves.
 # This must match the value configured into the buildslaves (with their
 # --master option)
-c['slavePortnum'] = slaveport
+c['slavePortnum'] = config['slaveport']
 
 ####### CHANGESOURCES
 
@@ -82,7 +83,7 @@
 # poller is used for local testing but PBChangeSource (which relies on
 # notifications from a post-commit script) should be used in production
 
-if production:
+if config['production']:
     # TODO
     from buildbot.changes.pb import PBChangeSource
     sourcedata = []
@@ -244,12 +245,12 @@
 
 # can't run with prefix inside the workdir in production,
 # because archives must be built with prefix=/opt/local
-if production:
+if config['production']:
     prefix='/opt/local'
     dlhost='packages at packages-origin.macports.org'
     dlpath='/var/www/html/packages'
 else:
-    prefix=slaveprefix
+    prefix=config['slaveprefix']
     dlhost=''
     dlpath='./deployed_archives'
 
@@ -291,7 +292,7 @@
 
     # get mp-buildbot; we'll do the checkout of base and dports via these scripts
     portwatcher_factory.addStep(SVN(
-        repourl=mpbbsvnurl,
+        repourl=config['mpbbsvnurl'],
         env={"PATH": path_ports},
         alwaysUseLatest=True,
         preferLastChangedRev=True,
@@ -313,7 +314,7 @@
         haltOnFailure=True))
 
     portwatcher_factory.addStep(ShellCommand(
-        command=['./mpbb/mpbb', 'checkout', '--prefix', WithProperties(prefix), '--svn-url', svnurl],
+        command=['./mpbb/mpbb', 'checkout', '--prefix', WithProperties(prefix), '--svn-url', config['svnurl']],
         timeout=3600,
         name="checkout",
         description=["syncing", "ports"],
@@ -402,7 +403,7 @@
     haltOnFailure=True))
 
 portbuilder_factory.addStep(ShellCommand(
-    command=['./mpbb/mpbb', 'gather-archives', '--prefix', WithProperties(prefix), '--archive-site', archivesite, '--staging-dir', ulpath],
+    command=['./mpbb/mpbb', 'gather-archives', '--prefix', WithProperties(prefix), '--archive-site', config['archivesite'], '--staging-dir', ulpath],
     name="gather-archives",
     description=["gathering", "archives"],
     descriptionDone=["gather", "archives"],
@@ -415,12 +416,12 @@
 
 # XXX: move deploy_archives.sh functionality to mp-buildbot
 # sign generated binaries and sync to download server (if distributable)
-if production:
+if config['production']:
     portbuilder_factory.addStep(MasterShellCommand(command=["./deploy_archives.sh", WithProperties(ulpath_unique)],
                                        name="deploy-archives",
                                        description=["deploying", "archives"],
                                        descriptionDone=["deploy", "archives"],
-                          env={'PRIVKEY': privkey,
+                          env={'PRIVKEY': config['privkey'],
                                'DLHOST': dlhost,
                                'DLPATH': dlpath}))
 
@@ -487,7 +488,7 @@
 
 # add new users with crypt, not md5/sha1:
 # htpasswd -d -n $USER
-htauth = HTPasswdAuth(htpasswdfile)
+htauth = HTPasswdAuth(config['htpasswdfile'])
 
 authz_cfg=authz.Authz(
     auth               = htauth,
@@ -649,7 +650,7 @@
         'subject' : subject
     }
 
-if production:
+if config['production']:
     # send mail about base failures to users on the blamelist
     mn = MailNotifier(
         fromaddr="noreply at macports.org",
@@ -695,9 +696,9 @@
 c['title'] = "MacPorts"
 c['titleURL'] = "https://www.macports.org/"
 
-c['buildbotURL'] = buildboturl
+c['buildbotURL'] = config['buildboturl']
 c['status'].append(html.WebStatus(
-    http_port=httpport,
+    http_port=config['httpport'],
     authz=authz_cfg,
     changecommentlink=(r"#(\d+)", r"https://trac.macports.org/ticket/\1", r"Ticket \g<0>")
 ))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160911/be0e386c/attachment.html>


More information about the macports-changes mailing list