sourceproviders

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: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchLocalComponent

func FetchLocalComponent(
	dryRunnable opctx.DryRunnable, eventListener opctx.EventListener,
	fileSystem opctx.FS, component components.Component, destDirPath string,
	resolveRequiredFiles bool,
) error

FetchLocalComponent retrieves the `.spec` file and any sidecar files for the specified component from the local filesystem, placing the fetched files in the provided directory. If resolveRequiredFiles is true, files referenced by the spec's contents (e.g., patches, additional sources) will be searched for recursively in the source directory.

Types

type ComponentSourceProvider

type ComponentSourceProvider interface {
	Provider

	// GetComponent retrieves the `.spec` for the specified component along with any sidecar
	// files stored along with it, placing the fetched files in the provided directory.
	GetComponent(ctx context.Context, component components.Component, destDirPath string) error
}

ComponentSourceProvider is an abstract interface implemented by a source provider that can retrieve the full file contents of a given component.

type FedoraSourcesProviderImpl

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

FedoraSourcesProviderImpl implements ComponentSourceProvider for Git repositories.

func NewFedoraSourcesProviderImpl

func NewFedoraSourcesProviderImpl(
	fs opctx.FS,
	dryRunnable opctx.DryRunnable,
	gitProvider git.GitProvider,
	downloader fedorasource.FedoraSourceDownloader,
	distro ResolvedDistro,
	retryCfg retry.Config,
) (*FedoraSourcesProviderImpl, error)

func (*FedoraSourcesProviderImpl) GetComponent

func (g *FedoraSourcesProviderImpl) GetComponent(
	ctx context.Context, component components.Component, destDirPath string,
) (err error)

type FileSourceProvider

type FileSourceProvider interface {
	Provider

	// GetFiles retrieves the specified source files and places them in the provided directory. If a file
	// is not known to (or handled by) the providers, the error will be (or will wrap) ErrNotFound.
	GetFiles(ctx context.Context, fileRefs []projectconfig.SourceFileReference, destDirPath string) error
}

FileSourceProvider is an abstract interface implemented by a source provider that can retrieve individual source files.

type Provider

type Provider interface{}

Provider is an abstract interface implemented by a source provider.

type RPMContentsProviderImpl

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

RPMContentsProviderImpl implements ComponentSourceProvider. It relies on rpmprovider.RPMProvider to download the RPM file.

func NewRPMContentsProviderImpl

func NewRPMContentsProviderImpl(
	extractor rpm.RPMExtractor,
	rpmProvider rpmprovider.RPMProvider,
) (*RPMContentsProviderImpl, error)

NewRPMContentsProviderImpl creates a new instance of RPMContentsProviderImpl.

func (*RPMContentsProviderImpl) GetComponent

func (r *RPMContentsProviderImpl) GetComponent(
	ctx context.Context, component components.Component, destDirPath string,
) (err error)

GetComponent downloads the source RPM for a component and extracts its contents in the provided destination path.

type ResolvedDistro

type ResolvedDistro struct {
	// Ref is the effective distro reference (component override or project default).
	// Contains the snapshot time used for commit selection.
	Ref projectconfig.DistroReference

	// Definition is the resolved distro definition containing base URIs.
	Definition projectconfig.DistroDefinition

	// Version is the resolved distro version definition containing branch info.
	Version projectconfig.DistroVersionDefinition
}

ResolvedDistro holds the fully resolved distro configuration for a component. This is resolved once at the call site and passed through the source manager to providers, so each consumer can derive only what it needs.

func ResolveDistro

func ResolveDistro(env *azldev.Env, component components.Component) (ResolvedDistro, error)

ResolveDistro resolves the effective distro for a component, falling back to the project's default distro when the component doesn't specify one. Returns an error if no effective distro can be resolved.

type SourceManager

type SourceManager interface {
	// FetchFiles fetches the given source files, placing the files in the provided directory.
	FetchFiles(ctx context.Context, component components.Component, destDirPath string) error

	// FetchComponent fetches an entire upstream component, including its `.spec` file and any sidecar files.
	FetchComponent(ctx context.Context, component components.Component, destDirPath string) error
}

SourceManager is an abstract interface for a facility that can fetch arbitrary component sources.

func NewSourceManager

func NewSourceManager(env *azldev.Env, distro ResolvedDistro) (SourceManager, error)

Directories

Path Synopsis
fedorasource_test
Package fedorasource_test is a generated GoMock package.
Package fedorasource_test is a generated GoMock package.
Package sourceproviders_test is a generated GoMock package.
Package sourceproviders_test is a generated GoMock package.

Jump to

Keyboard shortcuts

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