import shutil
import subprocess
from sqlalchemy.orm.exc import NoResultFound
+import sqlalchemy.exc
import tempfile
import traceback
Will not give an error when the file is already present.
@rtype: L{daklib.dbconn.PoolFile}
- @return: batabase object for the new file
+ @return: database object for the new file
"""
session = self.session
if self.changes.source is not None:
override = self._source_override(suite, self.changes.source)
if override is None:
- self.warnings.append('source:{0} is NEW.'.format(self.changes.source.control['Source']))
+ self.warnings.append('source:{0} is NEW.'.format(self.changes.source.dsc['Source']))
new = True
# Check if we reference a file only in a tainted archive
db_changes.changelog_id = changelog_id
db_changes.closes = self.changes.closed_bugs
- self.transaction.session.add(db_changes)
- self.transaction.session.flush()
+ try:
+ self.transaction.session.add(db_changes)
+ self.transaction.session.flush()
+ except sqlalchemy.exc.IntegrityError:
+ raise ArchiveException('{0} is already known.'.format(self.changes.filename))
return db_changes