]> git.decadent.org.uk Git - dak.git/blob - contrib/hack.1
sync
[dak.git] / contrib / hack.1
1 #!/usr/bin/env python
2
3 # Quick hack to import override files
4 # Copyright (C) 2000  James Troup <james@nocrew.org>
5 # $Id: hack.1,v 1.2 2001-01-16 21:52:37 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 ################################################################################
22
23 import os, pg, sys, string
24 import utils, db_access
25 import apt_pkg;
26
27 ################################################################################
28
29 Cnf = None;
30 projectB = None;
31
32 ################################################################################
33
34 def main ():
35     global Cnf, projectB;
36
37     apt_pkg.init();
38     
39     Cnf = apt_pkg.newConfiguration();
40     apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
41     Arguments = [('D',"debug","Alyson::Options::Debug", "IntVal"),
42                  ('h',"help","Alyson::Options::Help"),
43                  ('v',"version","Alyson::Options::Version")];
44     apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
45
46     projectB = pg.connect('projectb', 'localhost');
47     db_access.init(Cnf, projectB);
48
49     for filename in os.listdir('.'):
50         if not os.path.isfile(filename) or filename[:9] != 'override.':
51             continue;
52         x = string.split(filename, '.')
53         suite = x[1];
54         type = "deb";
55         if suite == "experimental":
56             continue;
57         else:
58             component = x[2];
59             if suite == "sid":
60                 suite = "unstable";
61             elif suite == "potato":
62                 suite = "stable";
63             else:
64                 print "say what?";
65                 sys.exit(3);
66             if len(x) == 4:
67                 type = x[3];
68                 if type == "debian-installer":
69                     type = "udeb";
70                 elif type == "src":
71                     type = "dsc";
72                 else:
73                     print "say WHAT?";
74                     sys.exit(4);
75         print "cat %s | natalie.py --set --suite=%s --component=%s --type=%s" % (filename, suite, component, type);
76
77 #######################################################################################
78
79 if __name__ == '__main__':
80     main()
81