]> git.decadent.org.uk Git - dak.git/commitdiff
shania bug fixing helper hack
authorJames Troup <james@nocrew.org>
Fri, 2 Mar 2001 02:32:48 +0000 (02:32 +0000)
committerJames Troup <james@nocrew.org>
Fri, 2 Mar 2001 02:32:48 +0000 (02:32 +0000)
contrib/hack.2 [new file with mode: 0755]

diff --git a/contrib/hack.2 b/contrib/hack.2
new file mode 100755 (executable)
index 0000000..15b44ba
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+import os, pg, stat, string, sys
+import utils, db_access
+import apt_pkg, apt_inst;
+
+
+def remove(file):
+    dir = '/org/ftp.debian.org/morgue/shania/'
+    if os.access(file,os.R_OK) == 0:
+        sys.stderr.write("E: can't read '%s' to remove it.\n" % (file));
+        return;
+    dest = dir + os.path.basename(file);
+    if os.path.exists(dest):
+        sys.stderr.write("E: '%s' already exists in '%s'.\n" % (file, dir));
+        return;
+    print "%s -> %s" % (file, dir);
+    utils.move(file, dest);
+    return;
+
+def main ():
+    for changes_file in sys.argv[1:]:
+        try:
+            changes = utils.parse_changes(changes_file, 0);
+        except:
+            sys.stderr.write("E: caught exception parsing '%s' [%s].\n" % (changes_file, sys.exc_type));
+            continue;
+        try:
+            files = utils.build_file_list(changes, "");
+        except:
+            sys.stderr.write("E: caught exception building file list for '%s' [%s].\n" % (changes_file, sys.exc_type));
+            continue;
+        for file in files.keys():
+            remove(file);
+        remove(changes_file);
+
+#######################################################################################
+
+if __name__ == '__main__':
+    main()
+