]> err.no Git - dak/commitdiff
rename known_changes
authorMark Hymers <mhy@debian.org>
Sat, 31 Oct 2009 09:44:09 +0000 (09:44 +0000)
committerMark Hymers <mhy@debian.org>
Sat, 31 Oct 2009 09:44:09 +0000 (09:44 +0000)
Signed-off-by: Mark Hymers <mhy@debian.org>
dak/dakdb/update22.py
dak/import_known_changes.py
daklib/changes.py
daklib/dbconn.py
daklib/queue.py

index 758430c10f65231778102748beec6b72363696e5..e51e90ab436b0045525003d355ebd70b1225965f 100755 (executable)
@@ -198,6 +198,9 @@ def do_update(self):
         print "Getting rid of old queue table"
         c.execute("""DROP TABLE queue""")
 
+        print "Moving known_changes table"
+        c.execute("""ALTER TABLE known_changes RENAME TO changes""")
+
         print "Sorting out permissions"
 
         for t in ['build_queue', 'policy_queue', 'build_queue_files',
index cdb1d3afd4a150bd8d59f0676a16f8fc697cef71..c8d5bf96c921a575bc738b9fec24fc6ee08447f3 100755 (executable)
@@ -32,7 +32,7 @@ import sys
 import os
 import logging
 import threading
-from daklib.dbconn import DBConn,get_knownchange
+from daklib.dbconn import DBConn, get_dbchange
 from daklib.config import Config
 import apt_pkg
 from daklib.dak_exceptions import DBUpdateError, InvalidDscError, ChangesUnicodeError
@@ -218,7 +218,7 @@ class ChangesGenerator(threading.Thread):
                                 continue
                             count += 1
 
-                            if not get_knownchange(changesfile, self.session):
+                            if not get_dbchange(changesfile, self.session):
                                 to_import = ChangesToImport(dirpath, changesfile, count)
                                 if self.die:
                                     return
index 596b74618b85bfd9adef2579f8724b528bfd6ca7..4ee73fbc6dda26a0c9de771e789f03a8998d4735 100755 (executable)
@@ -179,7 +179,7 @@ class Changes(object):
 
     @session_wrapper
     def remove_known_changes(self, session=None):
-        session.delete(get_knownchange(self.changes_file, session))
+        session.delete(get_dbchange(self.changes_file, session))
 
     def mark_missing_fields(self):
         """add "missing" in fields which we will require for the known_changes table"""
index 5b30fce99612469c74991d42fe3fbc5871ff532e..3c2b005e03871ffc7d0541b0d98ebcccaef9cd5b 100755 (executable)
@@ -1248,19 +1248,19 @@ __all__.append('KeyringACLMap')
 
 ################################################################################
 
-class KnownChange(object):
+class DBChange(object):
     def __init__(self, *args, **kwargs):
         pass
 
     def __repr__(self):
-        return '<KnownChange %s>' % self.changesname
+        return '<DBChange %s>' % self.changesname
 
-__all__.append('KnownChange')
+__all__.append('DBChange')
 
 @session_wrapper
-def get_knownchange(filename, session=None):
+def get_dbchange(filename, session=None):
     """
-    returns knownchange object for given C{filename}.
+    returns DBChange object for given C{filename}.
 
     @type archive: string
     @param archive: the name of the arhive
@@ -1273,14 +1273,14 @@ def get_knownchange(filename, session=None):
     @return: Archive object for the given name (None if not present)
 
     """
-    q = session.query(KnownChange).filter_by(changesname=filename)
+    q = session.query(DBChange).filter_by(changesname=filename)
 
     try:
         return q.one()
     except NoResultFound:
         return None
 
-__all__.append('get_knownchange')
+__all__.append('get_dbchange')
 
 ################################################################################
 
@@ -2506,7 +2506,7 @@ class DBConn(Singleton):
         self.tbl_files = Table('files', self.db_meta, autoload=True)
         self.tbl_fingerprint = Table('fingerprint', self.db_meta, autoload=True)
         self.tbl_keyrings = Table('keyrings', self.db_meta, autoload=True)
-        self.tbl_known_changes = Table('known_changes', self.db_meta, autoload=True)
+        self.tbl_changes = Table('changes', self.db_meta, autoload=True)
         self.tbl_keyring_acl_map = Table('keyring_acl_map', self.db_meta, autoload=True)
         self.tbl_location = Table('location', self.db_meta, autoload=True)
         self.tbl_maintainer = Table('maintainer', self.db_meta, autoload=True)
@@ -2611,8 +2611,8 @@ class DBConn(Singleton):
                properties = dict(keyring_name = self.tbl_keyrings.c.name,
                                  keyring_id = self.tbl_keyrings.c.id))
 
-        mapper(KnownChange, self.tbl_known_changes,
-               properties = dict(known_change_id = self.tbl_known_changes.c.id,
+        mapper(DBChange, self.tbl_changes,
+               properties = dict(change_id = self.tbl_changes.c.id,
                                  poolfiles = relation(PoolFile,
                                                       secondary=self.tbl_changes_pool_files,
                                                       backref="changeslinks"),
@@ -2626,7 +2626,7 @@ class DBConn(Singleton):
 
         mapper(ChangePendingSource, self.tbl_changes_pending_source,
                properties = dict(change_pending_source_id = self.tbl_changes_pending_source.c.id,
-                                 change = relation(KnownChange),
+                                 change = relation(DBChange),
                                  maintainer = relation(Maintainer,
                                                        primaryjoin=(self.tbl_changes_pending_source.c.maintainer_id==self.tbl_maintainer.c.id)),
                                  changedby = relation(Maintainer,
index effbb4e04be847177c0fddfb2df842c30dc9cb59..39dab347da5133fcbeb3da741b41dfc2b59da75c 100755 (executable)
@@ -441,7 +441,7 @@ class Upload(object):
         # Check there isn't already a changes file of the same name in one
         # of the queue directories.
         base_filename = os.path.basename(filename)
-        if get_knownchange(base_filename):
+        if get_dbchange(base_filename):
             self.rejects.append("%s: a file with this name already exists." % (base_filename))
 
         # Check the .changes is non-empty
@@ -822,7 +822,7 @@ class Upload(object):
         session = DBConn().session()
 
         try:
-            changes = session.query(KnownChange).filter_by(changesname=base_filename).one()
+            changes = session.query(DBChange).filter_by(changesname=base_filename).one()
             if not changes.approved_for:
                 self.rejects.append("%s file already known to dak" % base_filename)
         except NoResultFound, e: