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 <gentoo-commits+bounces-396786-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1RKD4h-0003Kx-Co
	for garchives@archives.gentoo.org; Sat, 29 Oct 2011 17:52:07 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id C1B3F21C0C9;
	Sat, 29 Oct 2011 17:51:59 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 8309421C0C9
	for <gentoo-commits@lists.gentoo.org>; Sat, 29 Oct 2011 17:51:59 +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 E95E21B4003
	for <gentoo-commits@lists.gentoo.org>; Sat, 29 Oct 2011 17:51:58 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id 1B94B80042
	for <gentoo-commits@lists.gentoo.org>; Sat, 29 Oct 2011 17:51:58 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <412f6cc18ea06987fda0c6e4c05aee5e6d1a2f08.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/
X-VCS-Repository: proj/portage
X-VCS-Files: pym/_emerge/actions.py
X-VCS-Directories: pym/_emerge/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: 412f6cc18ea06987fda0c6e4c05aee5e6d1a2f08
Date: Sat, 29 Oct 2011 17:51:58 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 
X-Archives-Hash: 23ad4355316b19d50ea5f092701b5f17

commit:     412f6cc18ea06987fda0c6e4c05aee5e6d1a2f08
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 29 17:48:30 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Oct 29 17:48:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3D412f6cc1

emerge --metadata: support md5-dict

This adds support to action_metadata() for use of arbitrary validation
methods, which were introduced in commit
2ed1cb53cc4158af08c22d466b15b9a9a7767212.

---
 pym/_emerge/actions.py |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index de5275d..610a6c4 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -5,6 +5,7 @@ from __future__ import print_function
=20
 import errno
 import logging
+import operator
 import platform
 import pwd
 import random
@@ -34,6 +35,7 @@ from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE=
_SET_CONFIG
 from portage.dbapi.dep_expand import dep_expand
 from portage.dbapi._expand_new_virt import expand_new_virt
 from portage.dep import Atom, extended_cp_match
+from portage.eclass_cache import hashed_path
 from portage.exception import InvalidAtom
 from portage.output import blue, bold, colorize, create_color_func, dark=
green, \
 	red, yellow
@@ -1719,6 +1721,13 @@ def action_metadata(settings, portdb, myopts, port=
trees=3DNone):
=20
 	for cp in cp_all:
 		for tree_data in porttrees_data:
+
+			src_chf =3D tree_data.src_db.validation_chf
+			src_chf_key =3D '_%s_' % src_chf
+			dest_chf =3D tree_data.dest_db.validation_chf
+			dest_chf_key =3D '_%s_' % dest_chf
+			dest_chf_getter =3D operator.attrgetter(dest_chf)
+
 			for cpv in portdb.cp_list(cp, mytree=3Dtree_data.path):
 				tree_data.valid_nodes.add(cpv)
 				try:
@@ -1726,6 +1735,11 @@ def action_metadata(settings, portdb, myopts, port=
trees=3DNone):
 				except (CacheError, KeyError):
 					continue
=20
+				ebuild_location =3D portdb.findname(cpv, mytree=3Dtree_data.path)
+				if ebuild_location is None:
+					continue
+				ebuild_hash =3D hashed_path(ebuild_location)
+
 				eapi =3D src.get('EAPI')
 				if not eapi:
 					eapi =3D '0'
@@ -1745,8 +1759,17 @@ def action_metadata(settings, portdb, myopts, port=
trees=3DNone):
 					if d is not None and d.get('EAPI') in ('', '0'):
 						del d['EAPI']
=20
+				if src_chf !=3D 'mtime':
+					# src may contain an irrelevant _mtime_ which corresponds
+					# to the time that the cache entry was written
+					src.pop('_mtime_', None)
+
+				if src_chf !=3D dest_chf:
+					# populate src entry with dest_chf_key
+					src[dest_chf_key] =3D dest_chf_getter(ebuild_hash)
+
 				if dest is not None:
-					if not (dest['_mtime_'] =3D=3D src['_mtime_'] and \
+					if not (dest[dest_chf_key] =3D=3D src[dest_chf_key] and \
 						tree_data.eclass_db.validate_and_rewrite_cache(
 							dest['_eclasses_'], tree_data.dest_db.validation_chf,
 							tree_data.dest_db.store_eclass_paths) is not None and \
@@ -1756,8 +1779,13 @@ def action_metadata(settings, portdb, myopts, port=
trees=3DNone):
 						# We don't want to skip the write unless we're really
 						# sure that the existing cache is identical, so don't
 						# trust _mtime_ and _eclasses_ alone.
-						for k in set(chain(src, dest)).difference(
-							('_mtime_', '_eclasses_')):
+						keys =3D set()
+						keys.update(src)
+						keys.update(dest)
+						keys.discard('_eclasses_')
+						keys.discard('_mtime_')
+						keys.discard(src_chf_key)
+						for k in keys:
 							if dest.get(k, '') !=3D src.get(k, ''):
 								dest =3D None
 								break
@@ -1804,7 +1832,7 @@ def action_metadata(settings, portdb, myopts, portt=
rees=3DNone):
 				if not eapi_supported:
 					src =3D {
 						'EAPI'       : '-' + eapi,
-						'_mtime_'    : src['_mtime_'],
+						dest_chf_key : src[dest_chf_key],
 						'_eclasses_' : src['_eclasses_'],
 					}
=20