sysinv

package
v4.24.37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sysinv reads the operating system's own record of what is installed under a root filesystem: the dpkg, apk, pacman and rpm package databases and /etc/os-release. The root is a live system ("/"), a mounted volume, an unpacked image or /proc/<pid>/root — every path is joined under it and none is followed out of it.

It exists so that a distro package is named the way the distro's own security advisories name it. Amazon Linux, RHEL and Debian backport fixes without moving the upstream version, so "openssl 3.0.8" is affected upstream and fixed in 3.0.8-1.amzn2023.0.12. A match is only right when the purl carries the full distro version, the release it was built for (distro=amazon-2023) and, for Debian, the source package the advisory is filed against (upstream=).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Distro

type Distro struct {
	ID         string   // os-release ID: debian, ubuntu, amzn, rhel, alpine, …
	IDLike     []string // os-release ID_LIKE
	VersionID  string   // os-release VERSION_ID: 12, 2023, 3.19.1, …
	PrettyName string
	// UbuntuCodename and DebianCodename are what a derivative names its base
	// release by (Linux Mint, Pop!_OS: UBUNTU_CODENAME=noble; LMDE:
	// DEBIAN_CODENAME=bookworm).
	UbuntuCodename string
	DebianCodename string
}

Distro is the part of os-release a package match depends on.

func ReadOSRelease

func ReadOSRelease(root string) Distro

ReadOSRelease parses etc/os-release, falling back to usr/lib/os-release as os-release(5) specifies.

func (Distro) Namespace

func (d Distro) Namespace() string

Namespace is the purl namespace for this distro's packages, using the vendor names the advisory feeds and other scanners use rather than os-release's abbreviations: amzn is amazon, rhel is redhat, ol is oracle. A derivative takes its base's (base).

func (Distro) Release

func (d Distro) Release() string

Release is the purl distro qualifier: namespace-version, with Alpine cut to major.minor because its secdb is per branch (alpine-3.19, not alpine-3.19.1). Blank when os-release gives no version (Arch, Wolfi), so no qualifier is invented for a rolling release.

type Package

type Package struct {
	Name string
	// Version is the version the distro's advisories compare against: dpkg's
	// Version field as written (epoch included), apk's V:, pacman's %VERSION%,
	// and for rpm version-release with the epoch carried separately.
	Version string
	// Epoch is rpm's epoch when the package declares one; nil otherwise.
	Epoch *int
	Arch  string
	// Ecosystem is deb, apk, arch or rpm.
	Ecosystem string
	// SourceName is the source package the binary package was built from
	// (dpkg Source, apk origin, pacman %BASE%, the rpm SRPM's name). Debian
	// and Alpine advisories name the source package, not the binary one.
	SourceName string
	License    string
	// DB is the package database the entry came from, relative to the root.
	DB string
	// Files lists the absolute in-root paths the package installed, when the
	// database records them (rpm). The dpkg, apk and pacman file lists are
	// read by binpkg directly.
	Files []string
}

Package is one installed OS package.

func (Package) Purl

func (p Package) Purl(d Distro) string

Purl renders the package URL with the qualifiers a distro advisory match needs. The layout follows the purl spec and what Syft and Trivy emit, so the same package is the same string across tools.

type Result

type Result struct {
	Distro   Distro
	Packages []Package
	// Warnings name databases that exist but could not be read. A system with
	// an unreadable rpmdb is not a system with no packages, and a caller must
	// not report it as one.
	Warnings []string
	// Unsupported says why this system's packages cannot be read at all: a
	// distribution whose package manager keeps no database read here. Such a
	// host is unchecked, never a host with nothing installed.
	Unsupported string
}

Result is everything read from one root.

func Collect

func Collect(root string) Result

Collect reads every package database present under root.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL