For bug #161003, disallow virtuals in package.provided and document it. Thanks to...
authorZac Medico <zmedico@gentoo.org>
Tue, 9 Jan 2007 20:34:27 +0000 (20:34 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 9 Jan 2007 20:34:27 +0000 (20:34 -0000)
svn path=/main/trunk/; revision=5502

man/portage.5
pym/portage.py

index cfe71a67289bc84bc6de614d79fdef20bb5fd1a6..66547521e302907ca07a8bf1f154c2a0e3a645dd 100644 (file)
@@ -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 #
index 52d49396d55d0f8790317ddf5141eef98e11b2ad..985ee4e79877e90ee7ef92adc91776c1fef90658 100644 (file)
@@ -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)