blob: 08a6e683730f0044b491fceaa3d78ba666104c41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import os
import Conf
from DiffGzHandler import DiffGzHandler
class PtsIndexPackageInfo ( dict ):
def __init__ (self, srcpkg):
dict.__init__(self)
self['type'] = srcpkg.type
self['format'] = srcpkg.format
if srcpkg.diffgz_name:
diffgz = os.sep.join([Conf.archive_root,srcpkg.loc,srcpkg.diffgz_name])
dh = DiffGzHandler( diffgz )
ser = dh.series()
if ser:
self['series-patches'] = len(ser)
self['url'] = '%s/packages/%s/%s'%(Conf.root_url,
srcpkg.name,srcpkg.version)
class PtsIndexFile ( dict ):
def __init__ (self):
dict.__init__(self)
self['index-version'] = 1
self['packages'] = {}
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)
|