Merge #1746 Add default branch configuration option

This commit is contained in:
Brendan Reilly
2022-05-03 16:48:24 +00:00
4 changed files with 11 additions and 6 deletions

View File

@@ -681,6 +681,11 @@ class Config(object):
"which buildrequires to automatically include. This can be overridden with "
"the xmd.mbs.default_modules_scm_url key in the base module's modulemd.",
},
"default_branch": {
"type": str,
"default": "master",
"desc": "Denotes the default branch.",
},
"uses_rawhide": {
"type": bool,
"default": True,

View File

@@ -71,8 +71,8 @@ class SCM(object):
If url is not in the list of allowed_scm, an error will be raised.
:param str url: The unmodified scmurl
:param str branch: The optional source control branch. This defaults to "master" when git
is used.
:param str branch: The optional source control branch. This defaults to the default_branch
config option when git is used.
:param list allowed_scm: The optional list of allowed SCM URL prefixes
:param bool allow_local: Allow SCM URLs that start with "file://"
:raises: Forbidden or ValidationError
@@ -111,7 +111,7 @@ class SCM(object):
if self.name.endswith(".git"):
self.name = self.name[:-4]
self.commit = match.group("commit")
self.branch = branch if branch else "master"
self.branch = branch if branch else conf.default_branch
self.version = None
self._cloned = False
else:

View File

@@ -307,7 +307,7 @@ def format_mmd(mmd, scmurl, module=None, db_session=None, srpm_overrides=None):
if not pkg.get_cache():
pkg.set_cache(conf.rpms_default_cache + pkgname)
if not pkg.get_ref():
pkg.set_ref("master")
pkg.set_ref(conf.default_branch)
if not pkg.get_arches():
for arch in conf.arches:
pkg.add_restricted_arch(arch)
@@ -323,7 +323,7 @@ def format_mmd(mmd, scmurl, module=None, db_session=None, srpm_overrides=None):
if not mod.get_repository():
mod.set_repository(conf.modules_default_repository + modname)
if not mod.get_ref():
mod.set_ref("master")
mod.set_ref(conf.default_branch)
# It is possible to override the ref of RPM component using
# the rpm_component_ref_overrides.

View File

@@ -122,7 +122,7 @@ def submit_module_build_from_yaml(
'"module_name" parameter'
)
module_name = stream_or_packager.get_module_name() or def_name
module_stream = stream or stream_or_packager.get_stream_name() or "master"
module_stream = stream or stream_or_packager.get_stream_name() or conf.default_branch
if module_name != stream_or_packager.get_module_name() or \
module_stream != stream_or_packager.get_stream_name():
# This is how you set the name and stream in the modulemd