From: Ansgar Burchardt <ansgar@debian.org>
Date: Tue, 7 Aug 2012 14:06:07 +0000 (+0200)
Subject: daklib/archive.py: check for source when copying binaries
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=25d2c2a5adf89a13412d48ae2908bf0a104a6799;p=dak.git

daklib/archive.py: check for source when copying binaries
---

diff --git a/daklib/archive.py b/daklib/archive.py
index 539a8d20..b96b9892 100644
--- a/daklib/archive.py
+++ b/daklib/archive.py
@@ -382,8 +382,14 @@ class ArchiveTransaction(object):
         if archive.tainted:
             allow_tainted = True
 
-        # make sure built-using packages are present in target archive
         filename = db_binary.poolfile.filename
+
+        # make sure source is present in target archive
+        db_source = db_binary.source
+        if session.query(ArchiveFile).filter_by(archive=archive, file=db_source.poolfile).first() is None:
+            raise ArchiveException('{0}: cannot copy to {1}: source is not present in target archive'.format(filename, suite.suite_name))
+
+        # make sure built-using packages are present in target archive
         for db_source in db_binary.extra_sources:
             self._ensure_extra_source_exists(filename, db_source, archive, extra_archives=extra_archives)