[84318] contrib/buildbot/master.cfg

jmr at macports.org jmr at macports.org
Thu Sep 22 06:36:22 PDT 2011


Revision: 84318
          http://trac.macports.org/changeset/84318
Author:   jmr at macports.org
Date:     2011-09-22 06:36:20 -0700 (Thu, 22 Sep 2011)
Log Message:
-----------
buildmaster: run 'make install' in base builds, and drop privileges if buildslave is running as root

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

Modified: contrib/buildbot/master.cfg
===================================================================
--- contrib/buildbot/master.cfg	2011-09-22 13:32:29 UTC (rev 84317)
+++ contrib/buildbot/master.cfg	2011-09-22 13:36:20 UTC (rev 84318)
@@ -126,12 +126,37 @@
 from buildbot.process.factory import BuildFactory, GNUAutoconf
 from buildbot.process.properties import WithProperties
 from buildbot.steps.source import SVN
-from buildbot.steps.shell import ShellCommand, Compile
+from buildbot.steps.shell import ShellCommand, Compile, Configure
 
-base_factory = GNUAutoconf(source=SVN(svnurl='https://svn.macports.org/repository/macports/trunk/base', mode="copy"),
-                             configureFlags=["--enable-readline"],
-                             compile=["make", "-j2"],
-                             test=["make", "test"])
+base_factory = BuildFactory()
+base_factory.addStep(SVN(baseURL='https://svn.macports.org/repository/macports/%%BRANCH%%/base',
+                      mode="copy", defaultBranch="trunk"))
+maybe_sudo="""
+if [[ `id -u` -eq 0 ]]; then
+    [[ -n "$SUDO_USER" ]] || SUDO_USER=buildbot
+    CMD_PREFIX="sudo -u $SUDO_USER"
+    INSTALL_USER=$SUDO_USER
+else
+    INSTALL_USER=$USER
+fi
+"""
+base_factory.addStep(Configure(command=WithProperties(maybe_sudo+"""
+$CMD_PREFIX env PATH=/usr/bin:/bin:/usr/sbin:/sbin ./configure --enable-readline \
+    --prefix=%(workdir)s/opt/local \
+    --with-applications-dir=%(workdir)s/opt/local/Applications \
+    --with-install-user=$INSTALL_USER --with-install-group=$INSTALL_USER
+""")))
+base_factory.addStep(Compile(command=maybe_sudo+"""
+$CMD_PREFIX make -j`sysctl -n hw.activecpu`
+"""))
+base_factory.addStep(ShellCommand(command=maybe_sudo+"""
+$CMD_PREFIX make install
+""", name="install", description="install"))
+base_factory.addStep(ShellCommand(command=maybe_sudo+"""
+$CMD_PREFIX make test
+""", name="test", description="test"))
+base_factory.addStep(ShellCommand(command=WithProperties("make distclean; rm -rf %(workdir)s/opt/local"), 
+                     name="clean", description="clean"))
 
 
 # custom class to make the file list available on the slave...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110922/23944122/attachment-0001.html>


More information about the macports-changes mailing list