[gentoo-portage-dev] [PATCH] dbapi: fix repoman implicit IUSE (bug 660982)

2018-07-12 Thread Zac Medico
Account for repoman modifications of the portdbapi self.settings
reference, and treat all flags as valid for the empty profile
because it does not have any implicit IUSE settings.

Bug: https://bugs.gentoo.org/660982
---
 pym/_emerge/Package.py|  5 -
 pym/portage/dbapi/__init__.py | 16 
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index a7ce00bc9..5f34f3d27 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -93,7 +93,10 @@ class Package(Task):
# sync metadata with validated repo (may be UNKNOWN_REPO)
self._metadata['repository'] = self.cpv.repo
 
-   implicit_match = db._iuse_implicit_cnstr(self.cpv, 
self._metadata)
+   if self.root_config.settings.local_config:
+   implicit_match = db._iuse_implicit_cnstr(self.cpv, 
self._metadata)
+   else:
+   implicit_match = 
db._repoman_iuse_implicit_cnstr(self.cpv, self._metadata)
usealiases = 
self.root_config.settings._use_manager.getUseAliases(self)
self.iuse = self._iuse(self, self._metadata["IUSE"].split(),
implicit_match, usealiases, self.eapi)
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index d320cc75f..61d301839 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -216,6 +216,22 @@ class dbapi(object):
 
yield cpv
 
+   def _repoman_iuse_implicit_cnstr(self, pkg, metadata):
+   """
+   In repoman's version of _iuse_implicit_cnstr, account for 
modifications
+   of the self.settings reference between calls, and treat all 
flags as
+   valid for the empty profile because it does not have any 
implicit IUSE
+   settings. See bug 660982.
+   """
+   eapi_attrs = _get_eapi_attrs(metadata["EAPI"])
+   if eapi_attrs.iuse_effective:
+   iuse_implicit_match = lambda flag: (True if not 
self.settings.profile_path
+   else self.settings._iuse_effective_match(flag))
+   else:
+   iuse_implicit_match = lambda flag: (True if not 
self.settings.profile_path
+   else self.settings._iuse_implicit_match(flag))
+   return iuse_implicit_match
+
def _iuse_implicit_cnstr(self, pkg, metadata):
"""
Construct a callable that checks if a given USE flag should
-- 
2.13.6




Re: [gentoo-portage-dev] [PATCH] dbapi: fix repoman implicit IUSE (bug 660982)

2018-07-12 Thread Brian Dolbec
On Thu, 12 Jul 2018 02:59:03 -0700
Zac Medico  wrote:

> Account for repoman modifications of the portdbapi self.settings
> reference, and treat all flags as valid for the empty profile
> because it does not have any implicit IUSE settings.
> 
> Bug: https://bugs.gentoo.org/660982
> ---
>  pym/_emerge/Package.py|  5 -
>  pym/portage/dbapi/__init__.py | 16 
>  2 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
> index a7ce00bc9..5f34f3d27 100644
> --- a/pym/_emerge/Package.py
> +++ b/pym/_emerge/Package.py
> @@ -93,7 +93,10 @@ class Package(Task):
>   # sync metadata with validated repo (may be
> UNKNOWN_REPO) self._metadata['repository'] = self.cpv.repo
>  
> - implicit_match = db._iuse_implicit_cnstr(self.cpv,
> self._metadata)
> + if self.root_config.settings.local_config:
> + implicit_match =
> db._iuse_implicit_cnstr(self.cpv, self._metadata)
> + else:
> + implicit_match =
> db._repoman_iuse_implicit_cnstr(self.cpv, self._metadata) usealiases
> = self.root_config.settings._use_manager.getUseAliases(self)
> self.iuse = self._iuse(self, self._metadata["IUSE"].split(),
> implicit_match, usealiases, self.eapi) diff --git
> a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index
> d320cc75f..61d301839 100644 --- a/pym/portage/dbapi/__init__.py
> +++ b/pym/portage/dbapi/__init__.py
> @@ -216,6 +216,22 @@ class dbapi(object):
>  
>   yield cpv
>  
> + def _repoman_iuse_implicit_cnstr(self, pkg, metadata):
> + """
> + In repoman's version of _iuse_implicit_cnstr,
> account for modifications
> + of the self.settings reference between calls, and
> treat all flags as
> + valid for the empty profile because it does not have
> any implicit IUSE
> + settings. See bug 660982.
> + """
> + eapi_attrs = _get_eapi_attrs(metadata["EAPI"])
> + if eapi_attrs.iuse_effective:
> + iuse_implicit_match = lambda flag: (True if
> not self.settings.profile_path
> + else
> self.settings._iuse_effective_match(flag))
> + else:
> + iuse_implicit_match = lambda flag: (True if
> not self.settings.profile_path
> + else
> self.settings._iuse_implicit_match(flag))
> + return iuse_implicit_match
> +
>   def _iuse_implicit_cnstr(self, pkg, metadata):
>   """
>   Construct a callable that checks if a given USE flag
> should

looks good thanks.

Please add the test case ebuild that was supplied to the repoman
gen-b0rk repo "not-broken" category.

https://gitweb.gentoo.org/repo/proj/gen-b0rk.git/

-- 
Brian Dolbec 




Re: [gentoo-portage-dev] [PATCH] dbapi: fix repoman implicit IUSE (bug 660982)

2018-07-14 Thread Zac Medico
On 07/12/2018 06:36 AM, Brian Dolbec wrote:
> On Thu, 12 Jul 2018 02:59:03 -0700
> Zac Medico  wrote:
> 
>> Account for repoman modifications of the portdbapi self.settings
>> reference, and treat all flags as valid for the empty profile
>> because it does not have any implicit IUSE settings.
>>
>> Bug: https://bugs.gentoo.org/660982
>> ---
>>  pym/_emerge/Package.py|  5 -
>>  pym/portage/dbapi/__init__.py | 16 
>>  2 files changed, 20 insertions(+), 1 deletion(-)
>>
>> diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
>> index a7ce00bc9..5f34f3d27 100644
>> --- a/pym/_emerge/Package.py
>> +++ b/pym/_emerge/Package.py
>> @@ -93,7 +93,10 @@ class Package(Task):
>>  # sync metadata with validated repo (may be
>> UNKNOWN_REPO) self._metadata['repository'] = self.cpv.repo
>>  
>> -implicit_match = db._iuse_implicit_cnstr(self.cpv,
>> self._metadata)
>> +if self.root_config.settings.local_config:
>> +implicit_match =
>> db._iuse_implicit_cnstr(self.cpv, self._metadata)
>> +else:
>> +implicit_match =
>> db._repoman_iuse_implicit_cnstr(self.cpv, self._metadata) usealiases
>> = self.root_config.settings._use_manager.getUseAliases(self)
>> self.iuse = self._iuse(self, self._metadata["IUSE"].split(),
>> implicit_match, usealiases, self.eapi) diff --git
>> a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index
>> d320cc75f..61d301839 100644 --- a/pym/portage/dbapi/__init__.py
>> +++ b/pym/portage/dbapi/__init__.py
>> @@ -216,6 +216,22 @@ class dbapi(object):
>>  
>>  yield cpv
>>  
>> +def _repoman_iuse_implicit_cnstr(self, pkg, metadata):
>> +"""
>> +In repoman's version of _iuse_implicit_cnstr,
>> account for modifications
>> +of the self.settings reference between calls, and
>> treat all flags as
>> +valid for the empty profile because it does not have
>> any implicit IUSE
>> +settings. See bug 660982.
>> +"""
>> +eapi_attrs = _get_eapi_attrs(metadata["EAPI"])
>> +if eapi_attrs.iuse_effective:
>> +iuse_implicit_match = lambda flag: (True if
>> not self.settings.profile_path
>> +else
>> self.settings._iuse_effective_match(flag))
>> +else:
>> +iuse_implicit_match = lambda flag: (True if
>> not self.settings.profile_path
>> +else
>> self.settings._iuse_implicit_match(flag))
>> +return iuse_implicit_match
>> +
>>  def _iuse_implicit_cnstr(self, pkg, metadata):
>>  """
>>  Construct a callable that checks if a given USE flag
>> should
> 
> looks good thanks.

Thanks, merged:

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

> Please add the test case ebuild that was supplied to the repoman
> gen-b0rk repo "not-broken" category.
> 
> https://gitweb.gentoo.org/repo/proj/gen-b0rk.git/

Well, these ebuilds are broken in the sense that they normally produce
these results:

RepoMan scours the neighborhood...
  KEYWORDS.missing  1
   net-im/a/a-0.ebuild
  KEYWORDS.unsorted 1
   net-im/b/b-0.ebuild contains unsorted keywords
  metadata.missing [fatal]  2
   net-im/a/metadata.xml
   net-im/b/metadata.xml
-- 
Thanks,
Zac



signature.asc
Description: OpenPGP digital signature