X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=contrib%2Ffix.6;fp=contrib%2Ffix.6;h=0000000000000000000000000000000000000000;hb=0b523c435c01ba9f4c2fd258baabb792546b7836;hp=6a3c25fe5adb22e4de4a86755bb6a023436c895c;hpb=8d194d3676a27055a8a5f35a53a162334a090d26;p=dak.git diff --git a/contrib/fix.6 b/contrib/fix.6 deleted file mode 100755 index 6a3c25fe..00000000 --- a/contrib/fix.6 +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python - -import pg, string, os, shutil -import utils -import apt_pkg - -def move(src, dest): - if os.path.exists(dest): - print 'overwrite `'+dest+'\'? ', - yn = utils.our_raw_input() - if yn != 'Y' and yn != 'y': - return - print src + ' -> ' + dest - shutil.copyfile (src, dest) - os.unlink (src) - -def main(): - projectB = pg.connect('projectb', 'localhost') - - apt_pkg.init(); - - suite = "unstable"; - architecture = "i386"; - -# too slow to run every time -# "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;" - - borked = utils.open_file('broken', 'r') - for line in borked.readlines(): - package = string.strip(line[:-1]) - - #print "=========" - #print package - 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)) - entries = q.getresult() - version = {} - filename = "" - for entry in entries: - version[entry[1]] = entry[0] - if entry[1] == "all": - filename = entry[2] + entry[3] - if not version.has_key(architecture) or not version.has_key("all"): - #print "SKIPPING" - continue - if apt_pkg.VersionCompare(version[architecture], version["all"]) != 1: - #print architecture+" too new... SKIPPING" - continue - #print " "+repr(version) - if os.path.exists(filename): - if os.path.islink(filename): - print "FIXING: unlinking %s" % (filename); - os.unlink(filename); - else: - print "FIXING: moving %s to /home/troup/removed-from-ftp/foad/" % (filename); - move(filename, "/home/troup/removed-from-ftp/foad/%s" % (os.path.basename(filename))); - -if __name__ == '__main__': - main() -