From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RKNtX-0007it-EZ for garchives@archives.gentoo.org; Sun, 30 Oct 2011 05:25:19 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5F84521C024; Sun, 30 Oct 2011 05:25:12 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1E16321C024 for ; Sun, 30 Oct 2011 05:25:12 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7C2571B4017 for ; Sun, 30 Oct 2011 05:25:11 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id E3C2280042 for ; Sun, 30 Oct 2011 05:25:10 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <9347995ce3f657263e9216eed34a876a5c02c3d2.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/egencache X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 9347995ce3f657263e9216eed34a876a5c02c3d2 Date: Sun, 30 Oct 2011 05:25:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 7522c635f2054874be5615f44c1d95e2 commit: 9347995ce3f657263e9216eed34a876a5c02c3d2 Author: Zac Medico gentoo org> AuthorDate: Sun Oct 30 05:24:58 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Oct 30 05:24:58 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D9347995c egencache: tweak redundant write check condition We can use the raise_stat_collision attribute to determine when it is necessary to check for redundant writes. --- bin/egencache | 33 ++++++++++++++++----------------- 1 files changed, 16 insertions(+), 17 deletions(-) diff --git a/bin/egencache b/bin/egencache index afd2baa..02ef4bd 100755 --- a/bin/egencache +++ b/bin/egencache @@ -226,18 +226,15 @@ class GenCache(object): raise Exception("cache formats '%s' aren't supported" % (" ".join(conf.cache_formats),)) =20 - self._avoid_redundant_write =3D set() - from portage.cache.metadata import database as pms_database - for trg_cache in self._trg_caches: - if not isinstance(trg_cache, pms_database): - self._avoid_redundant_write.add(id(trg_cache)) - elif rsync: - trg_cache.raise_stat_collision =3D True - # Make _metadata_callback write this cache first, in case - # it raises a StatCollision and triggers mtime - # modification. - self._trg_caches =3D tuple([trg_cache] + - [x for x in self._trg_caches if x is not trg_cache]) + if rsync: + for trg_cache in self._trg_caches: + if hasattr(trg_cache, 'raise_stat_collision'): + trg_cache.raise_stat_collision =3D True + # Make _metadata_callback write this cache first, in case + # it raises a StatCollision and triggers mtime + # modification. + self._trg_caches =3D tuple([trg_cache] + + [x for x in self._trg_caches if x is not trg_cache]) =20 self._existing_nodes =3D set() =20 @@ -253,7 +250,7 @@ class GenCache(object): =20 def _write_cache(self, trg_cache, cpv, repo_path, metadata, ebuild_hash= ): =20 - if id(trg_cache) in self._avoid_redundant_write: + if not hasattr(trg_cache, 'raise_stat_collision'): # This cache does not avoid redundant writes automatically, # so check for an identical existing entry before writing. # This prevents unecessary disk writes and can also prevent @@ -285,10 +282,12 @@ class GenCache(object): # exception from _setitem() if they detect this type of stat # collision. These exceptions are handled by bumping the # mtime on the ebuild (and the corresponding cache entry). - # This type of cache must not be included in the above - # _avoid_redundant_write set, since __setitem__ must be - # called in order to detect the StatCollision (redundant - # writes will be avoided internally). See bug #139134. + # See bug #139134. It is convenient to include checks for + # redundant writes along with the interal StatCollision + # detection code, so for caches with the + # raise_stat_collision attribute, we do not need to + # explicitly check for redundant writes like we do for the + # other cache types above. max_mtime =3D sc.mtime for ec, ec_hash in metadata['_eclasses_'].items(): if max_mtime < ec_hash.mtime: