From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id BAF1D13800E for ; Wed, 8 Aug 2012 20:53:17 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 29D2DE04C7; Wed, 8 Aug 2012 20:52:57 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id E00E1E04C7 for ; Wed, 8 Aug 2012 20:52:56 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 446EE1B4022 for ; Wed, 8 Aug 2012 20:52:56 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D602CE5439 for ; Wed, 8 Aug 2012 20:52:54 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1344459105.e95a07267c7f642fdca2aca346ab4c12f46748bb.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/bintree.py X-VCS-Directories: pym/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: e95a07267c7f642fdca2aca346ab4c12f46748bb X-VCS-Branch: master Date: Wed, 8 Aug 2012 20:52:54 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 6de3b71a-1efc-4e45-a06c-c2bb6078f958 X-Archives-Hash: 3fe7210af3edcc602122ec7dfd24de9b commit: e95a07267c7f642fdca2aca346ab4c12f46748bb Author: Zac Medico gentoo org> AuthorDate: Wed Aug 8 20:34:15 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Aug 8 20:51:45 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e95a0726 bintree.inject(): write Packages.gz atomically --- pym/portage/dbapi/bintree.py | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 77fc0c4..8dd7aad 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -1193,13 +1193,16 @@ class binarytree(object): atime = mtime = long(pkgindex.header["TIMESTAMP"]) pkgindex_filename = os.path.join(self.pkgdir, "Packages") - output_files = [(atomic_ofstream(pkgindex_filename, mode="wb"), pkgindex_filename)] + output_files = [(atomic_ofstream(pkgindex_filename, mode="wb"), pkgindex_filename, None)] if "compress-index" in self.settings.features: gz_fname = pkgindex_filename + ".gz" - output_files.append((GzipFile(gz_fname, mode="wb"), gz_fname)) - for f, fname in output_files: + fileobj = atomic_ofstream(gz_fname, mode="wb") + output_files.append((GzipFile(filename='', mode="wb", fileobj=fileobj, mtime=mtime), gz_fname, fileobj)) + for f, fname, f_close in output_files: f.write(contents) f.close() + if f_close is not None: + f_close.close() # some seconds might have elapsed since TIMESTAMP os.utime(fname, (atime, mtime)) finally: