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 1PurCL-000367-Nc for garchives@archives.gentoo.org; Wed, 02 Mar 2011 18:54:57 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2AE871C05D; Wed, 2 Mar 2011 18:54:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id F11301C05D for ; Wed, 2 Mar 2011 18:54:50 +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 89D991B40FE for ; Wed, 2 Mar 2011 18:54:50 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id E42DA8006A for ; Wed, 2 Mar 2011 18:54:49 +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:master 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: e0b4048274b2cfc1617f2eff379cbe8435e13ed4 Date: Wed, 2 Mar 2011 18:54:49 +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: 3c17fe6be59f164c42e74ba5c2a0137c commit: e0b4048274b2cfc1617f2eff379cbe8435e13ed4 Author: Zac Medico gentoo org> AuthorDate: Wed Mar 2 18:51:41 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Mar 2 18:51:41 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3De0b40482 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 04e66ab..cd8b1c1 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1404,6 +1404,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): @@ -1448,6 +1451,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: