rpm

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildOptions

type BuildOptions struct {
	// 'with' flags.
	With []string
	// 'without' flags.
	Without []string
	// Custom macro defines.
	Defines map[string]string
}

BuildOptions encapsulates standard options for build-related RPM commands that may run in a mock environment.

type RPMExtractor

type RPMExtractor interface {
	// Extract extracts the contents of an RPM to the specified destination directory
	Extract(rpmStream io.Reader, destDir string) error
}

RPMExtractor interface defines methods for extracting RPM packages.

func NewRPMExtractorImpl

func NewRPMExtractorImpl(fs opctx.FS) (RPMExtractor, error)

NewRPMExtractorImpl creates a new RPMExtractor instance with the provided file system.

type RPMExtractorImpl

type RPMExtractorImpl struct {
	// contains filtered or unexported fields
}

RPMExtractorImpl implements RPMExtractor.

func (*RPMExtractorImpl) Extract

func (e *RPMExtractorImpl) Extract(rpmStream io.Reader, destinationPath string) (err error)

Extract extracts the contents of an RPM file to the specified destination directory If destDir is empty, it will extract to the current directory.

type RQRepoQuerier

type RQRepoQuerier struct {
	// contains filtered or unexported fields
}

RQRepoQuerier implements RepoQuerier as a wrapper around the "repoquery" command.

func NewRQRepoQuerier

func NewRQRepoQuerier(cmdFactory opctx.CmdFactory, options ...RepoQuerierOption) (*RQRepoQuerier, error)

NewRQRepoQuerier creates a new RQRepoQuerier instance. Multiple repository URLs can be provided, the order is irrelevant. All URLs must be valid according to url.ParseRequestURI.

func (*RQRepoQuerier) GetLatestVersion

func (q *RQRepoQuerier) GetLatestVersion(ctx context.Context, packageName string) (*Version, error)

GetLatestVersion returns the latest version of a component in the repository.

func (*RQRepoQuerier) GetRPMLocation

func (q *RQRepoQuerier) GetRPMLocation(ctx context.Context, packageName string, version *Version) (string, error)

GetRPMLocation returns the URL for the RPM of a component.

type RepoQuerier

type RepoQuerier interface {
	// GetLatestVersion returns the latest version of a component in the repository.
	GetLatestVersion(ctx context.Context, packageName string) (*Version, error)

	// GetRPMLocation returns the URL for the RPM of a component.
	GetRPMLocation(ctx context.Context, packageName string, version *Version) (string, error)
}

RepoQuerier interface defines methods for querying an RPM repository.

type RepoQuerierOption

type RepoQuerierOption func(*repoQuerierConfig)

RepoQuerierOption represents an option that can be passed to NewRQRepoQuerier.

func WithBaseURLs

func WithBaseURLs(baseURLs ...string) RepoQuerierOption

WithBaseURLs provides a RepoQuerier with the base URLs to query.

func WithReleaseVer

func WithReleaseVer(releaseVer string) RepoQuerierOption

WithReleaseVer allows requesting a RepoQuerier to use a custom "releasever", e.g., to support URLs that contain `$releasever`.

NOTE: in case WithReleaseVer is passed multiple times, only the last one will take effect.

type SpecInfo

type SpecInfo struct {
	Name          string
	Version       Version
	RequiredFiles []string
}

SpecInfo encapsulates information extracted from an RPM spec file.

type SpecQuerier

type SpecQuerier struct {
	// contains filtered or unexported fields
}

SpecQuerier is a wrapper around querying RPM spec files using the `rpmspec` command. The latter is executed within an isolated environment, ensuring insulation from the host system.

func NewSpecQuerier

func NewSpecQuerier(buildEnv buildenv.BuildEnv, buildOptions BuildOptions) *SpecQuerier

NewSpecQuerier constructs a new SpecQuerier instance that will use the provided buildenv.BuildEnv to run commands in an isolated environment. The provided BuildOptions will be used to influence the environment within which the spec is queried.

func (*SpecQuerier) QuerySpec

func (q *SpecQuerier) QuerySpec(ctx opctx.Ctx, specPath string) (specInfo *SpecInfo, err error)

QuerySpec queries the given spec file, returning information it parsed from the spec.

type Version

type Version struct {
	// contains filtered or unexported fields
}

Version is a wrapper around the RPM version implementation from github.com/knqyf263/go-rpm-version, preventing creation of invalid versions.

func NewVersion

func NewVersion(fullVersionString string) (*Version, error)

NewVersion creates a new Version from a string and returns an error if the version format is invalid.

func NewVersionFromEVR

func NewVersionFromEVR(epoch, version, release string) (*Version, error)

NewVersionFromEVR creates a new Version from epoch, version, and release strings.

func (*Version) Compare

func (v *Version) Compare(other *Version) int

Compare compares this version with another version. Returns -1, 0, or 1 if this version is less than, equal to, or greater than the other version.

func (*Version) Epoch

func (v *Version) Epoch() int

Epoch returns the epoch part of the RPM version.

func (*Version) Equal

func (v *Version) Equal(other *Version) bool

Equal returns true if this version is equal to the other version.

func (*Version) GreaterThan

func (v *Version) GreaterThan(other *Version) bool

GreaterThan returns true if this version is greater than the other version.

func (*Version) LessThan

func (v *Version) LessThan(other *Version) bool

LessThan returns true if this version is less than the other version.

func (*Version) MarshalJSON

func (v *Version) MarshalJSON() ([]byte, error)

MarshalJSON serializes the version to JSON, thereby implementing json.Marshaler.

func (*Version) Release

func (v *Version) Release() string

Release returns the release part of the RPM version.

func (*Version) String

func (v *Version) String() string

String returns the string representation of the version.

func (*Version) Version

func (v *Version) Version() string

Version returns the version part of the RPM version.

Directories

Path Synopsis
Package rpm_test is a generated GoMock package.
Package rpm_test is a generated GoMock package.

Jump to

Keyboard shortcuts

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