mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-02-12 01:24:59 +08:00
Don't hardcode dist-git clone command
This commit is contained in:
@@ -446,13 +446,18 @@ class SCMBuilder(BaseBuilder):
|
||||
super(SCMBuilder, self).__init__(config, resultsdir)
|
||||
with open(config, "a") as f:
|
||||
branch = source.split("?#")[1]
|
||||
dist_git_get = self._get_clone_command(source).format(artifact_name)
|
||||
f.writelines([
|
||||
"config_opts['scm'] = True\n",
|
||||
"config_opts['scm_opts']['method'] = 'distgit'\n",
|
||||
"config_opts['scm_opts']['branch'] = '{}'\n".format(branch),
|
||||
"config_opts['scm_opts']['package'] = '{}'\n".format(artifact_name),
|
||||
"config_opts['scm_opts']['distgit_get'] = 'fedpkg clone {} --anonymous'\n".format(artifact_name),
|
||||
"config_opts['scm_opts']['distgit_get'] = '{}'\n".format(dist_git_get),
|
||||
"config_opts['scm_opts']['distgit_src_get'] = 'fedpkg sources'\n",
|
||||
])
|
||||
|
||||
|
||||
def _get_clone_command(self, source):
|
||||
for host, cmd in conf.distgits.items():
|
||||
if source.startswith(host):
|
||||
return cmd
|
||||
raise KeyError("No defined command for {}".format(source))
|
||||
|
||||
@@ -286,6 +286,12 @@ class Config(object):
|
||||
'type': str,
|
||||
'default': '',
|
||||
'desc': 'Trusted certificate for ssl connection.'},
|
||||
'distgits': {
|
||||
'type': dict,
|
||||
'default': {
|
||||
'git://pkgs.fedoraproject.org': 'fedpkg clone --anonymous {}',
|
||||
},
|
||||
'desc': 'Mapping between dist-git and command to '},
|
||||
'mock_config': {
|
||||
'type': str,
|
||||
'default': 'fedora-25-x86_64',
|
||||
|
||||
Reference in New Issue
Block a user