3 # Dump variables from a .dak file to stdout
4 # Copyright (C) 2001, 2002, 2004, 2006 James Troup <james@nocrew.org>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 ################################################################################
22 # <elmo> ooooooooooooooohhhhhhhhhhhhhhhhhhhhhhhhh dddddddddeeeeeeeaaaaaaaarrrrrrrrrrr
23 # <elmo> iiiiiiiiiiiii tttttttttthhhhhhhhiiiiiiiiiiiinnnnnnnnnkkkkkkkkkkkkk iiiiiiiiiiiiii mmmmmmmmmmeeeeeeeesssssssssssssssseeeeeeeddd uuuupppppppppppp ttttttttthhhhhhhheeeeeeee xxxxxxxssssssseeeeeeeeettttttttttttt aaaaaaaarrrrrrrggggggsssssssss
25 # ['xset r rate 30 250' bad, mmkay]
27 ################################################################################
31 from daklib import queue
32 from daklib import utils
34 ################################################################################
36 def usage(exit_code=0):
37 print """Usage: dak decode-dot-dak FILE...
38 Dumps the info in .dak FILE(s).
40 -h, --help show this help and exit."""
43 ################################################################################
46 Cnf = utils.get_conf()
47 Arguments = [('h',"help","Decode-Dot-Dak::Options::Help")]
49 if not Cnf.has_key("Decode-Dot-Dak::Options::%s" % (i)):
50 Cnf["Decode-Dot-Dak::Options::%s" % (i)] = ""
52 apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
54 Options = Cnf.SubTree("Decode-Dot-Dak::Options")
59 for arg in sys.argv[1:]:
60 arg = utils.validate_changes_file_arg(arg,require_changes=-1)
61 k.pkg.changes_file = arg
66 changes = k.pkg.changes
68 # Mandatory changes fields
69 for i in [ "source", "version", "maintainer", "urgency", "changedby822",
70 "changedby2047", "changedbyname", "maintainer822",
71 "maintainer2047", "maintainername", "maintaineremail",
72 "fingerprint", "changes" ]:
73 print " %s: %s" % (i.capitalize(), changes[i])
75 # Mandatory changes lists
76 for i in [ "distribution", "architecture", "closes" ]:
77 print " %s: %s" % (i.capitalize(), " ".join(changes[i].keys()))
79 # Optional changes fields
80 for i in [ "changed-by", "filecontents", "format", "adv id" ]:
81 if changes.has_key(i):
82 print " %s: %s" % (i.capitalize(), changes[i])
86 utils.warn("changes still has following unrecognised keys: %s" % (changes.keys()))
90 for i in [ "source", "version", "maintainer", "fingerprint", "uploaders",
93 print " %s: %s" % (i.capitalize(), dsc[i])
97 utils.warn("dsc still has following unrecognised keys: %s" % (dsc.keys()))
101 for f in files.keys():
103 for i in [ "package", "version", "architecture", "type", "size",
104 "md5sum", "sha1sum", "sha256sum", "component", "location id",
105 "source package", "source version", "maintainer", "dbtype",
106 "files id", "new", "section", "priority", "pool name" ]:
107 if files[f].has_key(i):
108 print " %s: %s" % (i.capitalize(), files[f][i])
111 utils.warn("files[%s] still has following unrecognised keys: %s" % (f, files[f].keys()))
114 dsc_files = k.pkg.dsc_files
116 for f in dsc_files.keys():
119 for i in [ "size", "md5sum" ]:
120 print " %s: %s" % (i.capitalize(), dsc_files[f][i])
123 for i in [ "files id" ]:
124 if dsc_files[f].has_key(i):
125 print " %s: %s" % (i.capitalize(), dsc_files[f][i])
128 utils.warn("dsc_files[%s] still has following unrecognised keys: %s" % (f, dsc_files[f].keys()))
130 ################################################################################
132 if __name__ == '__main__':