Synopsis

inventory [-i | --include-base-packages] [-b | --bare | -j | --jsonl | -t | --tsv | -p | --probe] [-r | --reverse] [-v | --verbose]

Description

inventory reports installed packages known to supported package managers. It probes each supported installer, skips installers that are not available on the host, gathers package records, sorts them by date, and writes a report to standard output.

Each package record has these fields:

  • date

  • installer

  • package

  • version

  • summary

By default, the report is sorted newest first. Packages without a usable date sort as older than packages with dates.

Options

-i, --include-base-packages

Include packages considered part of the base system installation. By default, inventory omits base/system packages where the installer can identify them.

-b, --bare*

Write only the installer and package fields, separated by a tab, with no header row. This format is intended for tests and simple set comparisons.

-j, --jsonl

Write one JSON object per package record, one record per line.

--tsv

Write a tab-separated report with a header row.

-p, --probe

List all package-manager backends present on your system (with -v, all supported by inventory), including each backend’s user-installed filter reliability and date-stamp quality, then exit without probing the host or collecting package records.

-r, --reverse

Reverse the date sort order. The default order is newest first; this option sorts oldest first.

-v, --verbose

Report installer probing and collection diagnostics to standard error. This does not change the selected standard-output report format.

Output Formats

The default output format is a padded text report. The fields before the summary are right-padded to the width of the longest value in that field. The summary field is not padded.

The --tsv output format writes the same fields separated by tab characters. Tab, carriage-return, and newline characters inside field values are replaced with spaces. Version is omitted.

The --bare output format writes one tab-separated installer and package pair per line, with no header.

The --jsonl output format writes one JSON object per line. It is intended for programs that want to consume the inventory without parsing text columns.

The --probe output is not a package report. It writes a padded table with backend, user filter, date quality, and distributions columns.

In the --probe report, interpret the userfilter member like this:

always

inventory uses native package-manager state that directly answers the user/ manual vs dependency/base question.

conditional

inventory can use reliable metadata, but the current code may fall back to reporting everything if that metadata/query is unavailable.

best-effort

inventory applies a heuristic or partial filter. It may filter base but not dependencies, dependencies but not base, app/runtime classes, selected sets, or path-based base records.

never

inventory has no useful distinction in current code; default mode and --include-base-packages are effectively identical.

Interpret the date quality field like this:

native

per-package timestamp from the package manager’s own installed-package database or property. Best available, but still not an audit log.

mixed

prefers a recorded/native timestamp, but can fall back to filesystem mtimes, so quality can vary by package or host.

mtime

inferred from per-package files, directories, venvs, binaries, metadata files, receipts, or deployment trees.

weak

especially low-confidence timestamp, such as a shared database mtime or store- path mtime that may not correspond to when the package became visible.

none

backend does not currently emit usable dates.

Exit Status

0

Successful completion.

Nonzero

Command-line parsing failed or Python terminated with an unhandled exception.

Installer-specific failures are reported to standard error when possible, and collection continues with the remaining installers.

If no supported package manager is available, inventory writes a warning to standard error and emits an empty report in the requested output format. With --probe, the same warning is written and no package-manager names are emitted.

Author

Eric S. Raymond <esr@thyrsus.com>