Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 540544 - portageq: add commands for probing repos.conf
Summary: portageq: add commands for probing repos.conf
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-18 17:10 UTC by Nikoli
Modified: 2015-05-31 05:27 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 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