| |
@@ -1974,15 +1974,47 @@
|
| |
self.module_validate_config()
|
| |
scm_url, branch = self.cmd.module_get_scm_info(
|
| |
self.args.scm_url, self.args.branch)
|
| |
+
|
| |
+ buildrequires = self.args.buildrequires or []
|
| |
+ branch_search = None
|
| |
+ try:
|
| |
+ # The regex to parse the base module stream override from the dist-git branch name.
|
| |
+ # For example, if you had a branch called `10-fedora-29.0.1` and you wanted to
|
| |
+ # parse `f29.0.1` from that as the stream to use for the base module, you could
|
| |
+ # have a regex of `(f)(?:edora)(?:\-)(\d+\.\d+\.\d+)$`. Then after combining
|
| |
+ # the capture groups, you'd get the desired result of `f29.0.1`.
|
| |
+ branch_bm_regex = self.config.get(
|
| |
+ self.config_section, 'base_module_stream_regex_from_branch')
|
| |
+ # The base module (e.g. platform) to apply the buildrequire override to if the parsing
|
| |
+ # of the branch name is successfull
|
| |
+ bm = self.config.get(self.config_section, 'base_module')
|
| |
+ except configparser.NoOptionError:
|
| |
+ pass
|
| |
+ else:
|
| |
+ branch_search = re.search(branch_bm_regex, branch)
|
| |
+
|
| |
+ if branch_search:
|
| |
+ # Concatenate all the groups together to get the desired stream.
|
| |
+ # This approach is taken in case there are sections to ignore.
|
| |
+ # For instance, if we need to parse `f27.0.0` from `fedora-27.0.0`.
|
| |
+ bm_stream = ''.join(branch_search.groups())
|
| |
+ # Don't override the base module buildrequire if the user
|
| |
+ # manually already overrode it with the `--buildrequire` argument
|
| |
+ if not any(br[0] == bm for br in buildrequires):
|
| |
+ buildrequires.append((bm, bm_stream))
|
| |
+ if not self.args.q:
|
| |
+ print('Added the buildrequire override "{0}" based on the module branch name'
|
| |
+ .format('{0}:{1}'.format(bm, bm_stream)))
|
| |
+
|
| |
auth_method, oidc_id_provider, oidc_client_id, oidc_client_secret, \
|
| |
oidc_scopes = self.module_get_auth_config()
|
| |
|
| |
if not self.args.q:
|
| |
print('Submitting the module build...')
|
| |
build_ids = self._cmd.module_submit_build(
|
| |
- scm_url, branch, auth_method, self.args.buildrequires,
|
| |
- self.args.requires, self.args.optional, oidc_id_provider,
|
| |
- oidc_client_id, oidc_client_secret, oidc_scopes)
|
| |
+ scm_url, branch, auth_method, buildrequires, self.args.requires,
|
| |
+ self.args.optional, oidc_id_provider, oidc_client_id,
|
| |
+ oidc_client_secret, oidc_scopes)
|
| |
if self.args.watch:
|
| |
self.module_watch_build(build_ids)
|
| |
elif not self.args.q:
|
| |
Addresses the final part of FACTORY-3084 and relies on #389. Only the last commit is relevant to this PR.