]> git.decadent.org.uk Git - dak.git/blob - ashley
sync
[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.7 2002-10-16 02:47:32 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 # <elmo> ooooooooooooooohhhhhhhhhhhhhhhhhhhhhhhhh            dddddddddeeeeeeeaaaaaaaarrrrrrrrrrr
24 # <elmo> iiiiiiiiiiiii          tttttttttthhhhhhhhiiiiiiiiiiiinnnnnnnnnkkkkkkkkkkkkk              iiiiiiiiiiiiii       mmmmmmmmmmiiiiiiiisssssssssssssssseeeeeeeddd           uuuupppppppppppp       ttttttttthhhhhhhheeeeeeee          xxxxxxxssssssseeeeeeeeettttttttttttt             aaaaaaaarrrrrrrggggggsssssssss
25 #
26 # ['xset r rate 30 250' bad, mmkay]
27
28 ################################################################################
29
30 import sys;
31 import katie, utils;
32
33 def main():
34     Cnf = utils.get_conf()
35     k = katie.Katie(Cnf);
36     for arg in sys.argv[1:]:
37         arg = utils.validate_changes_file_arg(arg);
38         k.pkg.changes_file = arg;
39         print "%s:" % (arg);
40         k.init_vars();
41         k.update_vars();
42
43         changes = k.pkg.changes;
44         print " Changes:";
45         # Mandatory changes fields
46         for i in [ "source", "version", "maintainer", "urgency", "changedby822", "changedbyname", "maintainername", "maintaineremail", "fingerprint" ]:
47             print "  %s: %s" % (i.capitalize(), changes[i]);
48             del changes[i];
49         # Mandatory changes lists
50         for i in [ "distribution", "architecture", "closes" ]:
51             print "  %s: %s" % (i.capitalize(), " ".join(changes[i].keys()));
52             del changes[i];
53         # Optional changes fields
54         for i in [ "changed-by", "maintainer822", "filecontents", "format" ]:
55             if changes.has_key(i):
56                 print "  %s: %s" % (i.capitalize(), changes[i]);
57                 del changes[i];
58         print;
59         if changes:
60             utils.warn("changes still has following unrecognised keys: %s" % (changes.keys()));
61
62         dsc = k.pkg.dsc;
63         print " Dsc:";
64         for i in [ "source", "version", "maintainer", "fingerprint", "uploaders" ]:
65             if dsc.has_key(i):
66                 print "  %s: %s" % (i.capitalize(), dsc[i]);
67                 del dsc[i];
68         print;
69         if dsc:
70             utils.warn("dsc still has following unrecognised keys: %s" % (dsc.keys()));
71
72         files = k.pkg.files;
73         print " Files:"
74         for file in files.keys():
75             print "  %s:" % (file);
76             for i in [ "package", "version", "architecture", "type", "size",
77                        "md5sum", "component", "location id", "source package",
78                        "source version", "maintainer", "dbtype", "files id",
79                        "new", "section", "priority" ]:
80                 if files[file].has_key(i):
81                     print "   %s: %s" % (i.capitalize(), files[file][i]);
82                     del files[file][i];
83             if files[file]:
84                 utils.warn("files[%s] still has following unrecognised keys: %s" % (file, files[file].keys()));
85         print;
86
87         dsc_files = k.pkg.dsc_files;
88         print " Dsc Files:";
89         for file in dsc_files.keys():
90             print "  %s:" % (file);
91             # Mandatory fields
92             for i in [ "size", "md5sum" ]:
93                 print "   %s: %s" % (i.capitalize(), dsc_files[file][i]);
94                 del dsc_files[file][i];
95             # Optional fields
96             for i in [ "files id" ]:
97                 if dsc_files[file].has_key(i):
98                     print "   %s: %s" % (i.capitalize(), dsc_files[file][i]);
99                     del dsc_files[file][i];
100             if dsc_files[file]:
101                 utils.warn("dsc_files[%s] still has following unrecognised keys: %s" % (file, dsc_files[file].keys()));
102
103
104 if __name__ == '__main__':
105     main()
106