PR#2682: don't assume that the hub will report arches for external repos

Merges #2682
https://pagure.io/koji/pull-request/2682

Fixes: #2681
https://pagure.io/koji/issue/2681
taginfo fail with older hub if external repos are set
This commit is contained in:
Tomas Kopecek 2021-02-08 09:56:44 +01:00
commit 3189dcb98a
2 changed files with 5 additions and 2 deletions

View file

@ -5557,7 +5557,7 @@ class CreaterepoTask(BaseTaskHandler):
# generate repo url list, starting with our local premerge repo
repos = ['file://' + localdir + '/']
for repo in external_repos:
if repo['arches'] and arch not in repo['arches'].split():
if repo.get('arches') and arch not in repo['arches'].split():
# ignore external repo with non-relevant archlist
continue
ext_url = repo['url']

View file

@ -4937,7 +4937,10 @@ def anon_handle_taginfo(goptions, session, args):
if external_repos:
print("External repos:")
for rinfo in external_repos:
if not rinfo['arches']:
if 'arches' not in rinfo:
# older hubs will not return this field
rinfo['arches'] = '-'
elif not rinfo['arches']:
rinfo['arches'] = 'inherited from tag'
# TODO else intersection of arches?
print(" %(priority)3i %(external_repo_name)s "