summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgen-patch-info.py18
-rwxr-xr-xpatchtracker/SourceArchive.py22
2 files changed, 32 insertions, 8 deletions
diff --git a/gen-patch-info.py b/gen-patch-info.py
index 2c227ad..618179a 100755
--- a/gen-patch-info.py
+++ b/gen-patch-info.py
@@ -1,6 +1,8 @@
#!/usr/bin/python
import os
+import sys
+import getopt
import patchtracker.Conf as Conf
from patchtracker.Writers import LetterTocWriter, FrontPageWriter, PackageVersWriter
@@ -8,21 +10,29 @@ from patchtracker.SourceArchive import Archive, SourcePackage, SourcePackageInde
if __name__ == '__main__':
os.system("cheetah compile templates/skeleton")
- a = Archive(Conf.archive_root)
+ opts,args = getopt.getopt(sys.argv[1:], "s:p:")
+ suites = None
+ packages = None
+ for o,v in opts:
+ if o == "-s":
+ suites = v.split(',')
+ elif o == "-p":
+ packages = v.split(',')
+ a = Archive(Conf.archive_root)
# just for now until development stablizes
#os.system("rm -rf "+Conf.output_dir)
#os.mkdir(Conf.output_dir)
print a
master_index = SourcePackageIndex()
- for s in a.suites():
+ for s in a.suites(filter=suites):
print "suite: ",s
for c in a.components(s):
print "\tcomponent:",c
- for p in a.sourcepackages(s, c):
+ for p in a.sourcepackages(s, c, filter=packages):
print "\t\tpackage:",p
- #PackageVersWriter(p, s)
+ PackageVersWriter(p, s)
master_index.ins(p,s)
os.system("cp -a "+Conf.static_dir+"/* "+Conf.output_dir)
diff --git a/patchtracker/SourceArchive.py b/patchtracker/SourceArchive.py
index abeabbb..5afcd10 100755
--- a/patchtracker/SourceArchive.py
+++ b/patchtracker/SourceArchive.py
@@ -15,9 +15,16 @@ class Archive:
self.root = dir
self.distsdir = os.sep.join([dir, "dists"])
- def suites(self):
+ def suites(self, filter=None):
for s in os.listdir(self.distsdir):
- yield s
+ if not filter:
+ yield s
+ else:
+ try:
+ filter.index(s)
+ yield s
+ except:
+ pass
def components(self, suite):
f = file(self.distsdir + os.sep + os.sep.join([suite, "Release"]))
@@ -25,10 +32,17 @@ class Archive:
for comp in rel['Components'].split(' '):
yield comp
- def sourcepackages(self, suite, component):
+ def sourcepackages(self, suite, component, filter=None):
sfile=os.sep.join([self.distsdir,suite,component,"/source/Sources.gz"])
for ent in deb822.Sources.iter_paragraphs(GzipFile(sfile)):
- yield SourcePackage(ent)
+ if not filter:
+ yield SourcePackage(ent)
+ else:
+ try:
+ filter.index(ent['Package'])
+ yield SourcePackage(ent)
+ except:
+ pass
def __str__(self):
return "Archive rooted at "+self.root