]> git.decadent.org.uk Git - dak.git/blobdiff - ashley
2005-01-14 Anthony Towns <ajt@debian.org> * kelly: when UNACCEPTing, don't double...
[dak.git] / ashley
diff --git a/ashley b/ashley
index 12b860a63f68865cb904ce2f046d28ba283b1301..e832851f83a97204e97b97db2d6f5a320748b082 100755 (executable)
--- a/ashley
+++ b/ashley
@@ -1,8 +1,8 @@
 #!/usr/bin/env python
 
 # Dump variables from a .katie file to stdout
-# Copyright (C) 2001, 2002  James Troup <james@nocrew.org>
-# $Id: ashley,v 1.4 2002-05-08 11:08:45 troup Exp $
+# Copyright (C) 2001, 2002, 2004  James Troup <james@nocrew.org>
+# $Id: ashley,v 1.11 2004-11-27 16:05:12 troup Exp $
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-import string, sys;
+################################################################################
+
+# <elmo> ooooooooooooooohhhhhhhhhhhhhhhhhhhhhhhhh            dddddddddeeeeeeeaaaaaaaarrrrrrrrrrr
+# <elmo> iiiiiiiiiiiii          tttttttttthhhhhhhhiiiiiiiiiiiinnnnnnnnnkkkkkkkkkkkkk              iiiiiiiiiiiiii       mmmmmmmmmmeeeeeeeesssssssssssssssseeeeeeeddd           uuuupppppppppppp       ttttttttthhhhhhhheeeeeeee          xxxxxxxssssssseeeeeeeeettttttttttttt             aaaaaaaarrrrrrrggggggsssssssss
+#
+# ['xset r rate 30 250' bad, mmkay]
+
+################################################################################
+
+import sys;
 import katie, utils;
+import apt_pkg;
+
+
+################################################################################
+
+def usage(exit_code=0):
+    print """Usage: ashley FILE...
+Dumps the info in .katie FILE(s).
+
+  -h, --help                show this help and exit."""
+    sys.exit(exit_code)
+
+################################################################################
 
 def main():
     Cnf = utils.get_conf()
+    Arguments = [('h',"help","Ashley::Options::Help")];
+    for i in [ "help" ]:
+       if not Cnf.has_key("Ashley::Options::%s" % (i)):
+           Cnf["Ashley::Options::%s" % (i)] = "";
+
+    apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv);
+
+    Options = Cnf.SubTree("Ashley::Options")
+    if Options["Help"]:
+       usage();
+
     k = katie.Katie(Cnf);
     for arg in sys.argv[1:]:
-        if arg[-6:] == ".katie":
-            arg = arg[:-6]+".changes";
-        if arg[-8:] != ".changes":
-            utils.warn("Skipping '%s', unknown file type." % (arg));
-            continue;
+        arg = utils.validate_changes_file_arg(arg,require_changes=-1);
         k.pkg.changes_file = arg;
         print "%s:" % (arg);
        k.init_vars();
@@ -38,17 +67,20 @@ def main():
         changes = k.pkg.changes;
         print " Changes:";
         # Mandatory changes fields
-        for i in [ "source", "version", "maintainer", "urgency", "changedby822", "changedbyname", "maintainername", "maintaineremail", "fingerprint" ]:
-            print "  %s: %s" % (string.capitalize(i), changes[i]);
+        for i in [ "source", "version", "maintainer", "urgency", "changedby822",
+                   "changedby2047", "changedbyname", "maintainer822",
+                   "maintainer2047", "maintainername", "maintaineremail",
+                   "fingerprint", "changes" ]:
+            print "  %s: %s" % (i.capitalize(), changes[i]);
             del changes[i];
         # Mandatory changes lists
         for i in [ "distribution", "architecture", "closes" ]:
-            print "  %s: %s" % (string.capitalize(i), string.join(changes[i].keys()));
+            print "  %s: %s" % (i.capitalize(), " ".join(changes[i].keys()));
             del changes[i];
         # Optional changes fields
-        for i in [ "changed-by", "maintainer822", "filecontents", "format" ]:
+        for i in [ "changed-by", "filecontents", "format" ]:
             if changes.has_key(i):
-                print "  %s: %s" % (string.capitalize(i), changes[i]);
+                print "  %s: %s" % (i.capitalize(), changes[i]);
                 del changes[i];
         print;
         if changes:
@@ -56,9 +88,10 @@ def main():
 
         dsc = k.pkg.dsc;
         print " Dsc:";
-        for i in [ "source", "version", "maintainer", "fingerprint", "uploaders" ]:
+        for i in [ "source", "version", "maintainer", "fingerprint", "uploaders",
+                   "bts changelog" ]:
             if dsc.has_key(i):
-                print "  %s: %s" % (string.capitalize(i), dsc[i]);
+                print "  %s: %s" % (i.capitalize(), dsc[i]);
                 del dsc[i];
         print;
         if dsc:
@@ -71,9 +104,9 @@ def main():
             for i in [ "package", "version", "architecture", "type", "size",
                        "md5sum", "component", "location id", "source package",
                        "source version", "maintainer", "dbtype", "files id",
-                       "new", "section", "priority" ]:
+                       "new", "section", "priority", "pool name" ]:
                 if files[file].has_key(i):
-                    print "   %s: %s" % (string.capitalize(i), files[file][i]);
+                    print "   %s: %s" % (i.capitalize(), files[file][i]);
                     del files[file][i];
             if files[file]:
                 utils.warn("files[%s] still has following unrecognised keys: %s" % (file, files[file].keys()));
@@ -85,16 +118,17 @@ def main():
             print "  %s:" % (file);
             # Mandatory fields
             for i in [ "size", "md5sum" ]:
-                print "   %s: %s" % (string.capitalize(i), dsc_files[file][i]);
+                print "   %s: %s" % (i.capitalize(), dsc_files[file][i]);
                 del dsc_files[file][i];
             # Optional fields
             for i in [ "files id" ]:
                 if dsc_files[file].has_key(i):
-                    print "   %s: %s" % (string.capitalize(i), dsc_files[file][i]);
+                    print "   %s: %s" % (i.capitalize(), dsc_files[file][i]);
                     del dsc_files[file][i];
             if dsc_files[file]:
                 utils.warn("dsc_files[%s] still has following unrecognised keys: %s" % (file, dsc_files[file].keys()));
 
+################################################################################
 
 if __name__ == '__main__':
     main()