Skip to content

Commit

Permalink
hub: update determine_priority to support dist-git url
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyw committed May 23, 2024
1 parent eb64980 commit f39455e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions osh/hub/scan/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def add_if(x, collection):

@classmethod
def determine_priority(cls, entered_priority, supposed_nvr, srpm_name,
is_tarball=False):
dist_git_url=None, is_tarball=False):
"""determine priority of scheduled task
:param entered_priority: priority submitted by client
Expand All @@ -388,10 +388,15 @@ def determine_priority(cls, entered_priority, supposed_nvr, srpm_name,
if is_tarball:
srpm_name = re.sub(r'\.tar(\.[a-z0-9]+)?$', '', srpm_name)

try:
name_candidates.append(check_nvr(supposed_nvr or srpm_name)['name'])
except RuntimeError:
pass
if supposed_nvr or srpm_name:
try:
name_candidates.append(check_nvr(supposed_nvr or srpm_name)['name'])
except RuntimeError:
pass

if dist_git_url:
_, repo_name, _ = parse_git_url(dist_git_url)
name_candidates.append(repo_name)

if srpm_name:
# try also only NV and the whole filename
Expand Down Expand Up @@ -503,7 +508,7 @@ def prepare_args(self):
self.task_args['method'] = self.method
self.task_args['comment'] = self.comment
self.task_args['priority'] = AbstractClientScanScheduler.determine_priority(
self.priority, self.build_nvr, self.srpm_name, self.is_tarball)
self.priority, self.build_nvr, self.srpm_name, self.dist_git_url, self.is_tarball)
self.task_args['state'] = TASK_STATES['CREATED']
self.task_args['args'] = {}
if self.build_nvr:
Expand Down

0 comments on commit f39455e

Please sign in to comment.