Gentoo Archives: gentoo-portage-dev

From: Chris White <chris.chriswhite@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] egencache and dotfiles
Date: Wed, 21 Nov 2012 00:04:50
Message-Id: 3799A163-418F-4EF7-9489-B42807E24B99@gmail.com
1 When egencache attempts to parse cache files in a directory containing dotfiles, .gitignore for example, a failure occurs:
2
3 Unable to parse cp for '.gitignore'
4
5 The related code appears to be here (bin/egencache):
6
7 ----------------------------------------------------------------
8 for cpv in trg_cache:
9 cp = cpv_getkey(cpv)
10 if cp is None:
11 self.returncode |= 1
12 writemsg_level(
13 "Unable to parse cp for '%s'\n" % (cpv,),
14 level=logging.ERROR, noiselevel=-1)
15 else:
16 dead_nodes.add(cpv)
17 ----------------------------------------------------------------
18
19 After diving deeper into the code I found the file pym/portage/cache/flat_hash.py. The __iter__ declared here uses os.listdir(), which from what I've read does not ignore dotfiles. I found a quick fix through adding an additional condition here:
20
21 -------------------------------------------------------
22 if l.endswith(".cpickle") or l.startswith("."):
23 -------------------------------------------------------
24
25 However I'm not 100% certain that this is the overall best solution with my knowledge of the portage code and wanted to get some insight.
26
27 - Chris

Replies

Subject Author
Re: [gentoo-portage-dev] egencache and dotfiles Zac Medico <zmedico@g.o>