diff options
author | Florian Weimer <fw@deneb.enyo.de> | 2010-05-08 10:35:44 +0000 |
---|---|---|
committer | Florian Weimer <fw@deneb.enyo.de> | 2010-05-08 10:35:44 +0000 |
commit | bb935afbfae34b00e9d6776d49efcfe00d241b97 (patch) | |
tree | 923de0d9653d6acba7586217b00ee0ccd155c747 /lib/python/sectracker/repo.py | |
parent | 5ac308332d23c95f89e854ae55a3508cb0285ecc (diff) |
sectracker.repo: only download Sources files
Also adjust RepoCollection.filemap() to focus on source packages,
and augment test case for it.
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@14641 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'lib/python/sectracker/repo.py')
-rw-r--r-- | lib/python/sectracker/repo.py | 74 |
1 files changed, 33 insertions, 41 deletions
diff --git a/lib/python/sectracker/repo.py b/lib/python/sectracker/repo.py index cc0a3184ae..7318ed8b3d 100644 --- a/lib/python/sectracker/repo.py +++ b/lib/python/sectracker/repo.py @@ -156,25 +156,24 @@ class RepoCollection: rel = self.release(name) hashes = rel["sha256"] for comp in rel["components"]: - for arch in rel["architectures"]: - plainpath = self._plainpath(comp, arch) - plainurl = url + plainpath - if not plainpath in hashes: - self.warn("not downloaded because uncompressed version not present in Release file: " + plainurl) - continue - uncompressed_digest = hashes[plainpath] - listname = self._listname(uncompressed_digest) - if os.path.exists(listname): - continue - success = False - for suffix, method in ((".bz2", downloadbz2), - (".gz", downloadgz)): - if method(plainurl + suffix, listname, - uncompressed_digest): - success = True - break - if not success: - self.warn("download failed: " + plainurl) + plainpath = self._sourcepath(comp) + plainurl = url + plainpath + if not plainpath in hashes: + self.warn("not downloaded because uncompressed version not present in Release file: " + plainurl) + continue + uncompressed_digest = hashes[plainpath] + listname = self._listname(uncompressed_digest) + if os.path.exists(listname): + continue + success = False + for suffix, method in ((".bz2", downloadbz2), + (".gz", downloadgz)): + if method(plainurl + suffix, listname, + uncompressed_digest): + success = True + break + if not success: + self.warn("download failed: " + plainurl) def _updatelrelease(self, name): url = self.repos[name] @@ -205,36 +204,29 @@ class RepoCollection: for name in self.repos: rel = self.release(name) hashes = rel["sha256"] - l = [] + comps = {} for comp in rel["components"]: - for arch in rel["architectures"]: - plainpath = self._plainpath(comp, arch) - if not plainpath in hashes: - self.warn("failed to find %s/%s/%s" % (name, comp, arch)) - continue - digest = hashes[plainpath] - listname = self._listname(digest) - if not os.path.exists(listname): - self.warn("file %s for %s/%s/%s not present" % - (listname, name, comp, arch)) - continue - if arch == "source": - method = _parsers.sourcepackages - else: - method = _parsers.binarypackages - l.append((comp, arch, listname, method)) - d[name] = l + plainpath = self._sourcepath(comp) + if not plainpath in hashes: + self.warn("failed to find %s/%s" % (name, comp)) + continue + digest = hashes[plainpath] + listname = self._listname(digest) + if not os.path.exists(listname): + self.warn("file %s for %s/%s not present" % + (listname, name, comp)) + continue + comps[comp] = listname + d[name] = comps return d def _relname(self, name): return "%s/r_%s" % (self.root, name) - def _plainpath(self, comp, arch): + def _sourcepath(self, comp): # Hack to deal with the "updates/" special case. comp = comp.split("/")[-1] - if arch == "source": - return comp + "/source/Sources" - return "%s/binary-%s/Packages" % (comp, arch) + return comp + "/source/Sources" def _listname(self, digest): return "%s/h_%s" % (self.root, digest) |