Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 656550 - app-portage/portage-utils: provide functionality similar to `equery uses'
Summary: app-portage/portage-utils: provide functionality similar to `equery uses'
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-26 06:45 UTC by consus
Modified: 2019-06-13 18:42 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 consus 2018-05-26 06:45:45 UTC
Hello,

I'm missing the ability to list atom's USE flags (I + U) with descriptions and I want to add it to portage-utils. Is that something you guys would accept? What is the best way to do this (e.g. new quses applet or qsearch enhancement)? Maybe someone is already working on it?
Comment 1 Fabian Groffen gentoo-dev 2018-05-26 07:40:04 UTC
Can you give an example of what you'd like to see?

Currently you can do this:
% qlist -IU hashgen
app-portage/hashgen (openmp)
% quse -D openmp
 global:openmp: Build support for the OpenMP (support parallel computing), requires >=sys-devel/gcc-4.2 built with USE="openmp"
 local:openmp:sys-devel/clang-runtime: Install sys-libs/libomp for -fopenmp support
Comment 2 consus 2018-05-26 18:29:33 UTC
Of course. For example, if I want to see which USE flags x11-terms/rxvt-unicode has I do the following:

$ equery uses rxvt-unicode
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for x11-terms/rxvt-unicode-9.21:
 U I
 + + 256-color            : Enable 256 color support
 - - alt-font-width       : Calculate the font width using a different method
 + + blink                : Enable blinking text
 + + buffer-on-clear      : Store visible output to history buffer when clearing the screen with ctrl-l. Read https://bbs.archlinux.org/viewtopic.php?id=129302
 + + fading-colors        : Enable colors fading when off focus
 + + focused-urgency      : Enable the urgent flag when a terminal window is focused
 + + font-styles          : Enable support for bold and italic fonts
 - - iso14755             : Enable ISO-14755 support
 + + mousewheel           : Enable scrolling via mouse wheel or buttons 4 and 5
 + + perl                 : Enable perl script support. You can still disable this at runtime with -pe ""
 + + pixbuf               : Enable transparency support using gtk's pixbuf
 - - secondary-wheel      : Support for wheel scrolling on secondary screens (like mutt). Read http://lists.schmorp.de/pipermail/rxvt-unicode/2011q4/001491.html
 - - startup-notification : Enable application startup event feedback mechanism
 - - unicode3             : Use 21 instead of 16 bits to represent unicode characters
 - - vanilla              : Do not add extra patches which change default behaviour; DO NOT USE THIS ON A GLOBAL SCALE as the severity of the meaning changes drastically
 + + wcwidth              : Enable wide char width support
 + + xft                  : Build with support for XFT font renderer (x11-libs/libXft)

And now I can tell what flags are used now (I column) and what flags will be set after the update (U column). And I also have all the descriptions.
Comment 3 consus 2018-05-26 18:32:52 UTC
Also `qlist -IU <package>' shows only the used flags.
Comment 4 Fabian Groffen gentoo-dev 2018-05-27 07:23:47 UTC
Correct, only the I column '+' rows are available to qlist (from the VDB), all other entries need to be retrieved, which is more work.
Comment 5 consus 2018-05-27 07:34:50 UTC
I'm interested in writing a patch. Will you guys accept it?
Comment 6 consus 2018-05-27 07:38:36 UTC
By patch I mean displaying both current and possible flags with descriptions. And since qlist shows only installed packages it would be saner to write a separate applet (e.g. quses).
Comment 7 Fabian Groffen gentoo-dev 2018-05-27 07:45:36 UTC
In principle, yes.  I do have some reservations about how "clean" this is going to be.  I don't know what you have in mind, but if the objective is to exactly replicate what equery does, then I'm not that excited: we already have a tool that does it.

There is bits of code that build a cache, or read the md5-cache, or read the ebuild tree, that should be re-usable.  In fact I think it must be.

A new quses applet?  My vote: no.  quse already exists, and it seems that perhaps it is better suited to extend that tool.  In fact, it already searches for USE-flags in the tree (showing all of them per ebuild).  Another app that this feature might belong to, is qsearch.  Basically to have a mode which lists USE-flags and their description.
Comment 8 consus 2018-05-27 08:01:51 UTC
(In reply to Fabian Groffen from comment #7)
> In principle, yes.  I do have some reservations about how "clean" this is
> going to be.  I don't know what you have in mind, but if the objective is to
> exactly replicate what equery does, then I'm not that excited: we already
> have a tool that does it.
> 
> There is bits of code that build a cache, or read the md5-cache, or read the
> ebuild tree, that should be re-usable.  In fact I think it must be.
> 
> A new quses applet?  My vote: no.  quse already exists, and it seems that
> perhaps it is better suited to extend that tool.  In fact, it already
> searches for USE-flags in the tree (showing all of them per ebuild). 
> Another app that this feature might belong to, is qsearch.  Basically to
> have a mode which lists USE-flags and their description.

Sure, I can extend quse for that.

$ quse -U rxvt-unicode
I U
+ + 256-color              Enable 256 color support
- - alt-font-width         Calculate the font width using a different method
+ + blink                  Enable blinking text
+ + buffer-on-clear        Store visible output to history buffer when clearing the screen with ctrl-l. Read https://bbs.archlinux.org/viewtopic.php?id=129302
+ + fading-colors          Enable colors fading when off focus
+ + focused-urgency        Enable the urgent flag when a terminal window is focused
+ + font-styles            Enable support for bold and italic fonts
- - iso14755               Enable ISO-14755 support
+ + mousewheel             Enable scrolling via mouse wheel or buttons 4 and 5
+ + perl                   Enable perl script support. You can still disable this at runtime with -pe ""
+ + pixbuf                 Enable transparency support using gtk's pixbuf
- - secondary-wheel        Support for wheel scrolling on secondary screens (like mutt). Read http://lists.schmorp.de/pipermail/rxvt-unicode/2011q4/001491.html
- - startup-notification   Enable application startup event feedback mechanism
- - unicode3               Use 21 instead of 16 bits to represent unicode characters
- - vanilla                Do not add extra patches which change default behaviour; DO NOT USE THIS ON A GLOBAL SCALE as the severity of the meaning changes drastically
+ + wcwidth                Enable wide char width support
+ + xft                    Build with support for XFT font renderer (x11-libs/libXft)

Something like this will be ok? I'm not quite sure about the option name here though.
Comment 9 Fabian Groffen gentoo-dev 2018-05-28 10:29:40 UTC
isn't this identical output to equery uses?
Comment 10 consus 2018-05-28 20:20:42 UTC
Yes. The main idea for me is to drop equery (and gentoolkit) entirely. Since portage-utils already implements a lot of functionality that equery does (belongs, check, depends, etc) I thought that it would be ok to add this one.
Comment 11 Larry the Git Cow gentoo-dev 2019-05-03 08:50:42 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=47c13a275a7b76d77e5ac3e3ada5024bfc5372bd

commit 47c13a275a7b76d77e5ac3e3ada5024bfc5372bd
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2019-05-03 08:47:26 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2019-05-03 08:47:26 +0000

    quse: make -v output faster, format and introduce --repo
    
    - improve performance for -v output (listing all use-flags with
      descriptions per package match)
    - add -R/--repo flag to print repository next to atom
    - align USE-flags in -v mode per package
    
    Bug: https://bugs.gentoo.org/656550
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 TODO.md    |   1 -
 man/quse.1 |   3 ++
 quse.c     | 171 +++++++++++++++++++++++++++++++++++++++++++++----------------
 3 files changed, 131 insertions(+), 44 deletions(-)
Comment 12 Fabian Groffen gentoo-dev 2019-05-03 08:53:07 UTC
quse now has something that comes close to this, remaining work is to read VDB to query about currently used flags for the package

% ./quse -v -p rxvt-unicode
x11-terms/rxvt-unicode-9.21
  256-color             Enable 256 color support
  alt-font-width        Calculate the font width using a different method
  blink                 Enable blinking text
  buffer-on-clear       Store visible output to history buffer when clearing the screen with ctrl-l. Read https://bbs.archlinux.org/viewtopic.php?id=129302
 +focused-urgency       Enable the urgent flag when a terminal window is focused
  fading-colors         Enable colors fading when off focus
 +font-styles           Enable support for bold and italic fonts
  gdk-pixbuf            Enable transparency support using x11-libs/gdk-pixbuf
  iso14755              Enable ISO-14755 support
 +mousewheel            Enable scrolling via mouse wheel or buttons 4 and 5
 +perl                  Enable perl script support. You can still disable this at runtime with -pe ""
  secondary-wheel       Support for wheel scrolling on secondary screens (like mutt). Read http://lists.schmorp.de/pipermail/rxvt-unicode/2011q4/001491.html
  startup-notification  Enable application startup event feedback mechanism
  xft                   Build with support for XFT font renderer (x11-libs/libXft)
  unicode3              Use 21 instead of 16 bits to represent unicode characters
 +vanilla               Do not add extra patches which change default behaviour; DO NOT USE THIS ON A GLOBAL SCALE as the severity of the meaning changes drastically
  wcwidth               Enable wide char width support
Comment 13 Larry the Git Cow gentoo-dev 2019-06-12 09:13:24 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=753605792fab143ded32ebabbf85cc840151f0d2

commit 753605792fab143ded32ebabbf85cc840151f0d2
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2019-06-12 09:11:44 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2019-06-12 09:11:44 +0000

    quse: add mode for querying installed packages (only)
    
    Instead of traversing the tree(s), look in the VDB (= installed
    packages).  While doing this, when using -v, we can print the enabled
    flags next to the flag and its description, as with `equery uses'.
    
    Bug: https://bugs.gentoo.org/656550
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 man/include/quse.optdesc.yaml |  4 +++
 man/quse.1                    |  7 +++-
 quse.c                        | 81 +++++++++++++++++++++++++++++++++++--------
 3 files changed, 76 insertions(+), 16 deletions(-)
Comment 14 Larry the Git Cow gentoo-dev 2019-06-13 08:41:35 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e75a1a31fa0d05ab0db3548d848ddb602038ce01

commit e75a1a31fa0d05ab0db3548d848ddb602038ce01
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2019-06-13 08:36:53 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2019-06-13 08:36:53 +0000

    quse: improve per package USE-flag output somewhat
    
    - add asterisk at the end of USE-flag instead of at the start of the
      line to mark currently enabled flag (installed package)
    - colour such enabled flags green so they stand out better
    - wrap descriptions when they don't fit on the terminal screen
    
    example:
    
    app-portage/portage-utils-0.80_pre20190610
      nls*        Add Native Language Support (using gettext - GNU locale utilities)
      static      !!do not set this during bootstrap!! Causes binaries to be
                  statically linked instead of dynamically
      openmp      Build support for the OpenMP (support parallel computing),
                  requires >=sys-devel/gcc-4.2 built with USE="openmp"
     +qmanifest*  Build qmanifest applet, this adds additional dependencies for GPG,
                  OpenSSL and BLAKE2B hashing
      libressl*   Use dev-libs/libressl instead of dev-libs/openssl when applicable
                  (see also the ssl useflag)
    
    Bug: https://bugs.gentoo.org/656550
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 applets.h   |  1 +
 main.c      |  8 ++++++++
 qmanifest.c |  7 -------
 quse.c      | 40 +++++++++++++++++++++++++++++++++++++---
 4 files changed, 46 insertions(+), 10 deletions(-)
Comment 15 Larry the Git Cow gentoo-dev 2019-06-13 18:42:17 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e61293852173070b2dc076198a895909799c667

commit 6e61293852173070b2dc076198a895909799c667
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2019-06-13 18:42:01 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2019-06-13 18:42:01 +0000

    app-portage/portage-utils: version bump of 0.80 RC
    
    Closes: https://bugs.gentoo.org/687982
    Closes: https://bugs.gentoo.org/656550
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>
    Package-Manager: Portage-2.3.66, Repoman-2.3.11

 app-portage/portage-utils/Manifest                                      | 2 +-
 ...ls-0.80_pre20190610.ebuild => portage-utils-0.80_pre20190613.ebuild} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)