summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-11-11 23:59:15 +0000
committerZac Medico <zmedico@gentoo.org>2006-11-11 23:59:15 +0000
commit7a3b9d1c4f3cbf0699a46945a216e39f902079c0 (patch)
tree6c9773ae8a4e2d71c67a96df814996b43442e0ff
parentc18aa841e4fb54bf59543795a3744cd82d50707e (diff)
downloadportage-7a3b9d1c4f3cbf0699a46945a216e39f902079c0.tar.gz
portage-7a3b9d1c4f3cbf0699a46945a216e39f902079c0.tar.bz2
portage-7a3b9d1c4f3cbf0699a46945a216e39f902079c0.zip
For bug #154554, validate all profile virtuals atoms.
svn path=/main/trunk/; revision=5010
-rw-r--r--pym/portage.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 604deb104..2f146a019 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -1823,9 +1823,29 @@ class config:
if self.virtuals:
return self.virtuals
- self.dirVirtuals = stack_dictlist(
- [grabdict_package(os.path.join(x, "virtuals")) \
- for x in self.profiles], incremental=True)
+ virtuals_list = []
+ for x in self.profiles:
+ virtuals_file = os.path.join(x, "virtuals")
+ virtuals_dict = grabdict(virtuals_file)
+ for k in virtuals_dict.keys():
+ if not isvalidatom(k) or dep_getkey(k) != k:
+ writemsg("--- Invalid virtuals atom in %s: %s\n" % \
+ (virtuals_file, k), noiselevel=-1)
+ del virtuals_dict[k]
+ continue
+ myvalues = virtuals_dict[k]
+ for x in myvalues:
+ if not isvalidatom(x):
+ writemsg("--- Invalid atom in %s: %s\n" % \
+ (virtuals_file, x), noiselevel=-1)
+ myvalues.remove(x)
+ if not myvalues:
+ del virtuals_dict[k]
+ if virtuals_dict:
+ virtuals_list.append(virtuals_dict)
+
+ self.dirVirtuals = stack_dictlist(virtuals_list, incremental=True)
+ del virtuals_list
for virt in self.dirVirtuals:
# Preference for virtuals decreases from left to right.