launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24647
[Merge] ~cjwatson/launchpad-buildd:rename-slave-config-section into launchpad-buildd:master
Colin Watson has proposed merging ~cjwatson/launchpad-buildd:rename-slave-config-section into launchpad-buildd:master.
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/+git/launchpad-buildd/+merge/383064
This is essentially the same as https://code.launchpad.net/~cjwatson/launchpad-buildd/rename-slave-config-section/+merge/373354, converted to git and rebased on master.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-buildd:rename-slave-config-section into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog
index e549316..7c3cd4f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
launchpad-buildd (190) UNRELEASED; urgency=medium
* Switch to git; add Vcs-* fields.
+ * Rename [slave] configuration section to [builder].
-- Colin Watson <cjwatson@xxxxxxxxxx> Tue, 28 Apr 2020 10:19:27 +0100
diff --git a/debian/upgrade-config b/debian/upgrade-config
index 0a25b51..6f1ac77 100755
--- a/debian/upgrade-config
+++ b/debian/upgrade-config
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright 2009, 2010, 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2020 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 @@ def upgrade_to_162():
"\n[snapmanager]\n"
"proxyport = 8222\n")
+def upgrade_to_190():
+ print("Upgrading %s to version 190" % conf_file)
+ os.rename(conf_file, conf_file + "-prev190~")
+
+ with open(conf_file + "-prev190~", "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 @@ if __name__ == "__main__":
upgrade_to_127()
if apt_pkg.version_compare(old_version, "162") < 0:
upgrade_to_162()
+ if apt_pkg.version_compare(old_version, "190") < 0:
+ upgrade_to_190()
diff --git a/lpbuildd/buildd-slave.tac b/lpbuildd/buildd-slave.tac
index 107f6df..73ed3ef 100644
--- a/lpbuildd/buildd-slave.tac
+++ b/lpbuildd/buildd-slave.tac
@@ -56,10 +56,10 @@ builder.builder.service = builderService
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:
diff --git a/lpbuildd/builder.py b/lpbuildd/builder.py
index 2e2d392..72f906f 100644
--- a/lpbuildd/builder.py
+++ b/lpbuildd/builder.py
@@ -126,7 +126,7 @@ class BuildManager(object):
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")
@@ -371,7 +371,7 @@ class Builder(object):
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 = ""
@@ -383,7 +383,7 @@ class Builder(object):
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."""
diff --git a/lpbuildd/debian.py b/lpbuildd/debian.py
index 7065c7d..911295d 100644
--- a/lpbuildd/debian.py
+++ b/lpbuildd/debian.py
@@ -41,7 +41,7 @@ class DebianBuildManager(BuildManager):
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
diff --git a/lpbuildd/tests/buildd-slave-test.conf b/lpbuildd/tests/buildd-slave-test.conf
index 6ef69dd..34fd47d 100644
--- a/lpbuildd/tests/buildd-slave-test.conf
+++ b/lpbuildd/tests/buildd-slave-test.conf
@@ -1,6 +1,6 @@
# Test buildd configuration
-[slave]
+[builder]
architecturetag = i386
filecache = /var/tmp/buildd/filecache
bindhost = localhost
diff --git a/lpbuildd/tests/harness.py b/lpbuildd/tests/harness.py
index f7712bf..9bc1a5d 100644
--- a/lpbuildd/tests/harness.py
+++ b/lpbuildd/tests/harness.py
@@ -44,7 +44,7 @@ class BuilddTestCase(unittest.TestCase):
"""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
diff --git a/template-buildd-slave.conf b/template-buildd-slave.conf
index 81e2022..b195c82 100644
--- a/template-buildd-slave.conf
+++ b/template-buildd-slave.conf
@@ -2,7 +2,7 @@
#
# Configuration for buildd: @NAME@
-[slave]
+[builder]
architecturetag = @ARCHTAG@
filecache = /home/buildd/filecache-@NAME@
bindhost = @BINDHOST@