sha1sum TEXT NOT NULL,
sha256sum TEXT NOT NULL )""")
+ c.execute("""CREATE TABLE changes_pending_files_map (
+ file_id INT4 NOT NULL REFERENCES changes_pending_files (id),
+ change_id INT4 NOT NULL REFERENCES known_changes (id),
+
+ PRIMARY KEY (file_id, change_id))""")
+
c.execute("""CREATE TABLE changes_pending_source (
id SERIAL PRIMARY KEY,
change_id INT4 NOT NULL REFERENCES known_changes (id),
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)
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))
self.pkg.changes["chopversion"] = re_no_epoch.sub('', self.pkg.changes["version"])
self.pkg.changes["chopversion2"] = re_no_revision.sub('', self.pkg.changes["chopversion"])
- # 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_dbchange(base_filename):
- self.rejects.append("%s: a file with this name already exists." % (base_filename))
-
# Check the .changes is non-empty
if not self.pkg.files:
self.rejects.append("%s: nothing to do (Files field is empty)." % (base_filename))
session = DBConn().session()
try:
- changes = session.query(DBChange).filter_by(changesname=base_filename).one()
- if not changes.approved_for:
+ dbc = session.query(DBChange).filter_by(changesname=base_filename).one()
+ if dbc.in_queue is not None and dbc.in_queue.queue_name != 'unchecked':
self.rejects.append("%s file already known to dak" % base_filename)
except NoResultFound, e:
# not known, good