summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-08-31 22:45:04 +0200
committerSean Finney <seanius@debian.org>2009-09-01 08:57:43 +0200
commitad817fd1bd8d88b242fea45ea1d96315d48c3a47 (patch)
tree3589675fc1b946e815d2cdc634c1a63b39951541
parent78133b8eb1cd2aff6f5e73e452dee6c3c50a5e1b (diff)
downloadpatch-tracker-ad817fd1bd8d88b242fea45ea1d96315d48c3a47.tar.gz
small fixups to the pts index feature
-rwxr-xr-xgen-patch-info.py5
-rw-r--r--patchtracker/PtsIndex.py17
2 files changed, 12 insertions, 10 deletions
diff --git a/gen-patch-info.py b/gen-patch-info.py
index ef1621e..ea9cdb7 100755
--- a/gen-patch-info.py
+++ b/gen-patch-info.py
@@ -43,6 +43,8 @@ if __name__ == '__main__':
if e.errno != errno.EEXIST:
raise e
+ pts_idx = PtsIndexFile()
+
print a
for s in a.suites(filter=suites):
print "suite: ",s
@@ -55,9 +57,10 @@ if __name__ == '__main__':
db.saveSourcePackage(p)
db.relateSourcePackage(name=p.name, version=p.version, suite=s,
component=c)
+ if gen_pts_index:
+ pts_idx.add(p)
if gen_pts_index:
- pts_idx = PtsIndexFile(a)
pts_fh = gzip.GzipFile(Conf.pts_index_file, mode="wb")
simplejson.dump(pts_idx, pts_fh)
pts_fh.close()
diff --git a/patchtracker/PtsIndex.py b/patchtracker/PtsIndex.py
index 6f60863..08a6e68 100644
--- a/patchtracker/PtsIndex.py
+++ b/patchtracker/PtsIndex.py
@@ -19,15 +19,14 @@ class PtsIndexPackageInfo ( dict ):
srcpkg.name,srcpkg.version)
class PtsIndexFile ( dict ):
- def __init__ (self, archive, suites=None, packages=None):
+ def __init__ (self):
dict.__init__(self)
self['index-version'] = 1
self['packages'] = {}
- for s in archive.suites(filter=suites):
- for c in archive.components(s):
- for p in archive.sourcepackages(s, c, filter=packages):
- if not self['packages'].has_key(p.name):
- url = '%s/packages/%s'%(Conf.root_url, p.name)
- self['packages'][p.name] = { 'url': url, 'versions': {} }
- if not self['packages'][p.name].has_key(p.version):
- self['packages'][p.name]['versions'][p.version]=PtsIndexPackageInfo(p)
+
+ def add (self, pkg):
+ if not self['packages'].has_key(pkg.name):
+ url = '%s/packages/%s'%(Conf.root_url, pkg.name)
+ self['packages'][pkg.name] = { 'url': url, 'versions': {} }
+ if not self['packages'][pkg.name].has_key(pkg.version):
+ self['packages'][pkg.name]['versions'][pkg.version]=PtsIndexPackageInfo(pkg)