From: Ansgar Burchardt Date: Sun, 4 Nov 2012 15:51:49 +0000 (+0100) Subject: dak/export_suite.py: take archive file for the archive we are exporting from X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e1a60e40eeed6c7d6e9f1730e90b767a8e4147a8;p=dak.git dak/export_suite.py: take archive file for the archive we are exporting from --- diff --git a/dak/export_suite.py b/dak/export_suite.py index 03d11849..1c22f5e5 100644 --- a/dak/export_suite.py +++ b/dak/export_suite.py @@ -76,9 +76,13 @@ def main(argv=None): with FilesystemTransaction() as fs: for f in files: + af = session.query(ArchiveFile) \ + .join(ArchiveFile.component).join(ArchiveFile.file) \ + .filter(ArchiveFile.archive == suite.archive) \ + .filter(ArchiveFile.file == f).one() dst = os.path.join(directory, f.basename) if not os.path.exists(dst): - fs.copy(f.fullpath, dst, symlink=symlink) + fs.copy(af.path, dst, symlink=symlink) fs.commit() if __name__ == '__main__': diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 08765171..f2f8a902 100644 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -1030,7 +1030,9 @@ class PoolFile(ORMObject): @property def fullpath(self): session = DBConn().session().object_session(self) - af = session.query(ArchiveFile).join(Archive).filter(ArchiveFile.file == self).first() + af = session.query(ArchiveFile).join(Archive) \ + .filter(ArchiveFile.file == self) \ + .order_by(Archive.tainted.desc()).first() return af.path @property