X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Farchive.py;h=ca58da87a2858917fda4387173f54fde3796d396;hb=10e1a17a6c7c0dbfc3a7b20f37a23ee153b25b66;hp=7243f31a884f36684044a767f19369a06b263a2e;hpb=1934d926546cb051b6be97a7d1de53b1473ec962;p=dak.git diff --git a/daklib/archive.py b/daklib/archive.py index 7243f31a..ca58da87 100644 --- a/daklib/archive.py +++ b/daklib/archive.py @@ -33,6 +33,7 @@ import os import shutil import subprocess from sqlalchemy.orm.exc import NoResultFound +import sqlalchemy.exc import tempfile import traceback @@ -85,7 +86,7 @@ class ArchiveTransaction(object): 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 @@ -335,6 +336,8 @@ class ArchiveTransaction(object): db_source.suites.append(suite) if not created: + for f in db_source.srcfiles: + self._copy_file(f.poolfile, archive, component, allow_tainted=allow_tainted) return db_source ### Now add remaining files and copy them to the archive. @@ -752,7 +755,7 @@ class ArchiveUpload(object): 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 @@ -1002,8 +1005,11 @@ class ArchiveUpload(object): 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