]> git.donarmstrong.com Git - dak.git/blobdiff - dak/admin.py
Drop unique .changes name requirement and allow ftpteam to forget seen files.
[dak.git] / dak / admin.py
index da8669895f345044ef5430f27dccfaa192c7bf13..43e20ecfe9209b6f87c2237e8a620f650740618a 100755 (executable)
@@ -24,6 +24,7 @@ import sys
 import apt_pkg
 
 import daklib.archive
+import daklib.gpg
 
 from daklib import utils
 from daklib.dbconn import *
@@ -143,6 +144,8 @@ Perform administrative work on the dak database.
      change-component SUITE COMPONENT binary BINARY...
          Move source or binary packages to a different component by copying
          associated files and changing the overrides.
+
+  forget-signature FILE:    forget that we saw FILE
 """
     sys.exit(exit_code)
 
@@ -927,6 +930,26 @@ dispatch['change-component'] = change_component
 
 ################################################################################
 
+def forget_signature(args):
+    filename = args[1]
+    with open(filename, 'r') as fh:
+        data = fh.read()
+
+    session = DBConn().session()
+    keyrings = [ k.keyring_name for k in session.query(Keyring).filter_by(active=True).order_by(Keyring.priority) ]
+    signed_file = daklib.gpg.SignedFile(data, keyrings)
+    history = SignatureHistory.from_signed_file(signed_file).query(session)
+    if history is not None:
+        session.delete(history)
+        session.commit()
+    else:
+        print "Signature was not known to dak."
+    session.rollback()
+
+dispatch['forget-signature'] = forget_signature
+
+################################################################################
+
 def main():
     """Perform administrative work on the dak database"""
     global dryrun