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.
This commit is contained in:
Ralph Bean
2018-09-06 22:51:06 -04:00
parent 9d40718895
commit cfe32afcd0

View File

@@ -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])