]> git.decadent.org.uk Git - dak.git/blob - contrib/fix.2
Initial revision
[dak.git] / contrib / fix.2
1 #!/usr/bin/env python
2
3 import commands, os, string, sys
4 import apt_inst, apt_pkg
5 import utils
6
7 Cnf = None
8
9 def main():
10     global Cnf
11     
12     apt_pkg.init();
13     
14     Cnf = apt_pkg.newConfiguration();
15     apt_pkg.ReadConfigFileISC(Cnf,'/home/troup/katie/katie.conf');
16
17     Arguments = [];
18     
19     dsc_files = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
20
21     for dsc_file in dsc_files:
22         dsc = utils.parse_changes(dsc_file);
23         files = utils.build_file_list(dsc, 1);
24         for file in files.keys():
25             if not os.path.exists(file):
26                 (result, output) = commands.getstatusoutput("locate %s | grep /org/ftp.debian.org/ftp/dists/potato/" % (file));
27                 if (result != 0):
28                     print "%s: can't find '%s'." % (dsc_file, file);
29                     continue;
30                 output = string.replace(output, "/org/ftp.debian.org/ftp/dists/potato/", "../potato/");
31                 print "symlinking '%s' to '%s'." % (output, file);
32                 os.symlink(output, file);
33
34 if __name__ == '__main__':
35     main()
36