mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-25 01:41:08 +00:00
Help testing: Separate rmadison out into a function
This commit is contained in:
parent
a3b82ff2e9
commit
26c2198838
@ -333,17 +333,14 @@ class DebianSourcePackage(SourcePackage):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
Logger.normal('Using rmadison for component determination')
|
Logger.normal('Using rmadison for component determination')
|
||||||
p = subprocess.Popen(('rmadison', '-u', 'debian', self.source),
|
|
||||||
stdout=subprocess.PIPE)
|
|
||||||
rmadison = p.communicate()[0]
|
|
||||||
comp = 'main'
|
comp = 'main'
|
||||||
for line in rmadison.strip().splitlines():
|
for record in rmadison(self.distribution, self.source):
|
||||||
pkg, ver, dist, archs = [x.strip() for x in line.split('|')]
|
if record.get('source') != self.source:
|
||||||
comp = 'main'
|
continue
|
||||||
if '/' in dist:
|
comp = record['component']
|
||||||
dist, comp = dist.split('/')
|
if record['version'] == self.version.full_version:
|
||||||
if ver == self.version.full_version:
|
self._spph = rmadison_SPPH(record['source'],
|
||||||
self._spph = rmadison_SPPH(pkg, ver, comp)
|
record['version'], comp)
|
||||||
return self._spph
|
return self._spph
|
||||||
|
|
||||||
Logger.normal('Guessing component from most recent upload')
|
Logger.normal('Guessing component from most recent upload')
|
||||||
@ -417,3 +414,34 @@ class DebianSourcePackage(SourcePackage):
|
|||||||
class UbuntuSourcePackage(SourcePackage):
|
class UbuntuSourcePackage(SourcePackage):
|
||||||
"Download / unpack an Ubuntu source package"
|
"Download / unpack an Ubuntu source package"
|
||||||
distribution = 'ubuntu'
|
distribution = 'ubuntu'
|
||||||
|
|
||||||
|
|
||||||
|
def rmadison(url, package):
|
||||||
|
"Call rmadison and parse the result"
|
||||||
|
p = subprocess.Popen(('rmadison', '-u', url, package),
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
|
close_fds=True)
|
||||||
|
output = p.communicate()[0]
|
||||||
|
assert p.wait() == 0
|
||||||
|
for line in output.strip().splitlines():
|
||||||
|
pkg, ver, dist, archs = [x.strip() for x in line.split('|')]
|
||||||
|
comp = 'main'
|
||||||
|
if '/' in dist:
|
||||||
|
dist, comp = dist.split('/')
|
||||||
|
archs = set(x.strip() for x in archs.split(','))
|
||||||
|
if 'source' in archs:
|
||||||
|
yield {
|
||||||
|
'source': pkg,
|
||||||
|
'version': ver,
|
||||||
|
'distribution': dist,
|
||||||
|
'component': comp,
|
||||||
|
}
|
||||||
|
archs.discard('source')
|
||||||
|
if archs:
|
||||||
|
yield {
|
||||||
|
'binary': pkg,
|
||||||
|
'version': ver,
|
||||||
|
'distribution': dist,
|
||||||
|
'component': comp,
|
||||||
|
'architectures': archs,
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user