Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 273096 - RFC: update to gentoolkit.package.get_mask_stutus
Summary: RFC: update to gentoolkit.package.get_mask_stutus
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 237964
  Show dependency tree
 
Reported: 2009-06-07 20:00 UTC by Douglas Anderson
Modified: 2010-02-19 15:21 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Douglas Anderson 2009-06-07 20:00:15 UTC
I just want to throw out and discuss a pending change to gentoolkit.package.get_mask_status().

The problem: equery list and hasuse mask status isn't always an accurate representation of the current masking status of the package (see bug 269699)

$ eix -e ruby
* dev-lang/ruby
     Available versions:  
        (1.8)   [M]1.8.6_p114 1.8.6_p368 ~1.8.7_p160
        (1.9)   [M]~1.9.1_p129 [M]~1.9.1_p129-r1
        {berkdb cjk debug doc emacs examples gdbm ipv6 rubytests socks5 ssl threads tk xemacs}
     Homepage:            http://www.ruby-lang.org/
     Description:         An object-oriented scripting language

# Notice eix shows 1.8.7_p160 as keyword masked (~) and all greater version
# as hard masked ([M]) and keyword masked. Current versions of equery consider some things that are only keyword masked as hard masked (notice 1.8.7_p160):

with gentoolkit-0.2.4.5:
$ equery l -p -e ruby
[ Searching for package 'ruby' in all categories among: ]
 * installed packages
 * Portage tree (/usr/portage)
[-P-] [M ] dev-lang/ruby-1.8.6_p114 (1.8)
[-P-] [  ] dev-lang/ruby-1.8.6_p368 (1.8)
[-P-] [M~] dev-lang/ruby-1.8.7_p160 (1.8)
[-P-] [M~] dev-lang/ruby-1.9.1_p129 (1.9)
[-P-] [M~] dev-lang/ruby-1.9.1_p129-r1 (1.9)

# Portage's internal masking status function, which is not currently used by
# gentoolkit, proves eix is correct:

$ python -c "import portage; print portage.getmaskingstatus('dev-lang/ruby-1.8.7_p160')"
['~x86 keyword']
$ python -c "import portage; print portage.getmaskingstatus('dev-lang/ruby-1.9.1_p129')"
['package.mask', '~x86 keyword']

The solution: use getmaskingstatus() to provide a more accurate masking status. 

# using getmaskingstatus:
$ equery l -p ruby
 * Searching for ruby ...
[-P-] [M ] dev-lang/ruby-1.8.6_p114 (1.8)
[-P-] [  ] dev-lang/ruby-1.8.6_p368 (1.8)
[-P-] [ ~] dev-lang/ruby-1.8.7_p160 (1.8)
[-P-] [M~] dev-lang/ruby-1.9.1_p129 (1.9)
[-P-] [M~] dev-lang/ruby-1.9.1_p129-r1 (1.9)

It's way faster, too :) 
---
The only problem is that with the previous method (package.is_masked()), that function made a blind assumption that the ebuild still exists on the system. In a situation where a package was installed and then the ebuild was removed from the tree, is_masked would falsely return that the package was masked, even though it is installed (so not masked). getmaskingstatus() has a different approach to dealing with non-existant ebuilds, which is to traceback:

$ equery l emeta
 * Searching for emeta ...
Traceback (most recent call last):
[snip]
KeyError: 'app-portage/emeta-2.0.5'

It does this because it knows it can't accurately report the masking status of an ebuild that's no longer on the system. For that reason, we need to introduce a new way to represent this situation. Something like:

[I-O] [--] app-portage/emeta-2.0.5 (0)

or

[I-O] [??] app-portage/emeta-2.0.5 (0)

or whatever.

After it's coded in and documented, it probably shouldn't be changed. So I'm asking democratically, what should the symbol for "unknown mask status" be?


Reproducible: Always
Comment 1 Paul Varner (RETIRED) gentoo-dev 2010-01-07 19:17:59 UTC
Let's go ahead and use ?? instead of the XX that is currently in use.  I think question marks are a litte clearer.
Comment 2 Douglas Anderson 2010-01-07 22:51:04 UTC
(In reply to comment #1)
> Let's go ahead and use ?? instead of the XX that is currently in use.  I think
> question marks are a litte clearer.
> 

Sure, fixed in r146.
Comment 3 Paul Varner (RETIRED) gentoo-dev 2010-02-19 15:21:34 UTC
Released in gentoolkit-0.3.0_rc9