API: move fileinfo_ext[_all] from StagingAPI to core
These helpers can be used by other bots, like for example repo-checker, which do not rely on the StagingAPI.
This commit is contained in:
@@ -2,6 +2,7 @@ from xml.etree import cElementTree as ET
|
||||
|
||||
from osc.core import makeurl
|
||||
from osc.core import http_GET
|
||||
from osclib.core import fileinfo_ext_all
|
||||
|
||||
import urllib2
|
||||
|
||||
@@ -150,7 +151,7 @@ class CleanupRings(object):
|
||||
def check_requiredby(self, project, package):
|
||||
# Prioritize x86_64 bit.
|
||||
for arch in reversed(self.api.ring_archs(project)):
|
||||
for fileinfo in self.api.fileinfo_ext_all(project, 'standard', arch, package):
|
||||
for fileinfo in fileinfo_ext_all(self.api.apiurl, project, 'standard', arch, package):
|
||||
for requiredby in fileinfo.findall('provides_ext/requiredby[@name]'):
|
||||
b = self.bin2src[requiredby.get('name')]
|
||||
if b == package:
|
||||
|
@@ -188,3 +188,22 @@ def project_list_prefix(apiurl, prefix):
|
||||
url = makeurl(apiurl, ['search', 'project', 'id'], query)
|
||||
root = ETL.parse(http_GET(url)).getroot()
|
||||
return root.xpath('project/@name')
|
||||
|
||||
#
|
||||
# Depdendency helpers
|
||||
#
|
||||
def fileinfo_ext_all(apiurl, project, repo, arch, package):
|
||||
url = makeurl(apiurl, ['build', project, repo, arch, package])
|
||||
binaries = ET.parse(http_GET(url)).getroot()
|
||||
for binary in binaries.findall('binary'):
|
||||
filename = binary.get('filename')
|
||||
if not filename.endswith('.rpm'):
|
||||
continue
|
||||
|
||||
yield fileinfo_ext(apiurl, project, repo, arch, package, filename)
|
||||
|
||||
def fileinfo_ext(apiurl, project, repo, arch, package, filename):
|
||||
url = makeurl(apiurl,
|
||||
['build', project, repo, arch, package, filename],
|
||||
{'view': 'fileinfo_ext'})
|
||||
return ET.parse(http_GET(url)).getroot()
|
||||
|
@@ -1808,22 +1808,6 @@ class StagingAPI(object):
|
||||
return self.cstaging_dvd_archs
|
||||
return self.cstaging_archs
|
||||
|
||||
def fileinfo_ext_all(self, project, repo, arch, package):
|
||||
url = makeurl(self.apiurl, ['build', project, repo, arch, package])
|
||||
binaries = ET.parse(http_GET(url)).getroot()
|
||||
for binary in binaries.findall('binary'):
|
||||
filename = binary.get('filename')
|
||||
if not filename.endswith('.rpm'):
|
||||
continue
|
||||
|
||||
yield self.fileinfo_ext(project, repo, arch, package, filename)
|
||||
|
||||
def fileinfo_ext(self, project, repo, arch, package, filename):
|
||||
url = makeurl(self.apiurl,
|
||||
['build', project, repo, arch, package, filename],
|
||||
{'view': 'fileinfo_ext'})
|
||||
return ET.parse(http_GET(url)).getroot()
|
||||
|
||||
def ignore_format(self, request_id):
|
||||
requests_ignored = self.get_ignored_requests()
|
||||
if request_id in requests_ignored:
|
||||
|
Reference in New Issue
Block a user