summaryrefslogtreecommitdiff
path: root/reprepro/conf/diffsonly.py
diff options
context:
space:
mode:
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")