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