5 #from debian_bundle import deb822
9 def check_source(ok, f, fw):
11 pkg = apt_pkg.ParseTagFile(f)
13 if pkg.Section['Section'].startswith('non-free'):
14 if pkg.Section.get('Autobuild') != 'yes': continue
15 if pkg.Section['Package'] not in ok: continue
16 ret += [pkg.Section['Package']]
17 fw.write(str(pkg.Section))
23 def check_binary(ok, f, fw):
24 pkg = apt_pkg.ParseTagFile(f)
26 if pkg.Section.get('Source', pkg.Section.get('Package')).split(" ")[0] not in ok: continue
27 fw.write(str(pkg.Section))
32 def outfile(name, file):
33 #return open(dir + "/" + os.path.basename(file), "w")
34 #return open(file + name, "w")
35 if file.endswith(name): return open(file[:-len(name)], "w")
38 if len(sys.argv) <= 4:
39 print "Error - too few args"
43 oklist = [ x[:-1].split(' ')[0] for x in open(sys.argv[2]) ]
44 okpkgs = check_source(oklist, open(sys.argv[3]), outfile(name, sys.argv[3]))
45 for file in sys.argv[4:]:
46 check_binary(okpkgs, open(file), outfile(name, file))
48 if __name__ == '__main__':