3 import pg, string, os, shutil
8 if os.path.exists(dest):
9 print 'overwrite `'+dest+'\'? ',
10 yn = utils.our_raw_input()
11 if yn != 'Y' and yn != 'y':
13 print src + ' -> ' + dest
14 shutil.copyfile (src, dest)
18 projectB = pg.connect('projectb', 'localhost')
23 architecture = "i386";
25 # too slow to run every time
26 # "select b.package from binaries b, architecture a where a.arch_string = 'all' and b.architecture = a.id INTERSECT select b.package from binaries b, architecture a where a.arch_string = 'i386' and b.architecture = a.id;"
28 borked = utils.open_file('broken', 'r')
29 for line in borked.readlines():
30 package = string.strip(line[:-1])
34 q = projectB.query("SELECT b.version, a.arch_string, l.path, b.filename FROM bin_associations ba, binaries b, architecture a, suite s, location l WHERE b.package = '%s' AND (a.arch_string = '%s' OR a.arch_string = 'all') AND s.suite_name = '%s' AND ba.bin = b.id AND ba.suite = s.id AND b.architecture = a.id AND l.id = b .location" % (package, architecture, suite))
35 entries = q.getresult()
39 version[entry[1]] = entry[0]
41 filename = entry[2] + entry[3]
42 if not version.has_key(architecture) or not version.has_key("all"):
45 if apt_pkg.VersionCompare(version[architecture], version["all"]) != 1:
46 #print architecture+" too new... SKIPPING"
48 #print " "+repr(version)
49 if os.path.exists(filename):
50 if os.path.islink(filename):
51 print "FIXING: unlinking %s" % (filename);
54 print "FIXING: moving %s to /home/troup/removed-from-ftp/foad/" % (filename);
55 move(filename, "/home/troup/removed-from-ftp/foad/%s" % (os.path.basename(filename)));
57 if __name__ == '__main__':