]> git.decadent.org.uk Git - dak.git/blobdiff - dak/dakdb/update20.py
update20 is closer to tested
[dak.git] / dak / dakdb / update20.py
index a666326cb3acb986891bcfee87c686b966d0d437..6a44dd316bc9948a35a3e38f18401abd5f876885 100755 (executable)
@@ -65,14 +65,14 @@ def check_signature (sig_filename, data_filename=""):
     # If we failed to parse the status-fd output, let's just whine and bail now
     if internal_error:
         warn("Couldn't parse signature")
-        return (None, rejects)
+        return None
 
     # usually one would check for bad things here. We, however, do not care.
 
     # Next check gpgv exited with a zero return code
     if exit_status:
         warn("Couldn't parse signature")
-        return (None, rejects)
+        return None
 
     # Sanity check the good stuff we expect
     if not keywords.has_key("VALIDSIG"):
@@ -84,7 +84,7 @@ def check_signature (sig_filename, data_filename=""):
         else:
             fingerprint = args[0]
 
-    return (fingerprint, [])
+    return fingerprint
 
 ################################################################################
 
@@ -105,6 +105,7 @@ def do_update(self):
                     distribution TEXT NOT NULL,
                     urgency TEXT NOT NULL,
                     maintainer TEXT NOT NULL,
+                    fingerprint TEXT NOT NULL,
                     changedby TEXT NOT NULL,
                     date TEXT NOT NULL,
                     UNIQUE (changesname)
@@ -135,8 +136,11 @@ def do_update(self):
                         try:
                             count += 1
                             print "Directory %s, file %7d, failures %3d. (%s)" % (dirpath[-10:], count, failure, changesfile)
-                            changes = parse_changes(os.path.join(dirpath, changesfile), signing_rules=-1)
-                            (changes["fingerprint"], _) = check_signature(os.path.join(dirpath, changesfile))
+                            changes = Changes()
+                            changesfile = os.path.join(dirpath, changesfile)
+                            changes.changes = parse_changes(changesfile, signing_rules=-1)
+                            changes.changes["fingerprint"], = check_signature(changesfile)
+                            changes.add_known_changes(directory)
                         except InvalidDscError, line:
                             warn("syntax error in .dsc file '%s', line %s." % (f, line))
                             failure += 1
@@ -144,8 +148,9 @@ def do_update(self):
                             warn("found invalid changes file, not properly utf-8 encoded")
                             failure += 1
 
-                        filetime = datetime.datetime.fromtimestamp(os.path.getctime(os.path.join(dirpath, changesfile)))
-                        c.execute("INSERT INTO known_changes(changesname, seen, source, binaries, architecture, version, distribution, urgency, maintainer, changedby, date) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" , [changesfile, filetime, changes["source"], changes["binary"], changes["architecture"], changes["version"], changes["distribution"], changes["urgency"], changes["maintainer"], changes["changed-by"], changes["date"]])
+
+        c.execute("GRANT ALL ON known_changes TO ftpmaster;")
+        c.execute("GRANT SELECT ON known_changes TO public;")
 
         c.execute("UPDATE config SET value = '20' WHERE name = 'db_revision'")
         self.db.commit()