osclib/core: rework as package_list_kind_filtered().
This commit is contained in:
parent
feca459bb7
commit
45bc515ed8
@ -16,7 +16,7 @@ from osclib.comments import CommentAPI
|
||||
from osclib.conf import Config
|
||||
from osclib.core import devel_project_fallback
|
||||
from osclib.core import entity_email
|
||||
from osclib.core import package_list_without_links
|
||||
from osclib.core import package_list_kind_filtered
|
||||
from osclib.core import request_age
|
||||
from osclib.stagingapi import StagingAPI
|
||||
from osclib.util import mail_send
|
||||
@ -107,7 +107,7 @@ def notify(args):
|
||||
# devel_project_fallback() must be used on a per package basis.
|
||||
packages = args.packages
|
||||
if not packages:
|
||||
packages = package_list_without_links(apiurl, args.project)
|
||||
packages = package_list_kind_filtered(apiurl, args.project)
|
||||
maintainer_map = {}
|
||||
for package in packages:
|
||||
devel_project, devel_package = devel_project_fallback(apiurl, args.project, package)
|
||||
|
@ -10,7 +10,7 @@ from osc import oscerr
|
||||
from osc.core import get_request_list
|
||||
from osclib.cache import Cache
|
||||
from osclib.cache_manager import CacheManager
|
||||
from osclib.core import package_list_without_links
|
||||
from osclib.core import package_list_kind_filtered
|
||||
from osclib.core import project_attribute_list
|
||||
from osclib.origin import config_load
|
||||
from osclib.origin import config_origin_list
|
||||
@ -139,8 +139,7 @@ def osrt_origin_lookup(apiurl, project, force_refresh=False, previous=False, qui
|
||||
if previous:
|
||||
return None
|
||||
|
||||
packages = package_list_without_links(apiurl, project)
|
||||
logging.debug('{} packages found in {}'.format(len(packages), project))
|
||||
packages = package_list_kind_filtered(apiurl, project)
|
||||
|
||||
lookup = {}
|
||||
for package in packages:
|
||||
|
@ -300,18 +300,27 @@ def project_pseudometa_file_ensure(apiurl, project, filename, content, comment=N
|
||||
project_pseudometa_file_save(apiurl, project, filename, content, comment)
|
||||
|
||||
# Should be an API call that says give me "real" packages that does not include
|
||||
# multibuild entries nor linked packages.
|
||||
def package_list_without_links(apiurl, project):
|
||||
# multibuild entries, nor linked packages, nor maintenance update packages, but
|
||||
# does included inherited packages from project layering. Unfortunately, no such
|
||||
# call provides either server-side filtering nor enough information to filter
|
||||
# client-side. As such extra calls must be made for each package to handle the
|
||||
# various different cases that can exist between products. For a more detailed
|
||||
# write-up see the opensuse-buildservice mailing list thread:
|
||||
# https://lists.opensuse.org/opensuse-buildservice/2019-05/msg00020.html.
|
||||
def package_list_kind_filtered(apiurl, project, kinds_allowed=['source']):
|
||||
query = {
|
||||
'view': 'info',
|
||||
'nofilename': '1',
|
||||
}
|
||||
url = makeurl(apiurl, ['source', project], query)
|
||||
root = ETL.parse(http_GET(url)).getroot()
|
||||
return root.xpath(
|
||||
'//sourceinfo[not(./linked[@project="{}"]) and '
|
||||
'not(contains(@package, ":"))'
|
||||
'and not(starts-with(@package, "00"))]/@package'.format(project))
|
||||
|
||||
for package in root.xpath('sourceinfo/@package'):
|
||||
kind = package_kind(apiurl, project, package)
|
||||
if kind not in kinds_allowed:
|
||||
continue
|
||||
|
||||
yield package
|
||||
|
||||
def attribute_value_load(apiurl, project, name, namespace='OSRT'):
|
||||
url = makeurl(apiurl, ['source', project, '_attribute', namespace + ':' + name])
|
||||
|
Loading…
x
Reference in New Issue
Block a user