launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31685
[Merge] ~ruinedyourlife/launchpad-buildd:source-to-craft into launchpad-buildd:master
Quentin Debhi has proposed merging ~ruinedyourlife/launchpad-buildd:source-to-craft into launchpad-buildd:master.
Commit message:
Change source naming to craft
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~ruinedyourlife/launchpad-buildd/+git/launchpad-buildd/+merge/474840
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~ruinedyourlife/launchpad-buildd:source-to-craft into launchpad-buildd:master.
diff --git a/lpbuildd/buildd.tac b/lpbuildd/buildd.tac
index cc60c16..3133c42 100644
--- a/lpbuildd/buildd.tac
+++ b/lpbuildd/buildd.tac
@@ -19,12 +19,12 @@ from lpbuildd.binarypackage import BinaryPackageBuildManager
from lpbuildd.builder import XMLRPCBuilder
from lpbuildd.charm import CharmBuildManager
from lpbuildd.ci import CIBuildManager
+from lpbuildd.craft import CraftBuildManager
from lpbuildd.livefs import LiveFilesystemBuildManager
from lpbuildd.log import RotatableFileLogObserver
from lpbuildd.oci import OCIBuildManager
from lpbuildd.rock import RockBuildManager
from lpbuildd.snap import SnapBuildManager
-from lpbuildd.source import SourceBuildManager
from lpbuildd.sourcepackagerecipe import SourcePackageRecipeBuildManager
from lpbuildd.translationtemplates import TranslationTemplatesBuildManager
@@ -48,7 +48,7 @@ builder.registerManager(OCIBuildManager, "oci")
builder.registerManager(CharmBuildManager, "charm")
builder.registerManager(CIBuildManager, "ci")
builder.registerManager(RockBuildManager, "rock")
-builder.registerManager(SourceBuildManager, "source")
+builder.registerManager(CraftBuildManager, "craft")
application = service.Application("Builder")
application.addComponent(
diff --git a/lpbuildd/source.py b/lpbuildd/craft.py
similarity index 84%
rename from lpbuildd/source.py
rename to lpbuildd/craft.py
index 1d7e890..cb4523a 100644
--- a/lpbuildd/source.py
+++ b/lpbuildd/craft.py
@@ -8,15 +8,15 @@ RETCODE_FAILURE_INSTALL = 200
RETCODE_FAILURE_BUILD = 201
-class SourceBuildState(DebianBuildState):
- BUILD_SOURCE = "BUILD_SOURCE"
+class CraftBuildState(DebianBuildState):
+ BUILD_CRAFT = "BUILD_CRAFT"
-class SourceBuildManager(BuildManagerProxyMixin, DebianBuildManager):
- """Build a source."""
+class CraftBuildManager(BuildManagerProxyMixin, DebianBuildManager):
+ """Build a craft."""
backend_name = "lxd"
- initial_build_state = SourceBuildState.BUILD_SOURCE
+ initial_build_state = CraftBuildState.BUILD_CRAFT
@property
def needs_sanitized_logs(self):
@@ -40,7 +40,7 @@ class SourceBuildManager(BuildManagerProxyMixin, DebianBuildManager):
super().initiate(files, chroot, extra_args)
def doRunBuild(self):
- """Run the process to build the source."""
+ """Run the process to build the craft."""
args = []
args.extend(self.startProxy())
if self.revocation_endpoint:
@@ -64,14 +64,14 @@ class SourceBuildManager(BuildManagerProxyMixin, DebianBuildManager):
]
)
args.append(self.name)
- self.runTargetSubProcess("build-source", *args)
+ self.runTargetSubProcess("build-craft", *args)
- def iterate_BUILD_SOURCE(self, retcode):
- """Finished building the source."""
+ def iterate_BUILD_CRAFT(self, retcode):
+ """Finished building the craft."""
self.stopProxy()
self.revokeProxyToken()
if retcode == RETCODE_SUCCESS:
- print("[source] Returning build status: OK")
+ print("[craft] Returning build status: OK")
return self.deferGatherResults()
elif (
retcode >= RETCODE_FAILURE_INSTALL
@@ -79,17 +79,17 @@ class SourceBuildManager(BuildManagerProxyMixin, DebianBuildManager):
):
if not self.alreadyfailed:
self._builder.buildFail()
- print("[source] Returning build status: Builder failed.")
+ print("[craft] Returning build status: Builder failed.")
self.alreadyfailed = True
else:
if not self.alreadyfailed:
self._builder.buildFail()
- print("[source] Returning build status: Build failed.")
+ print("[craft] Returning build status: Build failed.")
self.alreadyfailed = True
self.doReapProcesses(self._state)
- def iterateReap_BUILD_SOURCE(self, retcode):
- """Finished reaping after building the source."""
+ def iterateReap_BUILD_CRAFT(self, retcode):
+ """Finished reaping after building the craft."""
self._state = DebianBuildState.UMOUNT
self.doUnmounting()
diff --git a/lpbuildd/target/build_source.py b/lpbuildd/target/build_craft.py
similarity index 96%
rename from lpbuildd/target/build_source.py
rename to lpbuildd/target/build_craft.py
index 9f866f9..06d8576 100644
--- a/lpbuildd/target/build_source.py
+++ b/lpbuildd/target/build_craft.py
@@ -16,13 +16,13 @@ MITM_CERTIFICATE_PATH = "/usr/local/share/ca-certificates/local-ca.crt"
logger = logging.getLogger(__name__)
-class BuildSource(
+class BuildCraft(
BuilderProxyOperationMixin,
VCSOperationMixin,
SnapStoreOperationMixin,
Operation,
):
- description = "Build a source."
+ description = "Build a craft."
@classmethod
def add_arguments(cls, parser):
@@ -36,9 +36,9 @@ class BuildSource(
help="install SNAP from CHANNEL",
)
parser.add_argument(
- "--build-path", default=".", help="location of source to build."
+ "--build-path", default=".", help="location of craft to build."
)
- parser.add_argument("name", help="name of source to build")
+ parser.add_argument("name", help="name of craft to build")
parser.add_argument(
"--use_fetch_service",
default=False,
@@ -114,7 +114,7 @@ class BuildSource(
self.restart_snapd()
self.configure_git_protocol_v2()
# With classic confinement, the snap can access the whole system.
- # We could build the source in /build, but we are using /home/buildd
+ # We could build the craft in /build, but we are using /home/buildd
# for consistency with other build types.
self.backend.run(["mkdir", "-p", "/home/buildd"])
diff --git a/lpbuildd/target/cli.py b/lpbuildd/target/cli.py
index fe7bc7b..c0a19dd 100644
--- a/lpbuildd/target/cli.py
+++ b/lpbuildd/target/cli.py
@@ -7,11 +7,11 @@ from argparse import ArgumentParser
from lpbuildd.target.apt import AddTrustedKeys, OverrideSourcesList, Update
from lpbuildd.target.build_charm import BuildCharm
+from lpbuildd.target.build_craft import BuildCraft
from lpbuildd.target.build_livefs import BuildLiveFS
from lpbuildd.target.build_oci import BuildOCI
from lpbuildd.target.build_rock import BuildRock
from lpbuildd.target.build_snap import BuildSnap
-from lpbuildd.target.build_source import BuildSource
from lpbuildd.target.generate_translation_templates import (
GenerateTranslationTemplates,
)
@@ -48,8 +48,8 @@ operations = {
"add-trusted-keys": AddTrustedKeys,
"build-oci": BuildOCI,
"build-charm": BuildCharm,
+ "build-craft": BuildCraft,
"build-rock": BuildRock,
- "build-source": BuildSource,
"buildlivefs": BuildLiveFS,
"buildsnap": BuildSnap,
"generate-translation-templates": GenerateTranslationTemplates,
diff --git a/lpbuildd/target/tests/test_build_source.py b/lpbuildd/target/tests/test_build_craft.py
similarity index 66%
rename from lpbuildd/target/tests/test_build_source.py
rename to lpbuildd/target/tests/test_build_craft.py
index 1d31860..3d0edee 100644
--- a/lpbuildd/target/tests/test_build_source.py
+++ b/lpbuildd/target/tests/test_build_craft.py
@@ -11,7 +11,7 @@ from testtools.matchers import AnyMatch, MatchesAll, MatchesListwise, Not
from testtools.testcase import TestCase
from lpbuildd.target.backend import InvalidBuildFilePath
-from lpbuildd.target.build_source import (
+from lpbuildd.target.build_craft import (
RETCODE_FAILURE_BUILD,
RETCODE_FAILURE_INSTALL,
)
@@ -25,10 +25,10 @@ from lpbuildd.target.tests.test_build_snap import FakeRevisionID, RanSnap
from lpbuildd.tests.fakebuilder import FakeMethod
-class TestBuildSource(TestCase):
+class TestBuildCraft(TestCase):
def test_run_build_command_no_env(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -37,10 +37,10 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.run_build_command(["echo", "hello world"])
+ build_craft = parse_args(args=args).operation
+ build_craft.run_build_command(["echo", "hello world"])
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -52,7 +52,7 @@ class TestBuildSource(TestCase):
def test_run_build_command_env(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -61,12 +61,12 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.run_build_command(
+ build_craft = parse_args(args=args).operation
+ build_craft.run_build_command(
["echo", "hello world"], env={"FOO": "bar baz"}
)
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -80,7 +80,7 @@ class TestBuildSource(TestCase):
def test_install_channels(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -92,10 +92,10 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.install()
+ build_craft = parse_args(args=args).operation
+ build_craft.install()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanAptGet("install", "bzr"),
@@ -111,7 +111,7 @@ class TestBuildSource(TestCase):
def test_install_bzr(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -120,10 +120,10 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.install()
+ build_craft = parse_args(args=args).operation
+ build_craft.install()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanAptGet("install", "bzr"),
@@ -140,7 +140,7 @@ class TestBuildSource(TestCase):
def test_install_git(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -149,10 +149,10 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.install()
+ build_craft = parse_args(args=args).operation
+ build_craft.install()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanAptGet("install", "git"),
@@ -188,7 +188,7 @@ class TestBuildSource(TestCase):
callback=respond,
)
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -199,10 +199,10 @@ class TestBuildSource(TestCase):
"http://snap-store-proxy.example/",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.install()
+ build_craft = parse_args(args=args).operation
+ build_craft.install()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanAptGet("install", "git"),
@@ -226,7 +226,7 @@ class TestBuildSource(TestCase):
def test_install_proxy(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -237,16 +237,16 @@ class TestBuildSource(TestCase):
"http://proxy.example:3128/",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.bin = "/builderbin"
+ build_craft = parse_args(args=args).operation
+ build_craft.bin = "/builderbin"
self.useFixture(FakeFilesystem()).add("/builderbin")
os.mkdir("/builderbin")
with open("/builderbin/lpbuildd-git-proxy", "w") as proxy_script:
proxy_script.write("proxy script\n")
os.fchmod(proxy_script.fileno(), 0o755)
- build_source.install()
+ build_craft.install()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanAptGet(
@@ -267,14 +267,14 @@ class TestBuildSource(TestCase):
)
self.assertEqual(
(b"proxy script\n", stat.S_IFREG | 0o755),
- build_source.backend.backend_fs[
+ build_craft.backend.backend_fs[
"/usr/local/bin/lpbuildd-git-proxy"
],
)
def test_install_certificate(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -289,16 +289,16 @@ class TestBuildSource(TestCase):
# Base64 content_of_cert
"Y29udGVudF9vZl9jZXJ0",
]
- build_source = parse_args(args=args).operation
- build_source.bin = "/builderbin"
+ build_craft = parse_args(args=args).operation
+ build_craft.bin = "/builderbin"
self.useFixture(FakeFilesystem()).add("/builderbin")
os.mkdir("/builderbin")
with open("/builderbin/lpbuildd-git-proxy", "w") as proxy_script:
proxy_script.write("proxy script\n")
os.fchmod(proxy_script.fileno(), 0o755)
- build_source.install()
+ build_craft.install()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanAptGet(
@@ -345,7 +345,7 @@ class TestBuildSource(TestCase):
)
self.assertEqual(
(b"proxy script\n", stat.S_IFREG | 0o755),
- build_source.backend.backend_fs[
+ build_craft.backend.backend_fs[
"/usr/local/bin/lpbuildd-git-proxy"
],
)
@@ -354,7 +354,7 @@ class TestBuildSource(TestCase):
b"content_of_cert",
stat.S_IFREG | 0o644,
),
- build_source.backend.backend_fs[
+ build_craft.backend.backend_fs[
"/usr/local/share/ca-certificates/local-ca.crt"
],
)
@@ -369,12 +369,12 @@ class TestBuildSource(TestCase):
).encode("UTF-8"),
stat.S_IFREG | 0o644,
),
- build_source.backend.backend_fs["/etc/apt/apt.conf.d/99proxy"],
+ build_craft.backend.backend_fs["/etc/apt/apt.conf.d/99proxy"],
)
def test_install_snapd_proxy(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -389,16 +389,16 @@ class TestBuildSource(TestCase):
# Base64 content_of_cert
"Y29udGVudF9vZl9jZXJ0",
]
- build_source = parse_args(args=args).operation
- build_source.bin = "/builderbin"
+ build_craft = parse_args(args=args).operation
+ build_craft.bin = "/builderbin"
self.useFixture(FakeFilesystem()).add("/builderbin")
os.mkdir("/builderbin")
with open("/builderbin/lpbuildd-git-proxy", "w") as proxy_script:
proxy_script.write("proxy script\n")
os.fchmod(proxy_script.fileno(), 0o755)
- build_source.install()
+ build_craft.install()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanAptGet(
@@ -445,7 +445,7 @@ class TestBuildSource(TestCase):
)
self.assertEqual(
(b"proxy script\n", stat.S_IFREG | 0o755),
- build_source.backend.backend_fs[
+ build_craft.backend.backend_fs[
"/usr/local/bin/lpbuildd-git-proxy"
],
)
@@ -460,12 +460,12 @@ class TestBuildSource(TestCase):
).encode("UTF-8"),
stat.S_IFREG | 0o644,
),
- build_source.backend.backend_fs["/etc/apt/apt.conf.d/99proxy"],
+ build_craft.backend.backend_fs["/etc/apt/apt.conf.d/99proxy"],
)
def test_install_fetch_service(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -480,16 +480,16 @@ class TestBuildSource(TestCase):
# Base64 content_of_cert
"Y29udGVudF9vZl9jZXJ0",
]
- build_source = parse_args(args=args).operation
- build_source.bin = "/builderbin"
+ build_craft = parse_args(args=args).operation
+ build_craft.bin = "/builderbin"
self.useFixture(FakeFilesystem()).add("/builderbin")
os.mkdir("/builderbin")
with open("/builderbin/lpbuildd-git-proxy", "w") as proxy_script:
proxy_script.write("proxy script\n")
os.fchmod(proxy_script.fileno(), 0o755)
- build_source.install()
+ build_craft.install()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesAll(
Not(
AnyMatch(
@@ -509,7 +509,7 @@ class TestBuildSource(TestCase):
def test_install_fetch_service_focal(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=focal",
"--arch=amd64",
@@ -524,16 +524,16 @@ class TestBuildSource(TestCase):
# Base64 content_of_cert
"Y29udGVudF9vZl9jZXJ0",
]
- build_source = parse_args(args=args).operation
- build_source.bin = "/builderbin"
+ build_craft = parse_args(args=args).operation
+ build_craft.bin = "/builderbin"
self.useFixture(FakeFilesystem()).add("/builderbin")
os.mkdir("/builderbin")
with open("/builderbin/lpbuildd-git-proxy", "w") as proxy_script:
proxy_script.write("proxy script\n")
os.fchmod(proxy_script.fileno(), 0o755)
- build_source.install()
+ build_craft.install()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesAll(
AnyMatch(
RanCommand(
@@ -545,7 +545,7 @@ class TestBuildSource(TestCase):
def test_repo_bzr(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -554,12 +554,12 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.build_path = self.useFixture(TempDir()).path
- build_source.backend.run = FakeRevisionID("42")
- build_source.repo()
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.build_path = self.useFixture(TempDir()).path
+ build_craft.backend.run = FakeRevisionID("42")
+ build_craft.repo()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -575,13 +575,13 @@ class TestBuildSource(TestCase):
]
),
)
- status_path = os.path.join(build_source.backend.build_path, "status")
+ status_path = os.path.join(build_craft.backend.build_path, "status")
with open(status_path) as status:
self.assertEqual({"revision_id": "42"}, json.load(status))
def test_repo_git(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -590,12 +590,12 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.build_path = self.useFixture(TempDir()).path
- build_source.backend.run = FakeRevisionID("0" * 40)
- build_source.repo()
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.build_path = self.useFixture(TempDir()).path
+ build_craft.backend.run = FakeRevisionID("0" * 40)
+ build_craft.repo()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -625,13 +625,13 @@ class TestBuildSource(TestCase):
]
),
)
- status_path = os.path.join(build_source.backend.build_path, "status")
+ status_path = os.path.join(build_craft.backend.build_path, "status")
with open(status_path) as status:
self.assertEqual({"revision_id": "0" * 40}, json.load(status))
def test_repo_git_with_path(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -642,12 +642,12 @@ class TestBuildSource(TestCase):
"next",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.build_path = self.useFixture(TempDir()).path
- build_source.backend.run = FakeRevisionID("0" * 40)
- build_source.repo()
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.build_path = self.useFixture(TempDir()).path
+ build_craft.backend.run = FakeRevisionID("0" * 40)
+ build_craft.repo()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -677,13 +677,13 @@ class TestBuildSource(TestCase):
]
),
)
- status_path = os.path.join(build_source.backend.build_path, "status")
+ status_path = os.path.join(build_craft.backend.build_path, "status")
with open(status_path) as status:
self.assertEqual({"revision_id": "0" * 40}, json.load(status))
def test_repo_git_with_tag_path(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -694,12 +694,12 @@ class TestBuildSource(TestCase):
"refs/tags/1.0",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.build_path = self.useFixture(TempDir()).path
- build_source.backend.run = FakeRevisionID("0" * 40)
- build_source.repo()
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.build_path = self.useFixture(TempDir()).path
+ build_craft.backend.run = FakeRevisionID("0" * 40)
+ build_craft.repo()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -729,13 +729,13 @@ class TestBuildSource(TestCase):
]
),
)
- status_path = os.path.join(build_source.backend.build_path, "status")
+ status_path = os.path.join(build_craft.backend.build_path, "status")
with open(status_path) as status:
self.assertEqual({"revision_id": "0" * 40}, json.load(status))
def test_repo_proxy(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -746,10 +746,10 @@ class TestBuildSource(TestCase):
"http://proxy.example:3128/",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.build_path = self.useFixture(TempDir()).path
- build_source.backend.run = FakeRevisionID("0" * 40)
- build_source.repo()
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.build_path = self.useFixture(TempDir()).path
+ build_craft.backend.run = FakeRevisionID("0" * 40)
+ build_craft.repo()
env = {
"http_proxy": "http://proxy.example:3128/",
"https_proxy": "http://proxy.example:3128/",
@@ -757,7 +757,7 @@ class TestBuildSource(TestCase):
"SNAPPY_STORE_NO_CDN": "1",
}
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -790,13 +790,13 @@ class TestBuildSource(TestCase):
]
),
)
- status_path = os.path.join(build_source.backend.build_path, "status")
+ status_path = os.path.join(build_craft.backend.build_path, "status")
with open(status_path) as status:
self.assertEqual({"revision_id": "0" * 40}, json.load(status))
def test_repo_fetch_service(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -808,10 +808,10 @@ class TestBuildSource(TestCase):
"test-image",
"--use_fetch_service",
]
- build_source = parse_args(args=args).operation
- build_source.backend.build_path = self.useFixture(TempDir()).path
- build_source.backend.run = FakeRevisionID("0" * 40)
- build_source.repo()
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.build_path = self.useFixture(TempDir()).path
+ build_craft.backend.run = FakeRevisionID("0" * 40)
+ build_craft.repo()
env = {
"http_proxy": "http://proxy.example:3128/",
"https_proxy": "http://proxy.example:3128/",
@@ -819,7 +819,7 @@ class TestBuildSource(TestCase):
"SNAPPY_STORE_NO_CDN": "1",
}
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -863,13 +863,13 @@ class TestBuildSource(TestCase):
]
),
)
- status_path = os.path.join(build_source.backend.build_path, "status")
+ status_path = os.path.join(build_craft.backend.build_path, "status")
with open(status_path) as status:
self.assertEqual({"revision_id": "0" * 40}, json.load(status))
def test_build(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -878,11 +878,11 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.add_dir("/build/test-directory")
- build_source.build()
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.add_dir("/build/test-directory")
+ build_craft.build()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -895,7 +895,7 @@ class TestBuildSource(TestCase):
def test_build_with_path(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -906,11 +906,11 @@ class TestBuildSource(TestCase):
"build-aux/",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.add_dir("/build/test-directory")
- build_source.build()
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.add_dir("/build/test-directory")
+ build_craft.build()
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -923,7 +923,7 @@ class TestBuildSource(TestCase):
def test_build_proxy(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -934,8 +934,8 @@ class TestBuildSource(TestCase):
"http://proxy.example:3128/",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.build()
+ build_craft = parse_args(args=args).operation
+ build_craft.build()
env = {
"http_proxy": "http://proxy.example:3128/",
"https_proxy": "http://proxy.example:3128/",
@@ -943,7 +943,7 @@ class TestBuildSource(TestCase):
"SNAPPY_STORE_NO_CDN": "1",
}
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -957,7 +957,7 @@ class TestBuildSource(TestCase):
def test_build_fetch_service(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -972,8 +972,8 @@ class TestBuildSource(TestCase):
# Base64 content_of_cert
"Y29udGVudF9vZl9jZXJ0",
]
- build_source = parse_args(args=args).operation
- build_source.build()
+ build_craft = parse_args(args=args).operation
+ build_craft.build()
env = {
"http_proxy": "http://proxy.example:3128/",
"https_proxy": "http://proxy.example:3128/",
@@ -981,7 +981,7 @@ class TestBuildSource(TestCase):
"SNAPPY_STORE_NO_CDN": "1",
}
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesListwise(
[
RanBuildCommand(
@@ -995,7 +995,7 @@ class TestBuildSource(TestCase):
def test_run_succeeds(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -1004,12 +1004,12 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.build_path = self.useFixture(TempDir()).path
- build_source.backend.run = FakeRevisionID("42")
- self.assertEqual(0, build_source.run())
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.build_path = self.useFixture(TempDir()).path
+ build_craft.backend.run = FakeRevisionID("42")
+ self.assertEqual(0, build_craft.run())
self.assertThat(
- build_source.backend.run.calls,
+ build_craft.backend.run.calls,
MatchesAll(
AnyMatch(
RanAptGet("install", "bzr"),
@@ -1038,7 +1038,7 @@ class TestBuildSource(TestCase):
self.useFixture(FakeLogger())
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -1047,9 +1047,9 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.run = FailInstall()
- self.assertEqual(RETCODE_FAILURE_INSTALL, build_source.run())
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.run = FailInstall()
+ self.assertEqual(RETCODE_FAILURE_INSTALL, build_craft.run())
def test_run_repo_fails(self):
class FailRepo(FakeMethod):
@@ -1060,7 +1060,7 @@ class TestBuildSource(TestCase):
self.useFixture(FakeLogger())
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -1069,9 +1069,9 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.run = FailRepo()
- self.assertEqual(RETCODE_FAILURE_BUILD, build_source.run())
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.run = FailRepo()
+ self.assertEqual(RETCODE_FAILURE_BUILD, build_craft.run())
def test_run_build_fails(self):
class FailBuild(FakeMethod):
@@ -1082,7 +1082,7 @@ class TestBuildSource(TestCase):
self.useFixture(FakeLogger())
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -1091,14 +1091,14 @@ class TestBuildSource(TestCase):
"lp:foo",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.build_path = self.useFixture(TempDir()).path
- build_source.backend.run = FailBuild()
- self.assertEqual(RETCODE_FAILURE_BUILD, build_source.run())
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.build_path = self.useFixture(TempDir()).path
+ build_craft.backend.run = FailBuild()
+ self.assertEqual(RETCODE_FAILURE_BUILD, build_craft.run())
def test_build_with_invalid_build_path_parent(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -1109,13 +1109,13 @@ class TestBuildSource(TestCase):
"../",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.add_dir("/build/test-directory")
- self.assertRaises(InvalidBuildFilePath, build_source.build)
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.add_dir("/build/test-directory")
+ self.assertRaises(InvalidBuildFilePath, build_craft.build)
def test_build_with_invalid_build_path_absolute(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -1126,13 +1126,13 @@ class TestBuildSource(TestCase):
"/etc",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.backend.add_dir("/build/test-directory")
- self.assertRaises(InvalidBuildFilePath, build_source.build)
+ build_craft = parse_args(args=args).operation
+ build_craft.backend.add_dir("/build/test-directory")
+ self.assertRaises(InvalidBuildFilePath, build_craft.build)
def test_build_with_invalid_build_path_symlink(self):
args = [
- "build-source",
+ "build-craft",
"--backend=fake",
"--series=xenial",
"--arch=amd64",
@@ -1143,9 +1143,9 @@ class TestBuildSource(TestCase):
"build/",
"test-image",
]
- build_source = parse_args(args=args).operation
- build_source.buildd_path = self.useFixture(TempDir()).path
+ build_craft = parse_args(args=args).operation
+ build_craft.buildd_path = self.useFixture(TempDir()).path
os.symlink(
- "/etc/hosts", os.path.join(build_source.buildd_path, "build")
+ "/etc/hosts", os.path.join(build_craft.buildd_path, "build")
)
- self.assertRaises(InvalidBuildFilePath, build_source.build)
+ self.assertRaises(InvalidBuildFilePath, build_craft.build)
diff --git a/lpbuildd/tests/test_source.py b/lpbuildd/tests/test_craft.py
similarity index 85%
rename from lpbuildd/tests/test_source.py
rename to lpbuildd/tests/test_craft.py
index 8fa3c87..723641f 100644
--- a/lpbuildd/tests/test_source.py
+++ b/lpbuildd/tests/test_craft.py
@@ -5,12 +5,12 @@ from testtools import TestCase
from testtools.twistedsupport import AsynchronousDeferredRunTest
from twisted.internet import defer
-from lpbuildd.source import SourceBuildManager, SourceBuildState
+from lpbuildd.craft import CraftBuildManager, CraftBuildState
from lpbuildd.tests.fakebuilder import FakeBuilder
from lpbuildd.tests.matchers import HasWaitingFiles
-class MockBuildManager(SourceBuildManager):
+class MockBuildManager(CraftBuildManager):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.commands = []
@@ -24,8 +24,8 @@ class MockBuildManager(SourceBuildManager):
return 0
-class TestSourceBuildManagerIteration(TestCase):
- """Run SourceBuildManager through its iteration steps."""
+class TestCraftBuildManagerIteration(TestCase):
+ """Run CraftBuildManager through its iteration steps."""
run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=5)
@@ -53,7 +53,7 @@ class TestSourceBuildManagerIteration(TestCase):
extra_args = {
"series": "xenial",
"arch_tag": "i386",
- "name": "test-source",
+ "name": "test-craft",
}
if args is not None:
extra_args.update(args)
@@ -63,16 +63,16 @@ class TestSourceBuildManagerIteration(TestCase):
self.buildmanager.backend_name = original_backend_name
# Skip states that are done in DebianBuildManager to the state
- # directly before BUILD_SOURCE.
- self.buildmanager._state = SourceBuildState.UPDATE
+ # directly before BUILD_CRAFT.
+ self.buildmanager._state = CraftBuildState.UPDATE
- # BUILD_SOURCE: Run the builder's payload to build the source.
+ # BUILD_CRAFT: Run the builder's payload to build the craft.
yield self.buildmanager.iterate(0)
- self.assertEqual(SourceBuildState.BUILD_SOURCE, self.getState())
+ self.assertEqual(CraftBuildState.BUILD_CRAFT, self.getState())
expected_command = [
"sharepath/bin/in-target",
"in-target",
- "build-source",
+ "build-craft",
"--backend=lxd",
"--series=xenial",
"--arch=i386",
@@ -80,7 +80,7 @@ class TestSourceBuildManagerIteration(TestCase):
]
if options is not None:
expected_command.extend(options)
- expected_command.append("test-source")
+ expected_command.append("test-craft")
self.assertEqual(expected_command, self.buildmanager.commands[-1])
self.assertEqual(
self.buildmanager.iterate, self.buildmanager.iterators[-1]
@@ -102,12 +102,12 @@ class TestSourceBuildManagerIteration(TestCase):
def test_iterate(self):
# The build manager iterates a normal build from start to finish.
args = {
- "git_repository": "https://git.launchpad.dev/~example/+git/source",
+ "git_repository": "https://git.launchpad.dev/~example/+git/craft",
"git_path": "master",
}
expected_options = [
"--git-repository",
- "https://git.launchpad.dev/~example/+git/source",
+ "https://git.launchpad.dev/~example/+git/craft",
"--git-path",
"master",
]
@@ -118,8 +118,8 @@ class TestSourceBuildManagerIteration(TestCase):
log.write("I am a build log.")
self.buildmanager.backend.add_file(
- "/home/buildd/test-source/test-source_0_all.tar.xz",
- b"I am sourceing.",
+ "/home/buildd/test-craft/test-craft_0_all.tar.xz",
+ b"I am crafting.",
)
# After building the package, reap processes.
@@ -134,7 +134,7 @@ class TestSourceBuildManagerIteration(TestCase):
self.buildid,
]
- self.assertEqual(SourceBuildState.BUILD_SOURCE, self.getState())
+ self.assertEqual(CraftBuildState.BUILD_CRAFT, self.getState())
self.assertEqual(expected_command, self.buildmanager.commands[-1])
self.assertNotEqual(
self.buildmanager.iterate, self.buildmanager.iterators[-1]
@@ -144,7 +144,7 @@ class TestSourceBuildManagerIteration(TestCase):
self.builder,
HasWaitingFiles.byEquality(
{
- "test-source_0_all.tar.xz": b"I am sourceing.",
+ "test-craft_0_all.tar.xz": b"I am crafting.",
}
),
)
@@ -160,7 +160,7 @@ class TestSourceBuildManagerIteration(TestCase):
"--arch=i386",
self.buildid,
]
- self.assertEqual(SourceBuildState.UMOUNT, self.getState())
+ self.assertEqual(CraftBuildState.UMOUNT, self.getState())
self.assertEqual(expected_command, self.buildmanager.commands[-1])
self.assertEqual(
self.buildmanager.iterate, self.buildmanager.iterators[-1]
@@ -172,17 +172,17 @@ class TestSourceBuildManagerIteration(TestCase):
# The build manager iterates a build using build_path from start to
# finish.
args = {
- "git_repository": "https://git.launchpad.dev/~example/+git/source",
+ "git_repository": "https://git.launchpad.dev/~example/+git/craft",
"git_path": "master",
- "build_path": "source",
+ "build_path": "craft",
}
expected_options = [
"--git-repository",
- "https://git.launchpad.dev/~example/+git/source",
+ "https://git.launchpad.dev/~example/+git/craft",
"--git-path",
"master",
"--build-path",
- "source",
+ "craft",
]
yield self.startBuild(args, expected_options)
@@ -191,8 +191,8 @@ class TestSourceBuildManagerIteration(TestCase):
log.write("I am a build log.")
self.buildmanager.backend.add_file(
- "/home/buildd/test-source/source/test-source_0_all.tar.xz",
- b"I am sourceing.",
+ "/home/buildd/test-craft/craft/test-craft_0_all.tar.xz",
+ b"I am crafting.",
)
# After building the package, reap processes.
@@ -207,7 +207,7 @@ class TestSourceBuildManagerIteration(TestCase):
self.buildid,
]
- self.assertEqual(SourceBuildState.BUILD_SOURCE, self.getState())
+ self.assertEqual(CraftBuildState.BUILD_CRAFT, self.getState())
self.assertEqual(expected_command, self.buildmanager.commands[-1])
self.assertNotEqual(
self.buildmanager.iterate, self.buildmanager.iterators[-1]
@@ -217,7 +217,7 @@ class TestSourceBuildManagerIteration(TestCase):
self.builder,
HasWaitingFiles.byEquality(
{
- "test-source_0_all.tar.xz": b"I am sourceing.",
+ "test-craft_0_all.tar.xz": b"I am crafting.",
}
),
)
@@ -233,7 +233,7 @@ class TestSourceBuildManagerIteration(TestCase):
"--arch=i386",
self.buildid,
]
- self.assertEqual(SourceBuildState.UMOUNT, self.getState())
+ self.assertEqual(CraftBuildState.UMOUNT, self.getState())
self.assertEqual(expected_command, self.buildmanager.commands[-1])
self.assertEqual(
self.buildmanager.iterate, self.buildmanager.iterators[-1]