[Secure-testing-commits] r14641 - in lib/python: sectracker sectracker_test
Florian Weimer
fw at alioth.debian.org
Sat May 8 10:35:44 UTC 2010
Author: fw
Date: 2010-05-08 10:35:44 +0000 (Sat, 08 May 2010)
New Revision: 14641
Modified:
lib/python/sectracker/repo.py
lib/python/sectracker_test/test_repo.py
Log:
sectracker.repo: only download Sources files
Also adjust RepoCollection.filemap() to focus on source packages,
and augment test case for it.
Modified: lib/python/sectracker/repo.py
===================================================================
--- lib/python/sectracker/repo.py 2010-05-08 10:20:31 UTC (rev 14640)
+++ lib/python/sectracker/repo.py 2010-05-08 10:35:44 UTC (rev 14641)
@@ -156,25 +156,24 @@
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 @@
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)
Modified: lib/python/sectracker_test/test_repo.py
===================================================================
--- lib/python/sectracker_test/test_repo.py 2010-05-08 10:20:31 UTC (rev 14640)
+++ lib/python/sectracker_test/test_repo.py 2010-05-08 10:35:44 UTC (rev 14641)
@@ -18,6 +18,7 @@
import shutil
from sectracker.repo import *
+import sectracker.parsers as p
tmp = tempfile.mkdtemp()
try:
@@ -30,5 +31,12 @@
r.add("squeeze", mirror + "debian/dists/squeeze")
r.add("sid", mirror + "debian/dists/sid")
r.update()
+ fm = r.filemap()
+ assert "sid" in fm
+ assert "main" in fm["sid"]
+ o = p.sourcepackages(fm["sid"]["main"])
+ assert "bash" in o
+ assert o["bash"].name == "bash"
+ assert "bash" in o["bash"].binary
finally:
shutil.rmtree(tmp)
More information about the Secure-testing-commits
mailing list