Bug #256289 - When displaying an unsatisfied USE dep and all packages with
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 06:36:07 +0000 (06:36 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 06:36:07 +0000 (06:36 -0000)
the required IUSE are masked, show a normal "masked package" message for
the package(s) that have the required IUSE (instead of showing the unmasked
packages with missing IUSE). (trunk r12746)

svn path=/main/branches/2.1.6/; revision=12995

pym/_emerge/__init__.py

index 94dc3f465571bd209eed38db86cb6ba43a9d74dd..f3209c34ee37c864b244597ed5ef818f3c01bd28 100644 (file)
@@ -5918,6 +5918,7 @@ class depgraph(object):
                xinfo = xinfo.replace("null/", "")
                masked_packages = []
                missing_use = []
+               masked_pkg_instances = set()
                missing_licenses = []
                have_eapi_mask = False
                pkgsettings = self.pkgsettings[root]
@@ -5949,9 +5950,12 @@ class depgraph(object):
                                                # Filter out any such false matches here.
                                                if not atom_set.findAtomForPackage(pkg):
                                                        continue
-                                       if atom.use and not mreasons:
+                                       if mreasons:
+                                               masked_pkg_instances.add(pkg)
+                                       if atom.use:
                                                missing_use.append(pkg)
-                                               continue
+                                               if not mreasons:
+                                                       continue
                                masked_packages.append(
                                        (root_config, pkgsettings, cpv, metadata, mreasons))
 
@@ -5981,16 +5985,28 @@ class depgraph(object):
                                        mreasons.append("Change USE: %s" % " ".join(changes))
                                        missing_use_reasons.append((pkg, mreasons))
 
-               if missing_iuse_reasons and not missing_use_reasons:
-                       missing_use_reasons = missing_iuse_reasons
-               elif missing_use_reasons:
+               unmasked_use_reasons = [(pkg, mreasons) for (pkg, mreasons) \
+                       in missing_use_reasons if pkg not in masked_pkg_instances]
+
+               unmasked_iuse_reasons = [(pkg, mreasons) for (pkg, mreasons) \
+                       in missing_iuse_reasons if pkg not in masked_pkg_instances]
+
+               show_missing_use = False
+               if unmasked_use_reasons:
                        # Only show the latest version.
-                       del missing_use_reasons[1:]
+                       show_missing_use = unmasked_use_reasons[:1]
+               elif unmasked_iuse_reasons:
+                       if missing_use_reasons:
+                               # All packages with required IUSE are masked,
+                               # so display a normal masking message.
+                               pass
+                       else:
+                               show_missing_use = unmasked_iuse_reasons
 
-               if missing_use_reasons:
+               if show_missing_use:
                        print "\nemerge: there are no ebuilds built with USE flags to satisfy "+green(xinfo)+"."
                        print "!!! One of the following packages is required to complete your request:"
-                       for pkg, mreasons in missing_use_reasons:
+                       for pkg, mreasons in show_missing_use:
                                print "- "+pkg.cpv+" ("+", ".join(mreasons)+")"
 
                elif masked_packages: