← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad-buildd/rename-slave-classes into lp:launchpad-buildd

 

Colin Watson has proposed merging lp:~cjwatson/launchpad-buildd/rename-slave-classes into lp:launchpad-buildd with lp:~cjwatson/launchpad-buildd/rename-register-builder as a prerequisite.

Commit message:
Rename BuildDSlave to Builder and XMLRPCBuildDSlave to XMLRPCBuilder.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/rename-slave-classes/+merge/363046
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad-buildd/rename-slave-classes into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog	2019-02-11 12:22:42 +0000
+++ debian/changelog	2019-02-12 10:36:12 +0000
@@ -6,6 +6,7 @@
     for core16 and core18.
   * Move /usr/share/launchpad-buildd/slavebin to
     /usr/share/launchpad-buildd/bin.
+  * Rename BuildDSlave to Builder and XMLRPCBuildDSlave to XMLRPCBuilder.
 
  -- Colin Watson <cjwatson@xxxxxxxxxx>  Fri, 08 Feb 2019 15:09:35 +0000
 

=== modified file 'lpbuildd/binarypackage.py'
--- lpbuildd/binarypackage.py	2019-02-11 12:22:42 +0000
+++ lpbuildd/binarypackage.py	2019-02-12 10:36:12 +0000
@@ -92,8 +92,8 @@
 
     initial_build_state = BinaryPackageBuildState.SBUILD
 
-    def __init__(self, slave, buildid, **kwargs):
-        DebianBuildManager.__init__(self, slave, buildid, **kwargs)
+    def __init__(self, builder, buildid, **kwargs):
+        DebianBuildManager.__init__(self, builder, buildid, **kwargs)
         self._sbuildpath = os.path.join(self._bin, "sbuild-package")
 
     @property
@@ -334,9 +334,9 @@
                     unsat_deps.append(or_dep)
             return self.stripDependencies(unsat_deps)
         except Exception:
-            self._slave.log("Failed to analyse dep-wait:\n")
+            self._builder.log("Failed to analyse dep-wait:\n")
             for line in traceback.format_exc().splitlines(True):
-                self._slave.log(line)
+                self._builder.log(line)
             return None
 
     def iterate_SBUILD(self, success):
@@ -400,17 +400,17 @@
             if missing_dep is not None:
                 print("Returning build status: DEPFAIL")
                 print("Dependencies: " + missing_dep)
-                self._slave.depFail(missing_dep)
+                self._builder.depFail(missing_dep)
             elif success == SBuildExitCodes.GIVENBACK:
                 print("Returning build status: GIVENBACK")
-                self._slave.giveBack()
+                self._builder.giveBack()
             elif success == SBuildExitCodes.FAILED:
                 print("Returning build status: PACKAGEFAIL")
-                self._slave.buildFail()
+                self._builder.buildFail()
             elif success >= SBuildExitCodes.BUILDERFAIL:
                 # anything else is assumed to be a buildd failure
                 print("Returning build status: BUILDERFAIL")
-                self._slave.builderFail()
+                self._builder.builderFail()
             self.alreadyfailed = True
         self.doReapProcesses(self._state)
 

=== modified file 'lpbuildd/buildd-slave.tac'
--- lpbuildd/buildd-slave.tac	2019-02-12 10:36:11 +0000
+++ lpbuildd/buildd-slave.tac	2019-02-12 10:36:12 +0000
@@ -1,8 +1,7 @@
 # Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-# Buildd Slave implementation
-# XXX: dsilvers: 2005/01/21: Currently everything logged in the slave gets
+# XXX: dsilvers: 2005/01/21: Currently everything logged in the builder gets
 # passed through to the twistd log too. this could get dangerous/big
 
 try:
@@ -23,9 +22,9 @@
     )
 
 from lpbuildd.binarypackage import BinaryPackageBuildManager
+from lpbuildd.builder import XMLRPCBuilder
 from lpbuildd.livefs import LiveFilesystemBuildManager
 from lpbuildd.log import RotatableFileLogObserver
-from lpbuildd.slave import XMLRPCBuildDSlave
 from lpbuildd.snap import SnapBuildManager
 from lpbuildd.sourcepackagerecipe import SourcePackageRecipeBuildManager
 from lpbuildd.translationtemplates import TranslationTemplatesBuildManager
@@ -38,31 +37,31 @@
 
 conf = SafeConfigParser()
 conf.read(conffile)
-slave = XMLRPCBuildDSlave(conf)
+builder = XMLRPCBuilder(conf)
 
-slave.registerManager(BinaryPackageBuildManager, "binarypackage")
-slave.registerManager(SourcePackageRecipeBuildManager, "sourcepackagerecipe")
-slave.registerManager(
+builder.registerManager(BinaryPackageBuildManager, "binarypackage")
+builder.registerManager(SourcePackageRecipeBuildManager, "sourcepackagerecipe")
+builder.registerManager(
     TranslationTemplatesBuildManager, 'translation-templates')
-slave.registerManager(LiveFilesystemBuildManager, "livefs")
-slave.registerManager(SnapBuildManager, "snap")
+builder.registerManager(LiveFilesystemBuildManager, "livefs")
+builder.registerManager(SnapBuildManager, "snap")
 
-application = service.Application('BuildDSlave')
+application = service.Application('Builder')
 application.addComponent(
     RotatableFileLogObserver(options.get('logfile')), ignoreClass=1)
-builddslaveService = service.IServiceCollection(application)
-slave.slave.service = builddslaveService
+builderService = service.IServiceCollection(application)
+builder.builder.service = builderService
 
 root = resource.Resource()
-root.putChild('rpc', slave)
+root.putChild('rpc', builder)
 root.putChild('filecache', static.File(conf.get('slave', 'filecache')))
-slavesite = server.Site(root)
-
-strports.service("tcp:%s" % slave.slave._config.get("slave", "bindport"),
-                 slavesite).setServiceParent(builddslaveService)
-
-# You can interact with a running slave like this:
-# (assuming the slave is on localhost:8221)
+buildersite = server.Site(root)
+
+strports.service("tcp:%s" % builder.builder._config.get("slave", "bindport"),
+                 buildersite).setServiceParent(builderService)
+
+# You can interact with a running builder like this:
+# (assuming the builder is on localhost:8221)
 #
 # python3
 # from xmlrpc.client import ServerProxy

=== renamed file 'lpbuildd/slave.py' => 'lpbuildd/builder.py'
--- lpbuildd/slave.py	2019-02-12 10:36:11 +0000
+++ lpbuildd/builder.py	2019-02-12 10:36:12 +0000
@@ -75,10 +75,10 @@
 #
 # when we start using Twisted 2.0.
 class RunCapture(protocol.ProcessProtocol):
-    """Run a command and capture its output to a slave's log"""
+    """Run a command and capture its output to a builder's log."""
 
-    def __init__(self, slave, callback, stdin=None):
-        self.slave = slave
+    def __init__(self, builder, callback, stdin=None):
+        self.builder = builder
         self.notify = callback
         self.stdin = stdin
         self.builderFailCall = None
@@ -92,13 +92,13 @@
 
     def outReceived(self, data):
         """Pass on stdout data to the log."""
-        self.slave.log(data)
+        self.builder.log(data)
 
     def errReceived(self, data):
         """Pass on stderr data to the log.
 
         With a bit of luck we won't interleave horribly."""
-        self.slave.log(data)
+        self.builder.log(data)
 
     def processEnded(self, statusobject):
         """This method is called when a child process got terminated.
@@ -115,29 +115,29 @@
         if self.builderFailCall and self.builderFailCall.active():
             self.builderFailCall.cancel()
 
-        # notify the slave, it'll perform the required actions
+        # notify the builder, it'll perform the required actions
         if self.notify is not None:
             self.notify(statusobject.value.exitCode)
 
 
 class BuildManager(object):
-    """Build Daemon slave build manager abstract parent"""
+    """Build manager abstract parent."""
 
     backend_name = "chroot"
 
-    def __init__(self, slave, buildid, reactor=None):
+    def __init__(self, builder, buildid, reactor=None):
         """Create a BuildManager.
 
-        :param slave: A `BuildDSlave`.
+        :param builder: A `Builder`.
         :param buildid: Identifying string for this build.
         """
         object.__init__(self)
         self._buildid = buildid
-        self._slave = slave
+        self._builder = builder
         if reactor is None:
             reactor = default_reactor
         self._reactor = reactor
-        self._sharepath = slave._config.get("slave", "sharepath")
+        self._sharepath = builder._config.get("slave", "sharepath")
         self._bin = os.path.join(self._sharepath, "bin")
         self._preppath = os.path.join(self._bin, "builder-prep")
         self._intargetpath = os.path.join(self._bin, "in-target")
@@ -155,8 +155,8 @@
         """Run a subprocess capturing the results in the log."""
         if iterate is None:
             iterate = self.iterate
-        self._subprocess = RunCapture(self._slave, iterate, stdin=stdin)
-        self._slave.log("RUN: %s %s\n" % (
+        self._subprocess = RunCapture(self._builder, iterate, stdin=stdin)
+        self._builder.log("RUN: %s %s\n" % (
             command, " ".join(shell_escape(arg) for arg in args[1:])))
         childfds = {
             0: devnull.fileno() if stdin is None else "w",
@@ -191,7 +191,7 @@
         if state is not None and state in self._reaped_states:
             # We've already reaped this state.  To avoid a loop, proceed
             # immediately to the next iterator.
-            self._slave.log("Already reaped from state %s...\n" % state)
+            self._builder.log("Already reaped from state %s...\n" % state)
             if notify:
                 self.iterateReap(state, 0)
         else:
@@ -211,7 +211,7 @@
         # Sanitize the URLs in the buildlog file if this is a build
         # in a private archive.
         if self.needs_sanitized_logs:
-            self._slave.sanitizeBuildlog(self._slave.cachePath("buildlog"))
+            self._builder.sanitizeBuildlog(self._builder.cachePath("buildlog"))
 
         if self.fast_cleanup:
             self.iterate(0, quiet=True)
@@ -235,18 +235,18 @@
         evaluates to True the build at hand is for a private archive.
         """
         if 'build_url' in extra_args:
-            self._slave.log("%s\n" % extra_args['build_url'])
+            self._builder.log("%s\n" % extra_args['build_url'])
 
         os.mkdir("%s/build-%s" % (self.home, self._buildid))
         for f in files:
-            os.symlink( self._slave.cachePath(files[f]),
+            os.symlink( self._builder.cachePath(files[f]),
                         "%s/build-%s/%s" % (self.home,
                                             self._buildid, f))
-        self._chroottarfile = self._slave.cachePath(chroot)
+        self._chroottarfile = self._builder.cachePath(chroot)
 
         self.image_type = extra_args.get('image_type', 'chroot')
         self.series = extra_args['series']
-        self.arch_tag = extra_args.get('arch_tag', self._slave.getArch())
+        self.arch_tag = extra_args.get('arch_tag', self._builder.getArch())
         self.fast_cleanup = extra_args.get('fast_cleanup', False)
 
         # Check whether this is a build in a private archive and
@@ -271,7 +271,7 @@
         return {}
 
     def iterate(self, success, quiet=False):
-        """Perform an iteration of the slave.
+        """Perform an iteration of the builder.
 
         The BuildManager tends to work by invoking several
         subprocesses in order. the iterate method is called by the
@@ -282,7 +282,7 @@
                                   "used")
 
     def iterateReap(self, state, success):
-        """Perform an iteration of the slave following subprocess reaping.
+        """Perform an iteration of the builder following subprocess reaping.
 
         Subprocess reaping is special, typically occurring at several
         positions in a build manager's state machine.  We therefore keep
@@ -321,9 +321,9 @@
 
     def builderFail(self, reason, primary_subprocess):
         """Mark the builder as failed."""
-        self._slave.log("ABORTING: %s\n" % reason)
+        self._builder.log("ABORTING: %s\n" % reason)
         self._subprocess.builderFailCall = None
-        self._slave.builderFail()
+        self._builder.builderFail()
         self.alreadyfailed = True
         # If we failed to kill all processes in the chroot, then the primary
         # subprocess (i.e. the one running immediately before
@@ -332,7 +332,7 @@
         try:
             primary_subprocess.transport.signalProcess('KILL')
         except process.ProcessExitedAlready:
-            self._slave.log("ABORTING: Process Exited Already\n")
+            self._builder.log("ABORTING: Process Exited Already\n")
         primary_subprocess.transport.loseConnection()
         # Leave the reaper running, but disconnect it from our state
         # machine.  Perhaps an admin can make something of it, and in any
@@ -346,7 +346,7 @@
         try:
             fetched_path = os.path.join(fetched_dir, os.path.basename(path))
             self.backend.copy_out(path, fetched_path)
-            self._slave.addWaitingFile(fetched_path)
+            self._builder.addWaitingFile(fetched_path)
         finally:
             shutil.rmtree(fetched_dir)
 
@@ -375,10 +375,8 @@
     ABORTED = "BuildStatus.ABORTED"
 
 
-class BuildDSlave(object):
-    """Build Daemon slave. Implementation of most needed functions
-    for a Build-Slave device.
-    """
+class Builder(object):
+    """The core of a builder."""
 
     def __init__(self, config):
         object.__init__(self)
@@ -395,7 +393,7 @@
             raise ValueError("FileCache path is not a dir")
 
     def getArch(self):
-        """Return the Architecture tag for the slave."""
+        """Return the Architecture tag for the builder."""
         return self._config.get("slave","architecturetag")
 
     def cachePath(self, file):
@@ -423,7 +421,7 @@
         """Ensure we have the file with the checksum specified.
 
         Optionally you can provide the librarian URL and
-        the build slave will fetch the file if it doesn't have it.
+        the builder will fetch the file if it doesn't have it.
         Return a tuple containing: (<present>, <info>)
         """
         extra_info = 'No URL'
@@ -497,19 +495,19 @@
         if self.builderstatus == BuilderStatus.ABORTING:
             # This might happen if the master side restarts in the middle of
             # an abort cycle.
-            self.log("Slave already ABORTING when asked to abort")
+            self.log("Builder already ABORTING when asked to abort")
             return
         if self.builderstatus != BuilderStatus.BUILDING:
             # XXX: Should raise a known Fault so that the client can make
             # useful decisions about the error!
-            raise ValueError("Slave is not BUILDING when asked to abort")
+            raise ValueError("Builder is not BUILDING when asked to abort")
         self.manager.abort()
         self.builderstatus = BuilderStatus.ABORTING
 
     def clean(self):
         """Clean up pending files and reset the internal build state."""
         if self.builderstatus != BuilderStatus.WAITING:
-            raise ValueError('Slave is not WAITING when asked to clean')
+            raise ValueError('Builder is not WAITING when asked to clean')
         for f in set(self.waitingfiles.values()):
             os.remove(self.cachePath(f))
         self.builderstatus = BuilderStatus.IDLE
@@ -587,7 +585,8 @@
     def startBuild(self, manager):
         """Start a build with the provided BuildManager instance."""
         if self.builderstatus != BuilderStatus.IDLE:
-            raise ValueError("Slave is not IDLE when asked to start building")
+            raise ValueError(
+                "Builder is not IDLE when asked to start building")
         self.manager = manager
         self.builderstatus = BuilderStatus.BUILDING
         self.emptyLog()
@@ -602,8 +601,8 @@
         """Cease building because the builder has a problem."""
         if self.builderstatus not in (BuilderStatus.BUILDING,
                                       BuilderStatus.ABORTING):
-            raise ValueError("Slave is not BUILDING|ABORTING when set to "
-                             "BUILDERFAIL")
+            raise ValueError(
+                "Builder is not BUILDING|ABORTING when set to BUILDERFAIL")
         self.buildstatus = BuildStatus.BUILDERFAIL
 
     def chrootFail(self):
@@ -613,38 +612,38 @@
         package.
         """
         if self.builderstatus != BuilderStatus.BUILDING:
-            raise ValueError("Slave is not BUILDING when set to CHROOTFAIL")
+            raise ValueError("Builder is not BUILDING when set to CHROOTFAIL")
         self.buildstatus = BuildStatus.CHROOTFAIL
 
     def buildFail(self):
         """Cease building because the package failed to build."""
         if self.builderstatus != BuilderStatus.BUILDING:
-            raise ValueError("Slave is not BUILDING when set to PACKAGEFAIL")
+            raise ValueError("Builder is not BUILDING when set to PACKAGEFAIL")
         self.buildstatus = BuildStatus.PACKAGEFAIL
 
     def buildOK(self):
         """Having passed all possible failure states, mark a build as OK."""
         if self.builderstatus != BuilderStatus.BUILDING:
-            raise ValueError("Slave is not BUILDING when set to OK")
+            raise ValueError("Builder is not BUILDING when set to OK")
         self.buildstatus = BuildStatus.OK
 
     def depFail(self, dependencies):
         """Cease building due to a dependency issue."""
         if self.builderstatus != BuilderStatus.BUILDING:
-            raise ValueError("Slave is not BUILDING when set to DEPFAIL")
+            raise ValueError("Builder is not BUILDING when set to DEPFAIL")
         self.buildstatus = BuildStatus.DEPFAIL
         self.builddependencies = dependencies
 
     def giveBack(self):
         """Give-back package due to a transient buildd/archive issue."""
         if self.builderstatus != BuilderStatus.BUILDING:
-            raise ValueError("Slave is not BUILDING when set to GIVENBACK")
+            raise ValueError("Builder is not BUILDING when set to GIVENBACK")
         self.buildstatus = BuildStatus.GIVENBACK
 
     def buildAborted(self):
         """Mark a build as aborted."""
         if self.builderstatus != BuilderStatus.ABORTING:
-            raise ValueError("Slave is not ABORTING when set to ABORTED")
+            raise ValueError("Builder is not ABORTING when set to ABORTED")
         if self.buildstatus != BuildStatus.BUILDERFAIL:
             self.buildstatus = BuildStatus.ABORTED
 
@@ -658,8 +657,8 @@
             self.buildAborted()
             self.builderstatus = BuilderStatus.WAITING
         else:
-            raise ValueError("Slave is not BUILDING|ABORTING when told build "
-                             "is complete")
+            raise ValueError(
+                "Builder is not BUILDING|ABORTING when told build is complete")
 
     def sanitizeBuildlog(self, log_path):
         """Removes passwords from buildlog URLs.
@@ -699,8 +698,8 @@
                 sanitized_file.close()
 
 
-class XMLRPCBuildDSlave(xmlrpc.XMLRPC):
-    """XMLRPC build daemon slave management interface"""
+class XMLRPCBuilder(xmlrpc.XMLRPC):
+    """XMLRPC builder management interface."""
 
     def __init__(self, config):
         xmlrpc.XMLRPC.__init__(self, allowNone=True)
@@ -709,7 +708,7 @@
         # implying the presence of /filecache/ /filecache/buildlog and
         # the reduced and optimised XMLRPC interface.
         self.protocolversion = '1.0'
-        self.slave = BuildDSlave(config)
+        self.builder = Builder(config)
         self._managers = {}
         cache = apt.Cache()
         try:
@@ -728,7 +727,7 @@
 
     def xmlrpc_info(self):
         """Return the protocol version and the manager methods supported."""
-        return (self.protocolversion, self.slave.getArch(),
+        return (self.protocolversion, self.builder.getArch(),
                 list(self._managers))
 
     def xmlrpc_status(self):
@@ -737,7 +736,7 @@
         Depending on the builder status we return differing amounts of data,
         but this always includes the builder status itself.
         """
-        status = self.slave.builderstatus
+        status = self.builder.builderstatus
         statusname = status.split('.')[-1]
         func = getattr(self, "status_" + statusname, None)
         if func is None:
@@ -746,8 +745,8 @@
         if self._version is not None:
             ret["builder_version"] = self._version
         ret.update(func())
-        if self.slave.manager is not None:
-            ret.update(self.slave.manager.status())
+        if self.builder.manager is not None:
+            ret.update(self.builder.manager.status())
         return ret
 
     def status_IDLE(self):
@@ -759,7 +758,7 @@
 
         Returns the build id and up to one kilobyte of log tail.
         """
-        tail = self.slave.getLogTail()
+        tail = self.builder.getLogTail()
         return {"build_id": self.buildid, "logtail": Binary(tail)}
 
     def status_WAITING(self):
@@ -770,13 +769,13 @@
         and the build id but no file set.
         """
         ret = {
-            "build_status": self.slave.buildstatus,
+            "build_status": self.builder.buildstatus,
             "build_id": self.buildid,
             }
-        if self.slave.buildstatus in (BuildStatus.OK, BuildStatus.PACKAGEFAIL,
-                                      BuildStatus.DEPFAIL):
-            ret["filemap"] = self.slave.waitingfiles
-            ret["dependencies"] = self.slave.builddependencies
+        if self.builder.buildstatus in (
+                BuildStatus.OK, BuildStatus.PACKAGEFAIL, BuildStatus.DEPFAIL):
+            ret["filemap"] = self.builder.waitingfiles
+            ret["dependencies"] = self.builder.builddependencies
         return ret
 
     def status_ABORTING(self):
@@ -790,16 +789,16 @@
 
     def xmlrpc_ensurepresent(self, sha1sum, url, username, password):
         """Attempt to ensure the given file is present."""
-        return self.slave.ensurePresent(sha1sum, url, username, password)
+        return self.builder.ensurePresent(sha1sum, url, username, password)
 
     def xmlrpc_abort(self):
         """Abort the current build."""
-        self.slave.abort()
+        self.builder.abort()
         return BuilderStatus.ABORTING
 
     def xmlrpc_clean(self):
-        """Clean up the waiting files and reset the slave's internal state."""
-        self.slave.clean()
+        """Clean up the waiting files and reset the builder's state."""
+        self.builder.clean()
         return BuilderStatus.IDLE
 
     def xmlrpc_build(self, buildid, managertag, chrootsum, filemap, args):
@@ -813,7 +812,7 @@
             extra_info = "%s not in %r" % (managertag, list(self._managers))
             return (BuilderStatus.UNKNOWNBUILDER, extra_info)
         # check requested chroot availability
-        chroot_present, info = self.slave.ensurePresent(chrootsum)
+        chroot_present, info = self.builder.ensurePresent(chrootsum)
         if not chroot_present:
             extra_info = """CHROOTSUM -> %s
             ***** INFO *****
@@ -823,7 +822,7 @@
             return (BuilderStatus.UNKNOWNSUM, extra_info)
         # check requested files availability
         for filesum in filemap.values():
-            file_present, info = self.slave.ensurePresent(filesum)
+            file_present, info = self.builder.ensurePresent(filesum)
             if not file_present:
                 extra_info = """FILESUM -> %s
                 ***** INFO *****
@@ -838,6 +837,7 @@
         # builder is available, buildd is non empty,
         # filelist is consistent, chrootsum is available, let's initiate...
         self.buildid = buildid
-        self.slave.startBuild(self._managers[managertag](self.slave, buildid))
-        self.slave.manager.initiate(filemap, chrootsum, args)
+        self.builder.startBuild(
+            self._managers[managertag](self.builder, buildid))
+        self.builder.manager.initiate(filemap, chrootsum, args)
         return (BuilderStatus.BUILDING, buildid)

=== modified file 'lpbuildd/debian.py'
--- lpbuildd/debian.py	2018-10-19 06:41:14 +0000
+++ lpbuildd/debian.py	2019-02-12 10:36:12 +0000
@@ -4,8 +4,6 @@
 # Authors: Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>
 #      and Adam Conrad <adam.conrad@xxxxxxxxxxxxx>
 
-# Buildd Slave sbuild manager implementation
-
 __metaclass__ = type
 
 import base64
@@ -19,9 +17,7 @@
     )
 from twisted.python import log
 
-from lpbuildd.slave import (
-    BuildManager,
-    )
+from lpbuildd.builder import BuildManager
 
 
 class DebianBuildState:
@@ -39,11 +35,11 @@
 class DebianBuildManager(BuildManager):
     """Base behaviour for Debian chrooted builds."""
 
-    def __init__(self, slave, buildid, **kwargs):
-        BuildManager.__init__(self, slave, buildid, **kwargs)
-        self._cachepath = slave._config.get("slave", "filecache")
+    def __init__(self, builder, buildid, **kwargs):
+        BuildManager.__init__(self, builder, buildid, **kwargs)
+        self._cachepath = builder._config.get("slave", "filecache")
         self._state = DebianBuildState.INIT
-        slave.emptyLog()
+        builder.emptyLog()
         self.alreadyfailed = False
         self._iterator = None
 
@@ -110,12 +106,12 @@
         The primary file we care about is the .changes file. We key from there.
         """
         path = self.getChangesFilename()
-        self._slave.addWaitingFile(path)
+        self._builder.addWaitingFile(path)
 
         chfile = open(path, "r")
         try:
             for fn in self._parseChangesFile(chfile):
-                self._slave.addWaitingFile(
+                self._builder.addWaitingFile(
                     get_build_path(self.home, self._buildid, fn))
         finally:
             chfile.close()
@@ -127,11 +123,12 @@
         def failed_to_gather(failure):
             if failure.check(defer.CancelledError):
                 if not self.alreadyfailed:
-                    self._slave.log("Build cancelled unexpectedly!")
-                    self._slave.buildFail()
+                    self._builder.log("Build cancelled unexpectedly!")
+                    self._builder.buildFail()
             else:
-                self._slave.log("Failed to gather results: %s" % failure.value)
-                self._slave.buildFail()
+                self._builder.log(
+                    "Failed to gather results: %s" % failure.value)
+                self._builder.buildFail()
             self.alreadyfailed = True
 
         def reap(ignored):
@@ -173,7 +170,7 @@
         if success != 0:
             if not self.alreadyfailed:
                 # The init failed, can't fathom why that would be...
-                self._slave.builderFail()
+                self._builder.builderFail()
                 self.alreadyfailed = True
             self._state = DebianBuildState.CLEANUP
             self.doCleanup()
@@ -186,7 +183,7 @@
         if success != 0:
             if not self.alreadyfailed:
                 # The unpack failed for some reason...
-                self._slave.chrootFail()
+                self._builder.chrootFail()
                 self.alreadyfailed = True
             self._state = DebianBuildState.CLEANUP
             self.doCleanup()
@@ -198,7 +195,7 @@
         """Just finished doing the mounts."""
         if success != 0:
             if not self.alreadyfailed:
-                self._slave.chrootFail()
+                self._builder.chrootFail()
                 self.alreadyfailed = True
             self._state = DebianBuildState.UMOUNT
             self.doUnmounting()
@@ -258,7 +255,7 @@
         """Just finished overwriting sources.list."""
         if success != 0:
             if not self.alreadyfailed:
-                self._slave.chrootFail()
+                self._builder.chrootFail()
                 self.alreadyfailed = True
             self.doReapProcesses(self._state)
         elif self.trusted_keys:
@@ -277,7 +274,7 @@
         """Just finished adding trusted keys."""
         if success != 0:
             if not self.alreadyfailed:
-                self._slave.chrootFail()
+                self._builder.chrootFail()
                 self.alreadyfailed = True
             self.doReapProcesses(self._state)
         else:
@@ -293,7 +290,7 @@
         """Just finished updating the chroot."""
         if success != 0:
             if not self.alreadyfailed:
-                self._slave.chrootFail()
+                self._builder.chrootFail()
                 self.alreadyfailed = True
             self.doReapProcesses(self._state)
         else:
@@ -309,7 +306,7 @@
         """Just finished doing the unmounting."""
         if success != 0:
             if not self.alreadyfailed:
-                self._slave.builderFail()
+                self._builder.builderFail()
                 self.alreadyfailed = True
         self._state = DebianBuildState.CLEANUP
         self.doCleanup()
@@ -318,13 +315,13 @@
         """Just finished the cleanup."""
         if success != 0:
             if not self.alreadyfailed:
-                self._slave.builderFail()
+                self._builder.builderFail()
                 self.alreadyfailed = True
         else:
             # Successful clean
             if not self.alreadyfailed:
-                self._slave.buildOK()
-        self._slave.buildComplete()
+                self._builder.buildOK()
+        self._builder.buildComplete()
 
     def abortReap(self):
         """Abort by killing all processes in the chroot, as hard as we can.

=== modified file 'lpbuildd/livefs.py'
--- lpbuildd/livefs.py	2019-01-28 13:07:53 +0000
+++ lpbuildd/livefs.py	2019-02-12 10:36:12 +0000
@@ -83,12 +83,12 @@
         elif (retcode >= RETCODE_FAILURE_INSTALL and
               retcode <= RETCODE_FAILURE_BUILD):
             if not self.alreadyfailed:
-                self._slave.buildFail()
+                self._builder.buildFail()
                 print("Returning build status: Build failed.")
             self.alreadyfailed = True
         else:
             if not self.alreadyfailed:
-                self._slave.builderFail()
+                self._builder.builderFail()
                 print("Returning build status: Builder failed.")
             self.alreadyfailed = True
         self.doReapProcesses(self._state)

=== modified file 'lpbuildd/snap.py'
--- lpbuildd/snap.py	2019-02-07 11:52:09 +0000
+++ lpbuildd/snap.py	2019-02-12 10:36:12 +0000
@@ -237,7 +237,7 @@
                 'referrer': referrer,
                 'agent': agent,
                 })
-        self.manager._slave.log(line.encode("UTF-8"))
+        self.manager._builder.log(line.encode("UTF-8"))
 
 
 class SnapBuildState(DebianBuildState):
@@ -274,10 +274,10 @@
         """Start the local snap proxy, if necessary."""
         if not self.proxy_url:
             return []
-        proxy_port = self._slave._config.get("snapmanager", "proxyport")
+        proxy_port = self._builder._config.get("snapmanager", "proxyport")
         proxy_factory = SnapProxyFactory(self, self.proxy_url, timeout=60)
         self.proxy_service = strports.service(proxy_port, proxy_factory)
-        self.proxy_service.setServiceParent(self._slave.service)
+        self.proxy_service.setServiceParent(self._builder.service)
         if self.backend_name == "lxd":
             proxy_host = self.backend.ipv4_network.ip
         else:
@@ -295,7 +295,7 @@
         """Revoke builder proxy token."""
         if not self.revocation_endpoint:
             return
-        self._slave.log("Revoking proxy token...\n")
+        self._builder.log("Revoking proxy token...\n")
         url = urlparse(self.proxy_url)
         auth = "{}:{}".format(url.username, url.password)
         headers = {
@@ -306,7 +306,7 @@
         try:
             urlopen(req)
         except (HTTPError, URLError) as e:
-            self._slave.log(
+            self._builder.log(
                 "Unable to revoke token for %s: %s" % (url.username, e))
 
     def status(self):
@@ -362,12 +362,12 @@
         elif (retcode >= RETCODE_FAILURE_INSTALL and
               retcode <= RETCODE_FAILURE_BUILD):
             if not self.alreadyfailed:
-                self._slave.buildFail()
+                self._builder.buildFail()
                 print("Returning build status: Build failed.")
             self.alreadyfailed = True
         else:
             if not self.alreadyfailed:
-                self._slave.builderFail()
+                self._builder.builderFail()
                 print("Returning build status: Builder failed.")
             self.alreadyfailed = True
         self.doReapProcesses(self._state)

=== modified file 'lpbuildd/sourcepackagerecipe.py'
--- lpbuildd/sourcepackagerecipe.py	2019-02-11 12:22:42 +0000
+++ lpbuildd/sourcepackagerecipe.py	2019-02-12 10:36:12 +0000
@@ -55,13 +55,13 @@
 
     initial_build_state = SourcePackageRecipeBuildState.BUILD_RECIPE
 
-    def __init__(self, slave, buildid):
+    def __init__(self, builder, buildid):
         """Constructor.
 
-        :param slave: A build slave device.
+        :param builder: A builder.
         :param buildid: The id of the build (a str).
         """
-        DebianBuildManager.__init__(self, slave, buildid)
+        DebianBuildManager.__init__(self, builder, buildid)
         self.build_recipe_path = os.path.join(self._bin, "buildrecipe")
 
     def initiate(self, files, chroot, extra_args):
@@ -109,24 +109,24 @@
                     '.*: Depends: ([^ ]*( \([^)]*\))?)')
                 _, mo = self.searchLogContents([[rx, re.M]])
                 if mo:
-                    self._slave.depFail(mo.group(1))
+                    self._builder.depFail(mo.group(1))
                     print("Returning build status: DEPFAIL")
                     print("Dependencies: " + mo.group(1))
                 else:
                     print("Returning build status: Build failed")
-                    self._slave.buildFail()
+                    self._builder.buildFail()
             self.alreadyfailed = True
         elif (
             retcode >= RETCODE_FAILURE_INSTALL and
             retcode <= RETCODE_FAILURE_BUILD_SOURCE_PACKAGE):
             # XXX AaronBentley 2009-01-13: We should handle depwait separately
             if not self.alreadyfailed:
-                self._slave.buildFail()
+                self._builder.buildFail()
                 print("Returning build status: Build failed.")
             self.alreadyfailed = True
         else:
             if not self.alreadyfailed:
-                self._slave.builderFail()
+                self._builder.builderFail()
                 print("Returning build status: Builder failed.")
             self.alreadyfailed = True
         self.doReapProcesses(self._state)
@@ -150,5 +150,5 @@
         The manifest is also a useful record.
         """
         DebianBuildManager.gatherResults(self)
-        self._slave.addWaitingFile(get_build_path(
+        self._builder.addWaitingFile(get_build_path(
             self.home, self._buildid, 'manifest'))

=== modified file 'lpbuildd/tests/harness.py'
--- lpbuildd/tests/harness.py	2017-11-22 15:25:33 +0000
+++ lpbuildd/tests/harness.py	2019-02-12 10:36:12 +0000
@@ -18,7 +18,7 @@
 from fixtures import EnvironmentVariable
 from txfixtures.tachandler import TacTestFixture
 
-from lpbuildd.slave import BuildDSlave
+from lpbuildd.builder import Builder
 
 
 test_conffile = os.path.join(
@@ -41,12 +41,12 @@
     """Unit tests for logtail mechanisms."""
 
     def setUp(self):
-        """Setup a BuildDSlave using the test config."""
+        """Setup a Builder using the test config."""
         conf = SafeConfigParser()
         conf.read(test_conffile)
         conf.set("slave", "filecache", tempfile.mkdtemp())
 
-        self.slave = BuildDSlave(conf)
+        self.slave = Builder(conf)
         self.slave._log = True
         self.slave.manager = MockBuildManager()
 

=== modified file 'lpbuildd/translationtemplates.py'
--- lpbuildd/translationtemplates.py	2018-10-19 06:41:14 +0000
+++ lpbuildd/translationtemplates.py	2019-02-12 10:36:12 +0000
@@ -24,14 +24,15 @@
 
     This is the implementation of `TranslationTemplatesBuildJob`.  The
     latter runs on the master server; TranslationTemplatesBuildManager
-    runs on the build slave.
+    runs on the builder.
     """
 
     initial_build_state = TranslationTemplatesBuildState.GENERATE
 
-    def __init__(self, slave, buildid):
-        super(TranslationTemplatesBuildManager, self).__init__(slave, buildid)
-        self._resultname = slave._config.get(
+    def __init__(self, builder, buildid):
+        super(TranslationTemplatesBuildManager, self).__init__(
+            builder, buildid)
+        self._resultname = builder._config.get(
             "translationtemplatesmanager", "resultarchive")
 
     def initiate(self, files, chroot, extra_args):
@@ -67,11 +68,11 @@
         else:
             if not self.alreadyfailed:
                 if retcode == RETCODE_FAILURE_INSTALL:
-                    self._slave.chrootFail()
+                    self._builder.chrootFail()
                 elif retcode == RETCODE_FAILURE_BUILD:
-                    self._slave.buildFail()
+                    self._builder.buildFail()
                 else:
-                    self._slave.builderFail()
+                    self._builder.builderFail()
                 self.alreadyfailed = True
         self.doReapProcesses(self._state)