mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
archive: simplify _source_urls() and _binary_urls()
Signed-off-by: Dan Streetman <ddstreet@canonical.com>
This commit is contained in:
parent
c29b660dbf
commit
3d0921ee54
@ -293,25 +293,28 @@ class SourcePackage(object):
|
|||||||
return os.path.join(mirror, 'pool', self.component, group,
|
return os.path.join(mirror, 'pool', self.component, group,
|
||||||
self.source, filename)
|
self.source, filename)
|
||||||
|
|
||||||
|
def _archive_servers(self):
|
||||||
|
"Generator for mirror and master servers"
|
||||||
|
# Always provide the mirrors first
|
||||||
|
for server in self.mirrors:
|
||||||
|
yield server
|
||||||
|
# Don't repeat servers that are in both mirrors and masters
|
||||||
|
for server in set(self.masters) - set(self.mirrors):
|
||||||
|
yield server
|
||||||
|
|
||||||
def _source_urls(self, name):
|
def _source_urls(self, name):
|
||||||
"Generator of sources for name"
|
"Generator of sources for name"
|
||||||
if self._dsc_source:
|
if self._dsc_source:
|
||||||
yield os.path.join(os.path.dirname(self._dsc_source), name)
|
yield os.path.join(os.path.dirname(self._dsc_source), name)
|
||||||
for mirror in self.mirrors:
|
for server in self._archive_servers():
|
||||||
yield self._mirror_url(mirror, name)
|
yield self._mirror_url(server, name)
|
||||||
for mirror in self.masters:
|
|
||||||
if mirror not in self.mirrors:
|
|
||||||
yield self._mirror_url(mirror, name)
|
|
||||||
if self.lp_spph.sourceFileUrl(name):
|
if self.lp_spph.sourceFileUrl(name):
|
||||||
yield self.lp_spph.sourceFileUrl(name)
|
yield self.lp_spph.sourceFileUrl(name)
|
||||||
|
|
||||||
def _binary_urls(self, name, bpph):
|
def _binary_urls(self, name, bpph):
|
||||||
"Generator of URLs for name"
|
"Generator of URLs for name"
|
||||||
for mirror in self.mirrors:
|
for server in self._archive_servers():
|
||||||
yield self._mirror_url(mirror, name)
|
yield self._mirror_url(server, name)
|
||||||
for mirror in self.masters:
|
|
||||||
if mirror not in self.mirrors:
|
|
||||||
yield self._mirror_url(mirror, name)
|
|
||||||
if bpph.binaryFileUrl(name):
|
if bpph.binaryFileUrl(name):
|
||||||
yield bpph.binaryFileUrl(name)
|
yield bpph.binaryFileUrl(name)
|
||||||
if bpph.getUrl():
|
if bpph.getUrl():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user