mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-02 02:11:19 +08:00
Send the actual branch to copr, not commit
This commit is contained in:
@@ -257,9 +257,12 @@ class CoprModuleBuilder(GenericBuilder):
|
||||
return self.client.create_new_build(self.copr.projectname, [source], username=self.copr.username)
|
||||
|
||||
def build_scm(self, source):
|
||||
url, branch = source.split("?#")
|
||||
url, commit = source.split("?#")
|
||||
url = (url.replace("git://", "https://")
|
||||
.replace("pkgs.fedoraproject.org", "src.fedoraproject.org/git"))
|
||||
cod = clone(url)
|
||||
branch = git_branch_contains(cod, commit)
|
||||
rmdir(cod)
|
||||
return self.client.create_new_build_distgit(self.copr.projectname, url, branch=branch, username=self.copr.username)
|
||||
|
||||
def finalize(self):
|
||||
@@ -382,6 +385,23 @@ def build_from_scm(artifact_name, source, config, build_srpm,
|
||||
return ret
|
||||
|
||||
|
||||
def clone(url):
|
||||
log.debug('Cloning source URL: %s' % url)
|
||||
td = tempfile.mkdtemp()
|
||||
scm = module_build_service.scm.SCM(url)
|
||||
return scm.checkout(td)
|
||||
|
||||
|
||||
def rmdir(path):
|
||||
try:
|
||||
if path is not None:
|
||||
shutil.rmtree(path)
|
||||
except Exception as e:
|
||||
log.warning(
|
||||
"Failed to remove temporary directory {!r}: {}".format(
|
||||
path, str(e)))
|
||||
|
||||
|
||||
def git_branch_contains(cod, commit):
|
||||
cmd = ["git", "branch", "-r", "--contains", commit]
|
||||
out, err = execute_cmd(cmd, cwd=cod, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
Reference in New Issue
Block a user