]> git.decadent.org.uk Git - dak.git/blob - contrib/fix.b
Remove versions for unreleased suites, since they're not released yet :)Add "Tree...
[dak.git] / contrib / fix.b
1 #!/usr/bin/env python
2
3 # Fix for bug in katie where dsc_files was initialized from changes and not dsc
4 # Copyright (C) 2000  James Troup <james@nocrew.org>
5 # $Id: fix.b,v 1.1 2000-12-19 17:23:03 troup Exp $
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21 # "Look around... leaves are brown... and the sky is hazy shade of winter,
22 #  Look around... leaves are brown... there's a patch of snow on the ground."
23 #                                         -- Simon & Garfunkel / 'A Hazy Shade'
24
25 ################################################################################
26
27 import pg, sys, os, string, stat, re
28 import utils, db_access
29 import apt_pkg;
30
31 ################################################################################
32
33 Cnf = None;
34 projectB = None;
35
36 bad_arch = re.compile(r'/binary-(hppa|mips|mipsel|sh|hurd-i386)/');
37
38 ################################################################################
39
40 def main ():
41     global Cnf, projectB;
42
43     apt_pkg.init();
44     
45     Cnf = apt_pkg.newConfiguration();
46     apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
47
48     Arguments = [('d',"debug","Claire::Options::Debug", "IntVal"),
49                  ('h',"help","Claire::Options::Help"),
50                  ('v',"version","Claire::Options::Version")];
51
52     apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
53
54     projectB = pg.connect('projectb', 'localhost');
55
56     db_access.init(Cnf, projectB);
57
58     file = utils.open_file('x', 'r');
59     for line in file.readlines():
60         if string.find(line, '/binary-') != -1:
61             if bad_arch.search(line) != None:
62                 new_line = string.replace(line, 'woody/', 'sid/');
63                 if new_line == line:
64                     print line;
65                     sys.exit(2);
66                 line = new_line;
67         sys.stdout.write(line);
68
69 #######################################################################################
70
71 if __name__ == '__main__':
72     main()
73