diff options
-rwxr-xr-x | gen-patch-info.py | 5 | ||||
-rw-r--r-- | patchtracker/PtsIndex.py | 17 |
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) |