]> git.decadent.org.uk Git - dak.git/blob - ashley
update for 2.2r7
[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.5 2002-05-10 00:24:23 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         arg = utils.validate_changes_file_arg(arg);
29         k.pkg.changes_file = arg;
30         print "%s:" % (arg);
31         k.init_vars();
32         k.update_vars();
33
34         changes = k.pkg.changes;
35         print " Changes:";
36         # Mandatory changes fields
37         for i in [ "source", "version", "maintainer", "urgency", "changedby822", "changedbyname", "maintainername", "maintaineremail", "fingerprint" ]:
38             print "  %s: %s" % (string.capitalize(i), changes[i]);
39             del changes[i];
40         # Mandatory changes lists
41         for i in [ "distribution", "architecture", "closes" ]:
42             print "  %s: %s" % (string.capitalize(i), string.join(changes[i].keys()));
43             del changes[i];
44         # Optional changes fields
45         for i in [ "changed-by", "maintainer822", "filecontents", "format" ]:
46             if changes.has_key(i):
47                 print "  %s: %s" % (string.capitalize(i), changes[i]);
48                 del changes[i];
49         print;
50         if changes:
51             utils.warn("changes still has following unrecognised keys: %s" % (changes.keys()));
52
53         dsc = k.pkg.dsc;
54         print " Dsc:";
55         for i in [ "source", "version", "maintainer", "fingerprint", "uploaders" ]:
56             if dsc.has_key(i):
57                 print "  %s: %s" % (string.capitalize(i), dsc[i]);
58                 del dsc[i];
59         print;
60         if dsc:
61             utils.warn("dsc still has following unrecognised keys: %s" % (dsc.keys()));
62
63         files = k.pkg.files;
64         print " Files:"
65         for file in files.keys():
66             print "  %s:" % (file);
67             for i in [ "package", "version", "architecture", "type", "size",
68                        "md5sum", "component", "location id", "source package",
69                        "source version", "maintainer", "dbtype", "files id",
70                        "new", "section", "priority" ]:
71                 if files[file].has_key(i):
72                     print "   %s: %s" % (string.capitalize(i), files[file][i]);
73                     del files[file][i];
74             if files[file]:
75                 utils.warn("files[%s] still has following unrecognised keys: %s" % (file, files[file].keys()));
76         print;
77
78         dsc_files = k.pkg.dsc_files;
79         print " Dsc Files:";
80         for file in dsc_files.keys():
81             print "  %s:" % (file);
82             # Mandatory fields
83             for i in [ "size", "md5sum" ]:
84                 print "   %s: %s" % (string.capitalize(i), dsc_files[file][i]);
85                 del dsc_files[file][i];
86             # Optional fields
87             for i in [ "files id" ]:
88                 if dsc_files[file].has_key(i):
89                     print "   %s: %s" % (string.capitalize(i), dsc_files[file][i]);
90                     del dsc_files[file][i];
91             if dsc_files[file]:
92                 utils.warn("dsc_files[%s] still has following unrecognised keys: %s" % (file, dsc_files[file].keys()));
93
94
95 if __name__ == '__main__':
96     main()
97