From e1a60e40eeed6c7d6e9f1730e90b767a8e4147a8 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Sun, 4 Nov 2012 16:51:49 +0100 Subject: [PATCH] dak/export_suite.py: take archive file for the archive we are exporting from --- dak/export_suite.py | 6 +++++- daklib/dbconn.py | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) 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 -- 2.39.2