#1010 Rename LocalBuilder to SRPMBuilder and change type detection.
Merged 2 years ago by ralph. Opened 2 years ago by ralph.

@@ -486,11 +486,11 @@ 




-         # 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)


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



@@ -524,9 +524,9 @@ 

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



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.

See also FACTORY-2932.

LGTM. BTW, should the source be validated for supported type of sources?

@ralph: LGTM
@cqi: scm_url_schemes from module_build_service.utils.general could probably be used

rebased onto cfe32af

2 years ago

Pull-Request has been merged by ralph

2 years ago