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

Bug 540544

Summary: portageq: add commands for probing repos.conf
Product: Portage Development Reporter: Nikoli <nikoli>
Component: ToolsAssignee: Portage Tools Team <tools-portage>
Status: CONFIRMED ---    
Severity: enhancement    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Nikoli 2015-02-18 17:10:16 UTC
# portageq portdir
WARNING: 'portageq portdir' is deprecated. Use 'portageq repositories_configuration' instead.
/var/package-manager/portage

But 'portageq repositories_configuration /' is just like 'cat /etc/portage/repos.conf/*', it is not replacement for 'portageq portdir'. Adding 'get_main-repo' command would help:
portageq get_repo_path / $(portageq get_main-repo)
Comment 1 SpanKY gentoo-dev 2015-05-31 05:27:36 UTC
i don't think adding a specific command here is the right way to go.  since repos.conf is a collection of ini files, a command that lets you probe fields out of that would be more useful.

something like:
  portageq repositories_configuration <eroot> [section] [key]

then you could do:
  $ portageq repositories_configuration / gentoo location
  /usr/portage

and we can treat the DEFAULT section specially: if the requested key doesn't exist in the DEFAULT section, then look it up in the specified main-repo.
  # This returns DEFAULT.main-repo.
  $ portageq repositories_configuration / DEFAULT main-repo
  gentoo

  # Since DEFAULT.location doesn't exist, it looks up DEFAULT.main-repo, gets
  # back e.g. gentoo, then looks up gentoo.location.
  $ portageq repositories_configuration / DEFAULT location
  /usr/portage

now you have an exact replacement for `portageq envvar PORTDIR`.

this doesn't provide a replacement for `portageq envvar PORTDIR_OVERLAYS` though.  maybe we can accept options like:
  portageq repositories_configuration <eroot> [--list] [section] [key]

which would let you do:
  # This would set sections to e.g. gentoo (filters out DEFAULT).
  sections=$(portageq repositories_configuration / --list)
  overlays=$(for s in ${sections}; do
    portageq repositories_configuration / ${s} location; done)

by default we should return the sections in order of their priority