Documentation
¶
Index ¶
- Constants
- type BuildLogDetails
- type CommonBuildOptions
- type RPMBuildOptions
- type Runner
- func (r *Runner) AddBindMount(hostPath, mockRootPath string) *Runner
- func (r *Runner) BaseDir() string
- func (r *Runner) BindMounts() map[string]string
- func (r *Runner) BuildRPM(ctx context.Context, srpmPath, outputDirPath string, options RPMBuildOptions) error
- func (r *Runner) BuildSRPM(ctx context.Context, specPath, sourceDirPath, outputDirPath string, ...) error
- func (r *Runner) Clone() *Runner
- func (r *Runner) CmdInChroot(ctx context.Context, args []string, interactive bool) (cmd opctx.Cmd, err error)
- func (r *Runner) ConfigOpts() map[string]string
- func (r *Runner) ConfigPath() string
- func (r *Runner) EnableNetwork() *Runner
- func (r *Runner) GetRootPath(ctx context.Context) (string, error)
- func (r *Runner) HasNetworkEnabled() bool
- func (r *Runner) HasNoPreClean() bool
- func (r *Runner) InitRoot(ctx context.Context) (err error)
- func (r *Runner) InstallPackages(ctx context.Context, packages []string) error
- func (r *Runner) RootDir() string
- func (r *Runner) ScrubRoot(ctx context.Context) error
- func (r *Runner) TryGetFailureDetails(fs opctx.FS, outputDirPath string) (details *BuildLogDetails)
- func (r *Runner) WithBaseDir(baseDir string) *Runner
- func (r *Runner) WithConfigOpts(opts map[string]string) *Runner
- func (r *Runner) WithNoPreClean() *Runner
- func (r *Runner) WithRootDir(rootDir string) *Runner
- type SRPMBuildOptions
Constants ¶
const ( // The name of the host user group that the calling user must be a member of to run "mock". MockGroup = "mock" // The name of the mock executable. MockBinary = "mock" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildLogDetails ¶
type BuildLogDetails struct {
// RPMBuildErrors is a list of error messages extracted from mock build logs.
RPMBuildErrors []string
// LastRPMBuildLogLines is a list of the last lines of the mock build log, which may contain
// relevant context about why a build failure occurred.
LastRPMBuildLogLines []string
}
BuildLogDetails encapsulates details extracted from mock build logs that may be relevant to understanding the cause of a build failure.
type CommonBuildOptions ¶
type CommonBuildOptions struct {
With []string
Without []string
Defines map[string]string
LocalRepoPaths []string
}
CommonBuildOptions encapsulates options that are shared between SRPM and RPM builds.
type RPMBuildOptions ¶
type RPMBuildOptions struct {
CommonBuildOptions
// Binary RPM specific options
NoCheck bool
ForceRebuild bool
}
RPMBuildOptions encapsulates options for building binary RPMs using mock.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Encapsulates options for invoking mock.
func (*Runner) AddBindMount ¶
Updates the Runner's configuration to add a bind mount, exposing the host directory at path `hostPath` in the mock root at path `mockRootPath`.
func (*Runner) BaseDir ¶
BaseDir retrieves the path to the base directory used by this Runner for mock roots.
func (*Runner) BindMounts ¶
BindMounts retrieves the set of bind mounts configured for this Runner, expressed as a map from host path to mock root path.
func (*Runner) BuildRPM ¶
func (r *Runner) BuildRPM(ctx context.Context, srpmPath, outputDirPath string, options RPMBuildOptions) error
Given a path to a Source RPM (SRPM), invokes mock to build a binary RPM.
func (*Runner) BuildSRPM ¶
func (r *Runner) BuildSRPM( ctx context.Context, specPath, sourceDirPath, outputDirPath string, options SRPMBuildOptions, ) error
Builds a Source RPM (SRPM) using mock.
func (*Runner) CmdInChroot ¶
func (r *Runner) CmdInChroot(ctx context.Context, args []string, interactive bool) (cmd opctx.Cmd, err error)
Builds a wrapper command that will run the specified inside a mock chroot.
func (*Runner) ConfigOpts ¶
ConfigOpts retrieves the set of arbitrary config options configured for this Runner.
func (*Runner) ConfigPath ¶
Retrieves the path to the mock .cfg file used by this Runner.
func (*Runner) EnableNetwork ¶
Updates the Runner's configuration to enable external network access from within the mock root.
func (*Runner) GetRootPath ¶
Retrieves the path to the mock root used by this Runner.
func (*Runner) HasNetworkEnabled ¶
HasNetworkEnabled indicates whether the Runner is configured to enable network access.
func (*Runner) HasNoPreClean ¶
HasNoPreClean indicates whether the Runner is configured to avoid pre-cleaning the root.
func (*Runner) InstallPackages ¶
InstallPackages installs the specified packages into the mock root.
func (*Runner) TryGetFailureDetails ¶
func (r *Runner) TryGetFailureDetails(fs opctx.FS, outputDirPath string) (details *BuildLogDetails)
TryGetFailureDetails makes a best-effort attempt to extract details from mock build logs that may be relevant to understanding the cause of a build failure. This is intended to be called after a build failure to glean any insights we can from mock's logs about why the failure might have occurred.
func (*Runner) WithBaseDir ¶
WithBaseDir updates the Runner's configuration to set which directory mock roots are created under by default. If not set, mock will write under its default base (/var/lib/mock).
func (*Runner) WithConfigOpts ¶
WithConfigOpts updates the Runner's configuration to set arbitrary config options that will be passed through to mock as --config-opts key=value arguments.
func (*Runner) WithNoPreClean ¶
WithNoPreClean updates the Runner's configuration to ensure that mock does *not* pre-clean the root when invoking an operation.
type SRPMBuildOptions ¶
type SRPMBuildOptions struct {
CommonBuildOptions
}
SRPMBuildOptions encapsulates options for building source RPMs using mock.