summaryrefslogtreecommitdiff
path: root/reprepro/conf/diffsonly.py
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2008-06-02 23:28:08 +0200
committerSean Finney <seanius@debian.org>2008-06-02 23:28:08 +0200
commitb82fe9b393fbe80d2793ec2819bf3950ee57fddb (patch)
tree976b85824f20df29389cc97f411ea324214042d4 /reprepro/conf/diffsonly.py
parent1573f429f15ed722af7d368b051d388cf40baed7 (diff)
downloadpatch-tracker-b82fe9b393fbe80d2793ec2819bf3950ee57fddb.tar.gz
include new reprepro config for diffgz/dsc mirror
Diffstat (limited to 'reprepro/conf/diffsonly.py')
-rwxr-xr-xreprepro/conf/diffsonly.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/reprepro/conf/diffsonly.py b/reprepro/conf/diffsonly.py
new file mode 100755
index 0000000..e40e1aa
--- /dev/null
+++ b/reprepro/conf/diffsonly.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+
+from debian_bundle import deb822
+from gzip import GzipFile
+from fnmatch import fnmatch
+import sys
+
+if __name__ == '__main__':
+ try:
+ (prog,src,dst) = sys.argv
+ except ValueError:
+ print "usage: program <src> <dst>"
+ sys.exit(1)
+
+ inf = sys.argv[1]
+ slist = deb822.Sources.iter_paragraphs(GzipFile(inf))
+ outf = file(sys.argv[2], "w")
+ print "filtering %s for .diff.gz/.dsc files..."%(inf)
+ for ent in slist:
+ for k in ['Files','Checksums-Sha1','Checksums-Sha256']:
+ newfiles = []
+ if ent.has_key(k):
+ for f in ent[k]:
+ if fnmatch(f['name'], '*.diff.gz') or fnmatch(f['name'], '*.dsc'):
+ newfiles.append(f)
+ ent[k] = newfiles
+ outf.write(str(ent))
+ outf.write("\n")