From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SU0Ke-00038R-0R for garchives@archives.gentoo.org; Mon, 14 May 2012 18:49:20 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5B301E09CC; Mon, 14 May 2012 18:49:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1B5E7E09CC for ; Mon, 14 May 2012 18:49:00 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5965C1BC0CC for ; Mon, 14 May 2012 18:48:59 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 20E0FE5429 for ; Mon, 14 May 2012 18:48:58 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1337021321.2ec3f2d22da444fc8c40370ed2be64d39db8c9e2.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/depgraph.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 2ec3f2d22da444fc8c40370ed2be64d39db8c9e2 X-VCS-Branch: master Date: Mon, 14 May 2012 18:48:58 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 3c0330c4-2404-4e7b-8ae9-a27abf425d97 X-Archives-Hash: e63ff7fa3321cf31d6cf3aa1d653310d commit: 2ec3f2d22da444fc8c40370ed2be64d39db8c9e2 Author: Zac Medico gentoo org> AuthorDate: Mon May 14 18:48:41 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon May 14 18:48:41 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D2ec3f2d2 depgraph: send output to stderr when appropriate This also removes the stderr -> stdout redirect from display_problems, since the app-portage/autounmask program is no longer supported, and that will fix bug #406867. --- pym/_emerge/depgraph.py | 118 +++++++++++++++++++----------------------= ------ 1 files changed, 48 insertions(+), 70 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 5152d5c..572cea7 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -615,7 +615,7 @@ class depgraph(object): for line in msg: if line: line =3D colorize("INFORM", line) - writemsg_stdout(line + "\n", noiselevel=3D-1) + writemsg(line + "\n", noiselevel=3D-1) =20 def _show_missed_update(self): =20 @@ -3223,55 +3223,55 @@ class depgraph(object): =20 pkg =3D show_req_use output_cpv =3D pkg.cpv + _repo_separator + pkg.repo - writemsg_stdout("\n!!! " + \ + writemsg("\n!!! " + \ colorize("BAD", "The ebuild selected to satisfy ") + \ colorize("INFORM", xinfo) + \ colorize("BAD", " has unmet requirements.") + "\n", noiselevel=3D-1) use_display =3D pkg_use_display(pkg, self._frozen_config.myopts) - writemsg_stdout("- %s %s\n" % (output_cpv, use_display), + writemsg("- %s %s\n" % (output_cpv, use_display), noiselevel=3D-1) - writemsg_stdout("\n The following REQUIRED_USE flag constraints " + = \ + writemsg("\n The following REQUIRED_USE flag constraints " + \ "are unsatisfied:\n", noiselevel=3D-1) reduced_noise =3D check_required_use( pkg.metadata["REQUIRED_USE"], self._pkg_use_enabled(pkg), pkg.iuse.is_valid_flag).tounicode() - writemsg_stdout(" %s\n" % \ + writemsg(" %s\n" % \ human_readable_required_use(reduced_noise), noiselevel=3D-1) normalized_required_use =3D \ " ".join(pkg.metadata["REQUIRED_USE"].split()) if reduced_noise !=3D normalized_required_use: - writemsg_stdout("\n The above constraints " + \ + writemsg("\n The above constraints " + \ "are a subset of the following complete expression:\n", noiselevel=3D-1) - writemsg_stdout(" %s\n" % \ + writemsg(" %s\n" % \ human_readable_required_use(normalized_required_use), noiselevel=3D-1) - writemsg_stdout("\n", noiselevel=3D-1) + writemsg("\n", noiselevel=3D-1) =20 elif show_missing_use: - writemsg_stdout("\nemerge: there are no ebuilds built with USE flags = to satisfy "+green(xinfo)+".\n", noiselevel=3D-1) - writemsg_stdout("!!! One of the following packages is required to com= plete your request:\n", noiselevel=3D-1) + writemsg("\nemerge: there are no ebuilds built with USE flags to sati= sfy "+green(xinfo)+".\n", noiselevel=3D-1) + writemsg("!!! One of the following packages is required to complete y= our request:\n", noiselevel=3D-1) for pkg, mreasons in show_missing_use: - writemsg_stdout("- "+pkg.cpv+_repo_separator+pkg.repo+" ("+", ".join= (mreasons)+")\n", noiselevel=3D-1) + writemsg("- "+pkg.cpv+_repo_separator+pkg.repo+" ("+", ".join(mreaso= ns)+")\n", noiselevel=3D-1) =20 elif masked_packages: - writemsg_stdout("\n!!! " + \ + writemsg("\n!!! " + \ colorize("BAD", "All ebuilds that could satisfy ") + \ colorize("INFORM", xinfo) + \ colorize("BAD", " have been masked.") + "\n", noiselevel=3D-1) - writemsg_stdout("!!! One of the following masked packages is required= to complete your request:\n", noiselevel=3D-1) + writemsg("!!! One of the following masked packages is required to com= plete your request:\n", noiselevel=3D-1) have_eapi_mask =3D show_masked_packages(masked_packages) if have_eapi_mask: - writemsg_stdout("\n", noiselevel=3D-1) + writemsg("\n", noiselevel=3D-1) msg =3D ("The current version of portage supports " + \ "EAPI '%s'. You must upgrade to a newer version" + \ " of portage before EAPI masked packages can" + \ " be installed.") % portage.const.EAPI - writemsg_stdout("\n".join(textwrap.wrap(msg, 75)), noiselevel=3D-1) - writemsg_stdout("\n", noiselevel=3D-1) + writemsg("\n".join(textwrap.wrap(msg, 75)), noiselevel=3D-1) + writemsg("\n", noiselevel=3D-1) mask_docs =3D True else: cp_exists =3D False @@ -3281,7 +3281,7 @@ class depgraph(object): cp_exists =3D True break =20 - writemsg_stdout("\nemerge: there are no ebuilds to satisfy "+green(xi= nfo)+".\n", noiselevel=3D-1) + writemsg("\nemerge: there are no ebuilds to satisfy "+green(xinfo)+".= \n", noiselevel=3D-1) if isinstance(myparent, AtomArg) and \ not cp_exists and \ self._frozen_config.myopts.get( @@ -3291,7 +3291,7 @@ class depgraph(object): if cat =3D=3D "null": cat =3D None =20 - writemsg_stdout("\nemerge: searching for similar names..." + writemsg("\nemerge: searching for similar names..." , noiselevel=3D-1) =20 all_cp =3D set() @@ -3339,16 +3339,16 @@ class depgraph(object): matches =3D matches_orig_case =20 if len(matches) =3D=3D 1: - writemsg_stdout("\nemerge: Maybe you meant " + matches[0] + "?\n" + writemsg("\nemerge: Maybe you meant " + matches[0] + "?\n" , noiselevel=3D-1) elif len(matches) > 1: - writemsg_stdout( + writemsg( "\nemerge: Maybe you meant any of these: %s?\n" % \ (", ".join(matches),), noiselevel=3D-1) else: # Generally, this would only happen if # all dbapis are empty. - writemsg_stdout(" nothing similar found.\n" + writemsg(" nothing similar found.\n" , noiselevel=3D-1) msg =3D [] if not isinstance(myparent, AtomArg): @@ -3361,12 +3361,12 @@ class depgraph(object): (node)), node_type)) =20 if msg: - writemsg_stdout("\n".join(msg), noiselevel=3D-1) - writemsg_stdout("\n", noiselevel=3D-1) + writemsg("\n".join(msg), noiselevel=3D-1) + writemsg("\n", noiselevel=3D-1) =20 if mask_docs: show_mask_docs() - writemsg_stdout("\n", noiselevel=3D-1) + writemsg("\n", noiselevel=3D-1) =20 def _iter_match_pkgs_any(self, root_config, atom, onlydeps=3DFalse): for db, pkg_type, built, installed, db_keys in \ @@ -6115,27 +6115,27 @@ class depgraph(object): settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH) =20 if len(roots) > 1: - writemsg_stdout("\nFor %s:\n" % abs_user_config, noiselevel=3D-1) + writemsg("\nFor %s:\n" % abs_user_config, noiselevel=3D-1) =20 if root in unstable_keyword_msg: - writemsg_stdout("\nThe following " + colorize("BAD", "keyword change= s") + \ + writemsg("\nThe following " + colorize("BAD", "keyword changes") + \ " are necessary to proceed:\n", noiselevel=3D-1) - writemsg_stdout(format_msg(unstable_keyword_msg[root]), noiselevel=3D= -1) + writemsg(format_msg(unstable_keyword_msg[root]), noiselevel=3D-1) =20 if root in p_mask_change_msg: - writemsg_stdout("\nThe following " + colorize("BAD", "mask changes")= + \ + writemsg("\nThe following " + colorize("BAD", "mask changes") + \ " are necessary to proceed:\n", noiselevel=3D-1) - writemsg_stdout(format_msg(p_mask_change_msg[root]), noiselevel=3D-1= ) + writemsg(format_msg(p_mask_change_msg[root]), noiselevel=3D-1) =20 if root in use_changes_msg: - writemsg_stdout("\nThe following " + colorize("BAD", "USE changes") = + \ + writemsg("\nThe following " + colorize("BAD", "USE changes") + \ " are necessary to proceed:\n", noiselevel=3D-1) - writemsg_stdout(format_msg(use_changes_msg[root]), noiselevel=3D-1) + writemsg(format_msg(use_changes_msg[root]), noiselevel=3D-1) =20 if root in license_msg: - writemsg_stdout("\nThe following " + colorize("BAD", "license change= s") + \ + writemsg("\nThe following " + colorize("BAD", "license changes") + \ " are necessary to proceed:\n", noiselevel=3D-1) - writemsg_stdout(format_msg(license_msg[root]), noiselevel=3D-1) + writemsg(format_msg(license_msg[root]), noiselevel=3D-1) =20 protect_obj =3D {} if write_to_file: @@ -6182,7 +6182,7 @@ class depgraph(object): for line in msg: if line: line =3D colorize("INFORM", line) - writemsg_stdout(line + "\n", noiselevel=3D-1) + writemsg(line + "\n", noiselevel=3D-1) =20 if ask and write_to_file and file_to_write_to: prompt =3D "\nWould you like to add these " + \ @@ -6214,14 +6214,14 @@ class depgraph(object): file_to_write_to.get((abs_user_config, "package.license"))) =20 if problems: - writemsg_stdout("\nThe following problems occurred while writing auto= unmask changes:\n", \ + writemsg("\nThe following problems occurred while writing autounmask = changes:\n", \ noiselevel=3D-1) - writemsg_stdout("".join(problems), noiselevel=3D-1) + writemsg("".join(problems), noiselevel=3D-1) elif write_to_file and roots: - writemsg_stdout("\nAutounmask changes successfully written. Remember = to run dispatch-conf.\n", \ + writemsg("\nAutounmask changes successfully written. Remember to run = dispatch-conf.\n", \ noiselevel=3D-1) elif not pretend and not autounmask_write and roots: - writemsg_stdout("\nUse --autounmask-write to write changes to config = files (honoring CONFIG_PROTECT).\n", \ + writemsg("\nUse --autounmask-write to write changes to config files (= honoring CONFIG_PROTECT).\n", \ noiselevel=3D-1) =20 =20 @@ -6232,35 +6232,8 @@ class depgraph(object): the merge list where it is most likely to be seen, but if display() is not going to be called then this method should be called explicitly to ensure that the user is notified of problems with the graph. - - All output goes to stderr, except for unsatisfied dependencies which - go to stdout for parsing by programs such as autounmask. """ =20 - # Note that show_masked_packages() sends its output to - # stdout, and some programs such as autounmask parse the - # output in cases when emerge bails out. However, when - # show_masked_packages() is called for installed packages - # here, the message is a warning that is more appropriate - # to send to stderr, so temporarily redirect stdout to - # stderr. TODO: Fix output code so there's a cleaner way - # to redirect everything to stderr. - sys.stdout.flush() - sys.stderr.flush() - stdout =3D sys.stdout - try: - sys.stdout =3D sys.stderr - self._display_problems() - finally: - sys.stdout =3D stdout - sys.stdout.flush() - sys.stderr.flush() - - # This goes to stdout for parsing by programs like autounmask. - for pargs, kwargs in self._dynamic_config._unsatisfied_deps_for_displa= y: - self._show_unsatisfied_dep(*pargs, **kwargs) - - def _display_problems(self): if self._dynamic_config._circular_deps_for_display is not None: self._show_circular_deps( self._dynamic_config._circular_deps_for_display) @@ -6379,6 +6352,9 @@ class depgraph(object): show_mask_docs() writemsg("\n", noiselevel=3D-1) =20 + for pargs, kwargs in self._dynamic_config._unsatisfied_deps_for_displa= y: + self._show_unsatisfied_dep(*pargs, **kwargs) + def saveNomergeFavorites(self): """Find atoms in favorites that are not in the mergelist and add them to the world file if necessary.""" @@ -7192,10 +7168,11 @@ def show_masked_packages(masked_packages): # above via mreasons. pass =20 - writemsg_stdout("- "+output_cpv+" (masked by: "+", ".join(mreasons)+")= \n", noiselevel=3D-1) + writemsg("- "+output_cpv+" (masked by: "+", ".join(mreasons)+")\n", + noiselevel=3D-1) =20 if comment and comment not in shown_comments: - writemsg_stdout(filename + ":\n" + comment + "\n", + writemsg(filename + ":\n" + comment + "\n", noiselevel=3D-1) shown_comments.add(comment) portdb =3D root_config.trees["porttree"].dbapi @@ -7205,13 +7182,14 @@ def show_masked_packages(masked_packages): continue msg =3D ("A copy of the '%s' license" + \ " is located at '%s'.\n\n") % (l, l_path) - writemsg_stdout(msg, noiselevel=3D-1) + writemsg(msg, noiselevel=3D-1) shown_licenses.add(l) return have_eapi_mask =20 def show_mask_docs(): - writemsg_stdout("For more information, see the MASKED PACKAGES section = in the emerge\n", noiselevel=3D-1) - writemsg_stdout("man page or refer to the Gentoo Handbook.\n", noiselev= el=3D-1) + writemsg("For more information, see the MASKED PACKAGES " + "section in the emerge\n", noiselevel=3D-1) + writemsg("man page or refer to the Gentoo Handbook.\n", noiselevel=3D-1= ) =20 def show_blocker_docs_link(): writemsg("\nFor more information about " + bad("Blocked Packages") + ",= please refer to the following\n", noiselevel=3D-1)