Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/
Date: Wed, 02 Mar 2011 18:54:57
Message-Id: e0b4048274b2cfc1617f2eff379cbe8435e13ed4.zmedico@gentoo
1 commit: e0b4048274b2cfc1617f2eff379cbe8435e13ed4
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 2 18:51:41 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 2 18:51:41 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e0b40482
7
8 dblink.getcontents(): generate parent directories
9
10 We can't necessarily assume that they are explicitly listed in
11 CONTENTS, and they are crucial for callers such as dblink.isowner().
12
13 ---
14 pym/portage/dbapi/vartree.py | 16 ++++++++++++++++
15 1 files changed, 16 insertions(+), 0 deletions(-)
16
17 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
18 index 04e66ab..cd8b1c1 100644
19 --- a/pym/portage/dbapi/vartree.py
20 +++ b/pym/portage/dbapi/vartree.py
21 @@ -1404,6 +1404,9 @@ class dblink(object):
22 myroot = self.settings['ROOT']
23 if myroot == os.path.sep:
24 myroot = None
25 + # used to generate parent dir entries
26 + dir_entry = (_unicode_decode("dir"),)
27 + eroot_split_len = len(self.settings["EROOT"].split(os.sep)) - 1
28 pos = 0
29 errors = []
30 for pos, line in enumerate(mylines):
31 @@ -1448,6 +1451,19 @@ class dblink(object):
32 if myroot is not None:
33 path = os.path.join(myroot, path.lstrip(os.path.sep))
34
35 + # Implicitly add parent directories, since we can't necessarily
36 + # assume that they are explicitly listed in CONTENTS, and it's
37 + # useful for callers if they can rely on parent directory entries
38 + # being generated here (crucial for things like dblink.isowner()).
39 + path_split = path.split(os.sep)
40 + path_split.pop()
41 + while len(path_split) > eroot_split_len:
42 + parent = os.sep.join(path_split)
43 + if parent in pkgfiles:
44 + break
45 + pkgfiles[parent] = dir_entry
46 + path_split.pop()
47 +
48 pkgfiles[path] = data
49
50 if errors: