summaryrefslogtreecommitdiff
path: root/gen-patch-info.py
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-07-26 19:35:16 +0200
committerSean Finney <seanius@debian.org>2009-07-26 19:35:16 +0200
commit9d9c75b7666123273aeccd96248f1413c287b207 (patch)
tree3d575af86c751f43c389950626d9406446756b99 /gen-patch-info.py
parent214268f80d89d279be7fb046f7fa3bde048af793 (diff)
downloadpatch-tracker-9d9c75b7666123273aeccd96248f1413c287b207.tar.gz
initial support for PTS index file generation
a new option (-i) to ./gen-patch-info.py allows for generating a global "index" file with any and all information that the PTS might want from this system. The format is: { "index-version": N "packages": { "<pkg1>": { "url": url-for-all-versions "versions": { "<vers1>": { <various attributes> } } } } } index-version is a monotonically increasing version number. when the "schema" changes, this version is incremented. if we care enough, we can do a major-minor versioning scheme where BC breaks are differentiated from "new attribute" type changes by incrementing the major or minor versions, respectively.
Diffstat (limited to 'gen-patch-info.py')
-rwxr-xr-xgen-patch-info.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/gen-patch-info.py b/gen-patch-info.py
index 5d7d899..ef1621e 100755
--- a/gen-patch-info.py
+++ b/gen-patch-info.py
@@ -4,19 +4,23 @@
import os
import sys
import getopt
+import gzip
import errno
+import simplejson
import patchtracker.Conf as Conf
from patchtracker.SourceArchive import Archive, SourcePackage
from patchtracker.DB import PatchTrackerDB
+from patchtracker.PtsIndex import PtsIndexFile
if __name__ == '__main__':
db = PatchTrackerDB()
os.system("cheetah compile templates/skeleton")
- opts,args = getopt.getopt(sys.argv[1:], "as:p:")
+ opts,args = getopt.getopt(sys.argv[1:], "ais:p:")
suites = None
packages = None
update_archive = False
+ gen_pts_index = False
for o,v in opts:
if o == "-s":
suites = v.split(',')
@@ -24,6 +28,8 @@ if __name__ == '__main__':
packages = v.split(',')
elif o == "-a":
update_archive = True
+ elif o == "-i":
+ gen_pts_index = True
if update_archive:
os.system("env PYTHONPATH=%s reprepro -b %s --confdir reprepro/conf update"%
@@ -50,6 +56,12 @@ if __name__ == '__main__':
db.relateSourcePackage(name=p.name, version=p.version, suite=s,
component=c)
+ 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()
+
db.prune()
db.unmark()
db.finalize()