osrelease

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package osrelease reads the systemd os-release file from a system filesystem. System-package decomposers use it to enrich package purls with the distribution's namespace and a distro= qualifier.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ID        string // e.g. "fedora", "debian", "ubuntu", "alpine"
	VersionID string // e.g. "38", "12", "22.04"
}

Data holds the fields of the system's os-release file we use to enrich package purls. ID feeds the purl namespace; ID + VersionID feed the distro= qualifier.

func Parse

func Parse(r io.Reader) (Data, error)

Parse parses the shell-fragment format used by os-release. Each line is KEY=VALUE; VALUE may be optionally double- or single-quoted. We only extract the keys we care about.

func Read

func Read(source fs.FS) (Data, error)

Read reads the first os-release file found in source. A missing file is not an error — purls just get emitted without a namespace/distro.

func (Data) Distro

func (o Data) Distro() string

Distro returns the value for the purl distro= qualifier (e.g. "fedora-38", "debian-12") or "" when either component is missing.

func (Data) Namespace

func (o Data) Namespace() string

Namespace returns the purl namespace (the vendor, lowercased) or "" when the os-release ID is unknown.

Jump to

Keyboard shortcuts

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