rpm

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package rpm reads bounded RPM v4 headers for native repository metadata.

Index

Constants

View Source
const (
	KindIndex   = "rpm.index"
	PropName    = "rpm.name"
	PropVersion = "rpm.version"
	PropRelease = "rpm.release"
	PropArch    = "rpm.architecture"
)

Variables

This section is empty.

Functions

func DecodeRepomd

func DecodeRepomd(body []byte, root string) (string, string, error)

DecodeRepomd validates the published primary reference. The referenced primary is fetched and checked separately, before any virtual composition.

func IsPrimaryMetadataPath

func IsPrimaryMetadataPath(p string) bool

IsPrimaryMetadataPath recognizes the checksum-named primary indexes published by createrepo_c and older Yum tooling.

func Serves

func Serves(t repo.PackageType) bool

func SignRepomd

func SignRepomd(body []byte, armoredPrivate, passphrase string) ([]byte, error)

SignRepomd produces the armored detached signature dnf checks when repo_gpgcheck is enabled. It signs metadata, never the RPM archive itself.

Types

type Dependency

type Dependency struct {
	Name, Version string
	Flags         uint32
}

Dependency is an RPM capability and its optional epoch-version-release constraint. Flags retain the RPM sense bits until repodata is encoded.

type Handler

type Handler struct{ generic.Handler }

func (Handler) Admit

func (Handler) Admit(
	ctx context.Context,
	env format.Env,
	c repo.Config,
	w format.Write,
) (format.Write, error)

func (Handler) Classify

func (Handler) Classify(_ repo.Config, p string) format.Class

func (Handler) Deleted

func (Handler) Deleted(
	ctx context.Context,
	env format.Env,
	c repo.Config,
	removed []types.Item,
) error

func (Handler) Deleting

func (Handler) Deployed

func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error

func (Handler) Inspect

func (Handler) Inspect(
	ctx context.Context,
	env format.Env,
	_ repo.Config,
	w format.Write,
) (any, error)

func (Handler) Owed

func (Handler) Owed(c repo.Config, cached bool, p string) []format.WorkRef

func (Handler) Reindex

func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error

func (Handler) Work

func (Handler) Work(ctx context.Context, env format.Env, work types.WorkItem) error

func (Handler) WorkKinds

func (Handler) WorkKinds() []string

type Metadata

type Metadata struct {
	Files map[string][]byte
}

Metadata is a complete depth-root repodata publication. Files are keyed relative to that root, so all metadata paths sit inside repodata/.

func EncodeMetadata

func EncodeMetadata(packages []Package, root string, now time.Time) (Metadata, error)

EncodeMetadata constructs a checksum-addressed primary index and repomd from validated RPM packages. It uses SHA-256 for both metadata and RPMs.

type Package

type Package struct {
	Name, Version, Release, Architecture     string
	Summary, Description, License, URL       string
	Path                                     string
	Epoch                                    uint32
	InstalledSize                            uint64
	BuildTime                                uint32
	ArchiveSize                              int64
	SHA256                                   string
	Provides, Requires, Conflicts, Obsoletes []Dependency
}

Package is the identity and descriptive metadata read from a genuine RPM header. Path and checksums are supplied by the content-addressed item.

func DecodePrimary

func DecodePrimary(compressed []byte, root, wantSHA string) ([]Package, error)

DecodePrimary validates a checksum-addressed, bounded primary index and returns packages with repository-relative paths for native selection.

func ReadPackage

func ReadPackage(ctx context.Context, body io.ReadSeeker, size int64, p string) (Package, error)

ReadPackage validates the lead, signature and main header bounds, the package's header identity against its path, and the compressed payload digest when the RPM supplies one. The reader is the stored blob itself.

Jump to

Keyboard shortcuts

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