1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-05 19:00:56 +01:00

Migrate core.show_package_disabled_repos() to obs_api.Package

This commit is contained in:
Daniel Mach 2024-02-14 09:28:59 +01:00
parent f5b782edc8
commit f62b11ea86

View File

@ -3910,20 +3910,15 @@ def set_devel_project(apiurl, prj, pac, devprj=None, devpac=None, print_to="debu
def show_package_disabled_repos(apiurl: str, prj: str, pac: str): def show_package_disabled_repos(apiurl: str, prj: str, pac: str):
m = show_package_meta(apiurl, prj, pac) from . import obs_api
# FIXME: don't work if all repos of a project are disabled and only some are enabled since <disable/> is empty # FIXME: don't work if all repos of a project are disabled and only some are enabled since <disable/> is empty
try: package_obj = obs_api.Package.from_api(apiurl, prj, pac)
root = ET.fromstring(''.join(m)) result = []
elm = root.find('build') for i in package_obj.build_list or []:
r = [] if i.flag == "disable":
for node in elm.findall('disable'): result.append({"repo": i.repository, "arch": i.arch})
repo = node.get('repository') return result
arch = node.get('arch')
dis_r = {'repo': repo, 'arch': arch}
r.append(dis_r)
return r
except:
return None
def show_pattern_metalist(apiurl: str, prj: str): def show_pattern_metalist(apiurl: str, prj: str):