X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=daklib%2Fdbconn.py;h=7add55ff61eafbdded2aa3c8887c75f9df474630;hb=f0c875ddc69f384bf2600fa342fbac30dc82fda7;hp=0f4d4ede271627e21d8536e2296d9741eb1255d8;hpb=0b38b655a1f91653b66589e43880cea0d1b74157;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 0f4d4ede..7add55ff 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -1248,19 +1248,19 @@ __all__.append('KeyringACLMap') ################################################################################ -class KnownChange(object): +class DBChange(object): def __init__(self, *args, **kwargs): pass def __repr__(self): - return '' % self.changesname + return '' % 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') ################################################################################ @@ -2499,6 +2499,7 @@ class DBConn(Singleton): self.tbl_content_file_paths = Table('content_file_paths', self.db_meta, autoload=True) self.tbl_changes_pending_binary = Table('changes_pending_binaries', self.db_meta, autoload=True) self.tbl_changes_pending_files = Table('changes_pending_files', self.db_meta, autoload=True) + self.tbl_changes_pending_files_map = Table('changes_pending_files_map', self.db_meta, autoload=True) self.tbl_changes_pending_source = Table('changes_pending_source', self.db_meta, autoload=True) self.tbl_changes_pending_source_files = Table('changes_pending_source_files', self.db_meta, autoload=True) self.tbl_changes_pool_files = Table('changes_pool_files', self.db_meta, autoload=True) @@ -2506,7 +2507,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,12 +2612,18 @@ 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"), - files = relation(ChangePendingFile, backref="changesfile"))) + files = relation(ChangePendingFile, + secondary=self.tbl_changes_pending_files_map, + backref="changesfile"), + in_queue_id = self.tbl_changes.c.in_queue, + in_queue = relation(PolicyQueue, + primaryjoin=(self.tbl_changes.c.in_queue==self.tbl_policy_queue.c.id)), + approved_for_id = self.tbl_changes.c.approved_for)) mapper(ChangePendingBinary, self.tbl_changes_pending_binary, properties = dict(change_pending_binary_id = self.tbl_changes_pending_binary.c.id)) @@ -2626,7 +2633,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, @@ -2635,7 +2642,6 @@ class DBConn(Singleton): source_files = relation(ChangePendingFile, secondary=self.tbl_changes_pending_source_files, backref="pending_sources"))) - mapper(KeyringACLMap, self.tbl_keyring_acl_map, properties = dict(keyring_acl_map_id = self.tbl_keyring_acl_map.c.id, keyring = relation(Keyring, backref="keyring_acl_map"),