Documentation
¶
Overview ¶
Package pkgdb reads Portage's installed-package database (/var/db/pkg): one directory per installed package at <root>/<CATEGORY>/<PF>/, holding a SLOT file and, for packages installed from a named repository, a repository file.
Index ¶
Constants ¶
const DefaultRoot = "/var/db/pkg"
DefaultRoot is where Portage keeps the installed-package database.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Package ¶
type Package struct {
Category string
Name string
// Version keeps the revision (e.g. "1.0-r3") so ebuild.CompareVersions
// can order it.
Version string
// Slot is the part of the SLOT record before "/" (the subslot is dropped).
Slot string
// Repo is the repository record, or empty when the package has none
// (such a package is not installed from any named repository).
Repo string
}
Package is one installed package.
func Read ¶
Read returns every installed package under root, in directory order (category, then PF, both sorted by name).
An entry that cannot be read — an unreadable category directory, or a package directory whose SLOT or repository record cannot be read — is skipped and counted in skipped, never fatal, so one bad entry does not hide the rest. Entries that are not packages (stray files, directory names without a version part) are ignored without being counted. A missing repository record yields an empty Repo.
err is non-nil only when root itself cannot be listed or ctx is done; it wraps the cause with %w and names root.