← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging lp:~cjwatson/launchpad-buildd/rename-slave-config-section into lp:launchpad-buildd.

Commit message:
Rename [slave] configuration section to [builder].

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/rename-slave-config-section/+merge/373354
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad-buildd/rename-slave-config-section into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog	2019-08-23 09:58:21 +0000
+++ debian/changelog	2019-09-27 22:28:16 +0000
@@ -1,3 +1,9 @@
+launchpad-buildd (178) UNRELEASED; urgency=medium
+
+  * Rename [slave] configuration section to [builder].
+
+ -- Colin Watson <cjwatson@xxxxxxxxxx>  Fri, 27 Sep 2019 23:26:30 +0100
+
 launchpad-buildd (177) xenial; urgency=medium
 
   * Fix recipe building to not rely on /CurrentlyBuilding existing in base

=== modified file 'debian/upgrade-config'
--- debian/upgrade-config	2018-06-07 16:23:43 +0000
+++ debian/upgrade-config	2019-09-27 22:28:16 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 #
-# Copyright 2009, 2010, 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2019 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Upgrade a launchpad-buildd configuration file."""
@@ -208,6 +208,17 @@
                 "\n[snapmanager]\n"
                 "proxyport = 8222\n")
 
+def upgrade_to_178():
+    print("Upgrading %s to version 178" % conf_file)
+    os.rename(conf_file, conf_file + "-prev178~")
+
+    with open(conf_file + "-prev178~", "r") as in_file:
+        with open(conf_file, "w") as out_file:
+            for line in in_file:
+                if line.strip() == "[slave]":
+                    line = "[builder]\n"
+                out_file.write(line)
+
 if __name__ == "__main__":
     old_version = re.sub(r'[~-].*', '', old_version)
     if apt_pkg.version_compare(old_version, "12") < 0:
@@ -236,3 +247,5 @@
         upgrade_to_127()
     if apt_pkg.version_compare(old_version, "162") < 0:
         upgrade_to_162()
+    if apt_pkg.version_compare(old_version, "178") < 0:
+        upgrade_to_178()

=== modified file 'lpbuildd/buildd-slave.tac'
--- lpbuildd/buildd-slave.tac	2019-02-12 10:35:12 +0000
+++ lpbuildd/buildd-slave.tac	2019-09-27 22:28:16 +0000
@@ -54,10 +54,10 @@
 
 root = resource.Resource()
 root.putChild('rpc', builder)
-root.putChild('filecache', static.File(conf.get('slave', 'filecache')))
+root.putChild('filecache', static.File(conf.get('builder', 'filecache')))
 buildersite = server.Site(root)
 
-strports.service("tcp:%s" % builder.builder._config.get("slave", "bindport"),
+strports.service("tcp:%s" % builder.builder._config.get("builder", "bindport"),
                  buildersite).setServiceParent(builderService)
 
 # You can interact with a running builder like this:

=== modified file 'lpbuildd/builder.py'
--- lpbuildd/builder.py	2019-09-27 22:14:50 +0000
+++ lpbuildd/builder.py	2019-09-27 22:28:16 +0000
@@ -137,7 +137,7 @@
         if reactor is None:
             reactor = default_reactor
         self._reactor = reactor
-        self._sharepath = builder._config.get("slave", "sharepath")
+        self._sharepath = builder._config.get("builder", "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")
@@ -382,7 +382,7 @@
         object.__init__(self)
         self._config = config
         self.builderstatus = BuilderStatus.IDLE
-        self._cachepath = self._config.get("slave","filecache")
+        self._cachepath = self._config.get("builder", "filecache")
         self.buildstatus = BuildStatus.OK
         self.waitingfiles = {}
         self.builddependencies = ""
@@ -394,7 +394,7 @@
 
     def getArch(self):
         """Return the Architecture tag for the builder."""
-        return self._config.get("slave","architecturetag")
+        return self._config.get("builder", "architecturetag")
 
     def cachePath(self, file):
         """Return the path in the cache of the file specified."""

=== modified file 'lpbuildd/debian.py'
--- lpbuildd/debian.py	2019-06-10 11:09:51 +0000
+++ lpbuildd/debian.py	2019-09-27 22:28:16 +0000
@@ -41,7 +41,7 @@
 
     def __init__(self, builder, buildid, **kwargs):
         BuildManager.__init__(self, builder, buildid, **kwargs)
-        self._cachepath = builder._config.get("slave", "filecache")
+        self._cachepath = builder._config.get("builder", "filecache")
         self._state = DebianBuildState.INIT
         builder.emptyLog()
         self.alreadyfailed = False

=== modified file 'lpbuildd/tests/buildd-slave-test.conf'
--- lpbuildd/tests/buildd-slave-test.conf	2019-09-27 22:14:50 +0000
+++ lpbuildd/tests/buildd-slave-test.conf	2019-09-27 22:28:16 +0000
@@ -1,6 +1,6 @@
 # Test buildd configuration
 
-[slave]
+[builder]
 architecturetag = i386
 filecache = /var/tmp/buildd/filecache
 bindhost = localhost

=== modified file 'lpbuildd/tests/harness.py'
--- lpbuildd/tests/harness.py	2019-09-27 22:14:50 +0000
+++ lpbuildd/tests/harness.py	2019-09-27 22:28:16 +0000
@@ -44,7 +44,7 @@
         """Setup a Builder using the test config."""
         conf = SafeConfigParser()
         conf.read(test_conffile)
-        conf.set("slave", "filecache", tempfile.mkdtemp())
+        conf.set("builder", "filecache", tempfile.mkdtemp())
 
         self.slave = Builder(conf)
         self.slave._log = True

=== modified file 'template-buildd-slave.conf'
--- template-buildd-slave.conf	2019-09-27 22:14:50 +0000
+++ template-buildd-slave.conf	2019-09-27 22:28:16 +0000
@@ -2,7 +2,7 @@
 #
 # Configuration for buildd: @NAME@
 
-[slave]
+[builder]
 architecturetag = @ARCHTAG@
 filecache = /home/buildd/filecache-@NAME@
 bindhost = @BINDHOST@


Follow ups