Re: [gentoo-portage-dev] [PATCH] emerge: fix --use-ebuild-visibility to reject binary packages (bug 612960)

2017-03-18 Thread Zac Medico
On Sat, Mar 18, 2017 at 12:10 AM, Brian Dolbec  wrote:
> On Fri, 17 Mar 2017 20:48:22 -0700
> Zac Medico  wrote:
>
>> Fix the --use-ebuild-visibility option to reject binary packages for
>> which ebuilds are either masked or unavailable. The included test case
>> fails with out this fix.
>>
>> X-Gentoo-bug: 612960
>> X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=612960
>> ---
>>  pym/_emerge/depgraph.py| 32 +++-
>>  .../resolver/test_binary_pkg_ebuild_visibility.py  | 94
>> ++ 2 files changed, 123 insertions(+), 3
>> deletions(-) create mode 100644
>
> Looks fine

Thanks, pushed:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=e309323f156528a8a79a1f755e1326e8880346b7

-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH] emerge: fix --use-ebuild-visibility to reject binary packages (bug 612960)

2017-03-18 Thread Brian Dolbec
On Fri, 17 Mar 2017 20:48:22 -0700
Zac Medico  wrote:

> Fix the --use-ebuild-visibility option to reject binary packages for
> which ebuilds are either masked or unavailable. The included test case
> fails with out this fix.
> 
> X-Gentoo-bug: 612960
> X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=612960
> ---
>  pym/_emerge/depgraph.py| 32 +++-
>  .../resolver/test_binary_pkg_ebuild_visibility.py  | 94
> ++ 2 files changed, 123 insertions(+), 3
> deletions(-) create mode 100644

Looks fine

-- 
Brian Dolbec 




[gentoo-portage-dev] [PATCH] emerge: fix --use-ebuild-visibility to reject binary packages (bug 612960)

2017-03-17 Thread Zac Medico
Fix the --use-ebuild-visibility option to reject binary packages for
which ebuilds are either masked or unavailable. The included test case
fails with out this fix.

X-Gentoo-bug: 612960
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=612960
---
 pym/_emerge/depgraph.py| 32 +++-
 .../resolver/test_binary_pkg_ebuild_visibility.py  | 94 ++
 2 files changed, 123 insertions(+), 3 deletions(-)
 create mode 100644 
pym/portage/tests/resolver/test_binary_pkg_ebuild_visibility.py

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index e94b96c..3834983 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -4889,6 +4889,9 @@ class depgraph(object):
vardb = self._frozen_config.roots[root].trees["vartree"].dbapi
bindb = self._frozen_config.roots[root].trees["bintree"].dbapi
dbs = self._dynamic_config._filtered_trees[root]["dbs"]
+   use_ebuild_visibility = self._frozen_config.myopts.get(
+   '--use-ebuild-visibility', 'n') != 'n'
+
for db, pkg_type, built, installed, db_keys in dbs:
if installed:
continue
@@ -4975,6 +4978,7 @@ class depgraph(object):
eapi=pkg.eapi):

required_use_unsatisfied.append(pkg)
continue
+
root_slot = (pkg.root, 
pkg.slot_atom)
if pkg.built and root_slot in 
self._rebuild.rebuild_list:
mreasons = ["need to 
rebuild from source"]
@@ -4988,6 +4992,19 @@ class depgraph(object):

self._dynamic_config.ignored_binaries.get(
pkg, 
{}).get("changed_deps")):
mreasons = ["changed 
deps"]
+   elif (pkg.built and 
use_ebuild_visibility and
+   not 
self._equiv_ebuild_visible(pkg)):
+   equiv_ebuild = 
self._equiv_ebuild(pkg)
+   if equiv_ebuild is None:
+   mreasons = 
["ebuild not unavailable"]
+   elif not mreasons:
+   metadata, 
mreasons = get_mask_info(
+   
root_config, equiv_ebuild.cpv, pkgsettings,
+   portdb, 
equiv_ebuild.pkg_type,
+   
equiv_ebuild.built, equiv_ebuild.installed,
+   
db_keys, myrepo=equiv_ebuild.repo,
+   
_pkg_use_enabled=self._pkg_use_enabled)
+
masked_packages.append(
(root_config, pkgsettings, cpv, 
repo, metadata, mreasons))
 
@@ -5548,6 +5565,14 @@ class depgraph(object):
"""
return depth + n if isinstance(depth, int) else depth
 
+   def _equiv_ebuild(self, pkg):
+   try:
+   return self._pkg(
+   pkg.cpv, "ebuild", pkg.root_config, 
myrepo=pkg.repo)
+   except portage.exception.PackageNotFound:
+   return next(self._iter_match_pkgs(pkg.root_config,
+   "ebuild", Atom("=%s" % (pkg.cpv,))), None)
+
def _equiv_ebuild_visible(self, pkg, autounmask_level=None):
try:
pkg_eb = self._pkg(
@@ -6021,11 +6046,11 @@ class depgraph(object):
# reinstall the same exact 
version only due
# to a KEYWORDS mask. See bug 
#252167.
 
+   identical_binary = False
if pkg.type_name != "ebuild" 
and matched_packages:
# Don't re-install a 
binary package that is
# identical to the 
currently installed package
# (see bug #354441).
-   identical_binary = False