Skip to content

Commit

Permalink
Merge branch 'fix_#351' of https://github.com/lethliel/osc
Browse files Browse the repository at this point in the history
Fix logic for finding disabled repos in do_repositories.

Fixes: #351 ("Not all options for osc getbinaries is listed")
  • Loading branch information
marcus-h committed Nov 9, 2017
2 parents cb376a1 + 12b17cf commit 0f9ab38
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 7 additions & 3 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -5846,13 +5846,17 @@ def do_repositories(self, subcmd, opts, *args):

if subcmd == 'repos_only':
for repo in get_repositories_of_project(apiurl, project):
if (disabled is None) or ((disabled is not None) and (repo not in disabled)):
if (disabled is None) or ((disabled is not None) and (repo not in [d['repo'] for d in disabled])):
print(repo)
else:
data = []
for repo in get_repos_of_project(apiurl, project):
if (disabled is None) or ((disabled is not None) and (repo.name not in disabled)):
data += [repo.name, repo.arch]
if disabled is not None:
if ({'repo': repo.name, 'arch': repo.arch} in disabled
or repo.name in [d['repo'] for d in disabled if d['arch'] is None]
or repo.arch in [d['arch'] for d in disabled if d['repo'] is None]):
continue
data += [repo.name, repo.arch]

for row in build_table(2, data, width=2):
print(row)
Expand Down
9 changes: 7 additions & 2 deletions osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3554,7 +3554,12 @@ def show_package_disabled_repos(apiurl, prj, pac):
try:
root = ET.fromstring(''.join(m))
elm = root.find('build')
r = [ node.get('repository') for node in elm.findall('disable')]
r = []
for node in elm.findall('disable'):
repo = node.get('repository')
arch = node.get('arch')
dis_r = {'repo': repo, 'arch': arch}
r.append(dis_r)
return r
except:
return None
Expand Down Expand Up @@ -7182,7 +7187,7 @@ def safe_get_rpmlint_log(src_actions):
print('Type %s:' % action.type)
disabled = show_package_disabled_repos(apiurl, action.src_project, action.src_package)
for repo in get_repos_of_project(apiurl, action.src_project):
if disabled is None or repo.name not in disabled:
if (disabled is None) or (repo.name not in [d['repo'] for d in disabled]):
lintlog_entry = {
'proj': action.src_project,
'pkg': action.src_package,
Expand Down

0 comments on commit 0f9ab38

Please sign in to comment.