]> git.decadent.org.uk Git - dak.git/blob - ashley
fix .katie handling
[dak.git] / ashley
1 #!/usr/bin/env python
2
3 # Dump variables from a .katie file to stdout
4 # Copyright (C) 2001, 2002  James Troup <james@nocrew.org>
5 # $Id: ashley,v 1.4 2002-05-08 11:08:45 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 import string, sys;
22 import katie, utils;
23
24 def main():
25     Cnf = utils.get_conf()
26     k = katie.Katie(Cnf);
27     for arg in sys.argv[1:]:
28         if arg[-6:] == ".katie":
29             arg = arg[:-6]+".changes";
30         if arg[-8:] != ".changes":
31             utils.warn("Skipping '%s', unknown file type." % (arg));
32             continue;
33         k.pkg.changes_file = arg;
34         print "%s:" % (arg);
35         k.init_vars();
36         k.update_vars();
37
38         changes = k.pkg.changes;
39         print " Changes:";
40         # Mandatory changes fields
41         for i in [ "source", "version", "maintainer", "urgency", "changedby822", "changedbyname", "maintainername", "maintaineremail", "fingerprint" ]:
42             print "  %s: %s" % (string.capitalize(i), changes[i]);
43             del changes[i];
44         # Mandatory changes lists
45         for i in [ "distribution", "architecture", "closes" ]:
46             print "  %s: %s" % (string.capitalize(i), string.join(changes[i].keys()));
47             del changes[i];
48         # Optional changes fields
49         for i in [ "changed-by", "maintainer822", "filecontents", "format" ]:
50             if changes.has_key(i):
51                 print "  %s: %s" % (string.capitalize(i), changes[i]);
52                 del changes[i];
53         print;
54         if changes:
55             utils.warn("changes still has following unrecognised keys: %s" % (changes.keys()));
56
57         dsc = k.pkg.dsc;
58         print " Dsc:";
59         for i in [ "source", "version", "maintainer", "fingerprint", "uploaders" ]:
60             if dsc.has_key(i):
61                 print "  %s: %s" % (string.capitalize(i), dsc[i]);
62                 del dsc[i];
63         print;
64         if dsc:
65             utils.warn("dsc still has following unrecognised keys: %s" % (dsc.keys()));
66
67         files = k.pkg.files;
68         print " Files:"
69         for file in files.keys():
70             print "  %s:" % (file);
71             for i in [ "package", "version", "architecture", "type", "size",
72                        "md5sum", "component", "location id", "source package",
73                        "source version", "maintainer", "dbtype", "files id",
74                        "new", "section", "priority" ]:
75                 if files[file].has_key(i):
76                     print "   %s: %s" % (string.capitalize(i), files[file][i]);
77                     del files[file][i];
78             if files[file]:
79                 utils.warn("files[%s] still has following unrecognised keys: %s" % (file, files[file].keys()));
80         print;
81
82         dsc_files = k.pkg.dsc_files;
83         print " Dsc Files:";
84         for file in dsc_files.keys():
85             print "  %s:" % (file);
86             # Mandatory fields
87             for i in [ "size", "md5sum" ]:
88                 print "   %s: %s" % (string.capitalize(i), dsc_files[file][i]);
89                 del dsc_files[file][i];
90             # Optional fields
91             for i in [ "files id" ]:
92                 if dsc_files[file].has_key(i):
93                     print "   %s: %s" % (string.capitalize(i), dsc_files[file][i]);
94                     del dsc_files[file][i];
95             if dsc_files[file]:
96                 utils.warn("dsc_files[%s] still has following unrecognised keys: %s" % (file, dsc_files[file].keys()));
97
98
99 if __name__ == '__main__':
100     main()
101