From 7bd12272120465a6ccc80a2281b6333f7d3a5425 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 9 Jan 2007 20:34:27 +0000 Subject: [PATCH] For bug #161003, disallow virtuals in package.provided and document it. Thanks to Robin Johnson for the initial patch. svn path=/main/trunk/; revision=5502 --- man/portage.5 | 5 +++++ pym/portage.py | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/man/portage.5 b/man/portage.5 index cfe71a672..66547521e 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -207,6 +207,11 @@ For example, if you manage your own copy of a 2.6 kernel, then you can tell portage that 'sys-kernel/development-sources-2.6.7' is already taken care of and it should get off your back about it. +Virtual packages (virtual/*) should not be specified in package.provided. +Depending on the type of virtual, it may be necessary to add an entry to the +virtuals file and/or add a package that satisfies a virtual to +package.provided. + .I Format: .nf \- comments begin with # diff --git a/pym/portage.py b/pym/portage.py index 52d49396d..985ee4e79 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1348,13 +1348,31 @@ class config: pkgprovidedlines = [grabfile(os.path.join(x, "package.provided")) for x in self.profiles] pkgprovidedlines = stack_lists(pkgprovidedlines, incremental=1) + has_invalid_data = False for x in range(len(pkgprovidedlines)-1, -1, -1): + myline = pkgprovidedlines[x] + if not isvalidatom("=" + myline): + writemsg("Invalid package name in package.provided:" + \ + " %s\n" % myline, noiselevel=-1) + has_invalid_data = True + del pkgprovidedlines[x] + continue cpvr = catpkgsplit(pkgprovidedlines[x]) if not cpvr or cpvr[0] == "null": writemsg("Invalid package name in package.provided: "+pkgprovidedlines[x]+"\n", noiselevel=-1) + has_invalid_data = True del pkgprovidedlines[x] - + continue + if cpvr[0] == "virtual": + writemsg("Virtual package in package.provided: %s\n" % \ + myline, noiselevel=-1) + has_invalid_data = True + del pkgprovidedlines[x] + continue + if has_invalid_data: + writemsg("See portage(5) for correct package.provided usage.\n", + noiselevel=-1) self.pprovideddict = {} for x in pkgprovidedlines: cpv=catpkgsplit(x) -- 2.26.2