Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 468842

Summary: "equery uses" shows special USE_EXPAND use flags, "equery hasuse" could search them too
Product: Portage Development Reporter: Zoltán Halassy <zhalassy>
Component: Enhancement/Feature RequestsAssignee: Portage Tools Team <tools-portage>
Status: RESOLVED INVALID    
Severity: enhancement    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 346443    

Description Zoltán Halassy 2013-05-07 09:08:02 UTC
equery uses gives back special flags in the use-flag list:

# equery u dev-php/xdebug
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for dev-php/xdebug-2.2.1:
 U I
 - - php_targets_php5-3 : Build against PHP 5.3
 + + php_targets_php5-4 : Build against PHP 5.4


However, we cannot search for them:

# equery h php_targets_php5-4
 * Searching for USE flag php_targets_php5-4 ... 
#

It would be nice, if we could do that too. Possibly not by default, but with an extra option which could be useful even when it would take much longer to perform.
Comment 1 Brian Dolbec (RETIRED) gentoo-dev 2013-05-07 14:25:04 UTC
You can use equery's "has" module to find them.  It is just a generalized string search that I took from the hasuse code.  It searches the specified environment variable for the string.

equery has USE php_targets_php5-4
Comment 2 Zoltán Halassy 2013-05-08 08:09:49 UTC
(In reply to comment #1)
> You can use equery's "has" module to find them.  It is just a generalized
> string search that I took from the hasuse code.  It searches the specified
> environment variable for the string.
> 
> equery has USE php_targets_php5-4

Strange. It does not work, neither this (the way it's told in the ebuild):

# equery a USE_PHP php5-4
 * Searching for USE_PHP php5-4 ... 
#

nor this (the way we need to specify in make.conf):

# equery a PHP_TARGETS php5-4
 * Searching for PHP_TARGETS php5-4 ... 
#

According to the documentation, "has" searches in /var/db/pkg, isn't that the place for the installed ebuilds?
Comment 3 Zoltán Halassy 2013-05-08 08:19:39 UTC
Never mind what I just wrote, I'm dumb. Hasuse actually searches for installed packages only too (and it would be cool to be able to search for non-installed packages too (for the existence of the flag), but that's offtopic)
Comment 4 Zoltán Halassy 2013-05-08 08:21:54 UTC
Meh, this whole bug is invalid then, it simply works as it is intended. Sorry. Close it as INVALID.
Comment 5 Brian Dolbec (RETIRED) gentoo-dev 2013-05-08 13:23:45 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > You can use equery's "has" module to find them.  It is just a generalized
> > string search that I took from the hasuse code.  It searches the specified
> > environment variable for the string.
> > 
> > equery has USE php_targets_php5-4
> 
> Strange. It does not work, neither this (the way it's told in the ebuild):
> 
> # equery a USE_PHP php5-4
>  * Searching for USE_PHP php5-4 ... 
> #
> 
> nor this (the way we need to specify in make.conf):
> 
> # equery a PHP_TARGETS php5-4
>  * Searching for PHP_TARGETS php5-4 ... 
> #
> 
> According to the documentation, "has" searches in /var/db/pkg, isn't that
> the place for the installed ebuilds?




equery commands nearly all default to just searching installed pkgs.  But they all have the option to search the entire tree and/or overlays.

big_daddy brian # equery has -h
List all installed packages that match for a given ENVIRONMENT variable

Usage: has [options] env_var [expr]

options
 -h, --help              display this help message
 -I, --exclude-installed exclude installed packages from search path
 -o, --overlay-tree      include overlays in search path
 -p, --portage-tree      include entire portage tree in search path
 -F, --format=TMPL       specify a custom output format
              TMPL       a format template using (see man page):
big_daddy brian # equery hasuse -h USE python_targets_python2_7
List all installed packages that have a given USE flag

Usage: hasuse [options] USE-flag

options
 -h, --help              display this help message
 -I, --exclude-installed exclude installed packages from search path
 -o, --overlay-tree      include overlays in search path
 -p, --portage-tree      include entire portage tree in search path
 -F, --format=TMPL       specify a custom output format
              TMPL       a format template using (see man page):
                         $location, $mask, $mask2, $cp, $cpv, $category, $name, $version, $revision, $fullversion, $slot, $repo, $keywords
big_daddy brian # 

The "has" module can not search for USE in the portage tree, it does not exist, it is only in the installed pkgs.  The other thing to remember is that in IUSE the variables are not yet use expanded, so a string search there needs to be tailored for the un-expanded USE flag.

To use "hasuse" or "has" to search for use_expanded flags in the installed pkgs.  They have to be in the fully expanded form.  Just like I posted in the example I gave in comment #1.

search installed pkgs only:
equery hasuse php_targets_php5-4

search the whole tree:
equery hasuse -p php_targets_php5-4

^NOTE in the 2nd example that you need to specify the fully expanded use_exapnd flag 

ex:
big_daddy brian # equery hasuse -p php_targets_php5-4
 * Searching for USE flag php_targets_php5-4 ... 
[-P-] [  ] dev-libs/ossp-uuid-1.6.2-r2:0
[-P-] [  ] dev-libs/xapian-bindings-1.2.13:0
[-P-] [  ] dev-libs/xapian-bindings-1.2.14:0
[-P-] [  ] dev-php/ffmpeg-php-0.6.0-r2:0
[-P-] [  ] dev-php/igbinary-1.1.1-r1:0
...
Comment 6 Zoltán Halassy 2013-05-08 13:34:12 UTC
(In reply to comment #5)
> equery hasuse -p php_targets_php5-4

That was exactly what I was looking for. Thank you Brian for pointing this out. equery works perfectly. Sorry for the noise.