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 1PzAax-0000B6-5a for garchives@archives.gentoo.org; Mon, 14 Mar 2011 16:26:11 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 739901C042; Mon, 14 Mar 2011 16:24:44 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 415E21C040 for ; Mon, 14 Mar 2011 16:24:44 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 93DBA1B4171 for ; Mon, 14 Mar 2011 16:24:43 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id DB5C780074 for ; Mon, 14 Mar 2011 16:24:42 +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: Subject: [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/vartree.py X-VCS-Directories: pym/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: efd2f0cc74a743fcc15f95ff5edae817c341cc49 Date: Mon, 14 Mar 2011 16:24:42 +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: bf990765c034d0d1432bec5b3955a1b4 commit: efd2f0cc74a743fcc15f95ff5edae817c341cc49 Author: Zac Medico gentoo org> AuthorDate: Wed Mar 2 18:51:41 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Mar 14 16:03:31 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Defd2f0cc dblink.getcontents(): generate parent directories We can't necessarily assume that they are explicitly listed in CONTENTS, and they are crucial for callers such as dblink.isowner(). --- pym/portage/dbapi/vartree.py | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 3bc30af..52f0fba 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1403,6 +1403,9 @@ class dblink(object): myroot =3D self.settings['ROOT'] if myroot =3D=3D os.path.sep: myroot =3D None + # used to generate parent dir entries + dir_entry =3D (_unicode_decode("dir"),) + eroot_split_len =3D len(self.settings["EROOT"].split(os.sep)) - 1 pos =3D 0 errors =3D [] for pos, line in enumerate(mylines): @@ -1447,6 +1450,19 @@ class dblink(object): if myroot is not None: path =3D os.path.join(myroot, path.lstrip(os.path.sep)) =20 + # Implicitly add parent directories, since we can't necessarily + # assume that they are explicitly listed in CONTENTS, and it's + # useful for callers if they can rely on parent directory entries + # being generated here (crucial for things like dblink.isowner()). + path_split =3D path.split(os.sep) + path_split.pop() + while len(path_split) > eroot_split_len: + parent =3D os.sep.join(path_split) + if parent in pkgfiles: + break + pkgfiles[parent] =3D dir_entry + path_split.pop() + pkgfiles[path] =3D data =20 if errors: