| |
@@ -268,12 +268,28 @@
|
| |
in Koji.
|
| |
"""
|
| |
|
| |
- def construct_build_url(self, *args, **kwargs):
|
| |
+ def detect_forked_repo(self):
|
| |
+ # detection of forked repository
|
| |
+ # consider the only remote record in .git/config with proper url format
|
| |
+ if len(self.repo.remotes) == 1:
|
| |
+ remote = self.repo.remotes[0]
|
| |
+ if len(list(remote.urls)) == 1:
|
| |
+ remote_url = next(remote.urls)
|
| |
+ match = re.search(r'forks/{0}/\w+/\w+'.format(self.user), remote_url)
|
| |
+ if match:
|
| |
+ return match.group()
|
| |
+ return None
|
| |
+
|
| |
+ def construct_build_url(self, repo_name=None, commit_hash=None):
|
| |
"""Override build URL for Fedora Koji build
|
| |
|
| |
In Fedora Koji, anonymous URL should have prefix "git+https://"
|
| |
"""
|
| |
- url = super(Commands, self).construct_build_url(*args, **kwargs)
|
| |
+ # do not override parameters passed to the method
|
| |
+ if not repo_name and not commit_hash:
|
| |
+ repo_name = self.detect_forked_repo()
|
| |
+
|
| |
+ url = super(Commands, self).construct_build_url(repo_name, commit_hash)
|
| |
return 'git+{0}'.format(url)
|
| |
|
| |
def update(self, bodhi_config, template='bodhi.template', bugs=[]):
|
| |
This change allows building changes pushed into the user's forked repo.
This doesn't require using '--srpm' param, 'fedpkg (scratch-)build' is
enough. Function restricts using multiple git remote records. Otherwise,
the original approach works.
JIRA: COMPOSE-2963
Relates: #282
Signed-off-by: Ondrej Nosek onosek@redhat.com