From cfe32afcd09a6064c49a618fcbf4ce14f2648857 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Sep 07 2018 13:23:11 +0000 Subject: Rename LocalBuilder to SRPMBuilder and change type detection. First, rename LocalBuilder to SRPMBuilder. Reading the manpage for mock tells me that the `--rebuild` option is specifically for rebuilding a given srpm. The class was just named poorly (imo). Second, change the type detection. The bug I'm trying to fix is if you try to pass a string for the `repository:` in your modulemd like `file:///home/user/repos/libfoo/`. The old logic here would assume that it is an srpm since it didn't start with "git" or "http", but that's not correct. We have people who want to experiment with building modules with components that are not publicly accessible over the network - which are only local. This change allows that. --- diff --git a/module_build_service/builder/MockModuleBuilder.py b/module_build_service/builder/MockModuleBuilder.py index c6fca4a..899471b 100644 --- a/module_build_service/builder/MockModuleBuilder.py +++ b/module_build_service/builder/MockModuleBuilder.py @@ -486,11 +486,11 @@ class MockModuleBuilder(GenericBuilder): else: os.makedirs(resultsdir) - # Git sources are treated specially. - if source.startswith(("git://", "http://", "https://")): - builder = SCMBuilder(mock_config, resultsdir, source, artifact_name) + if source.endswith('.src.rpm'): + builder = SRPMBuilder(mock_config, resultsdir, source) else: - builder = LocalBuilder(mock_config, resultsdir, source) + # Otherwise, assume we're building from some scm repo + builder = SCMBuilder(mock_config, resultsdir, source, artifact_name) return self.build_srpm(artifact_name, source, build_id, builder) @staticmethod @@ -524,9 +524,9 @@ class BaseBuilder(object): execute_cmd(self.cmd, stdout=stdout, stderr=stderr) -class LocalBuilder(BaseBuilder): +class SRPMBuilder(BaseBuilder): def __init__(self, config, resultsdir, source): - super(LocalBuilder, self).__init__(config, resultsdir) + super(SRPMBuilder, self).__init__(config, resultsdir) self.cmd.extend(["--rebuild", source])