cli

package
v0.40.3 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 65 Imported by: 1

Documentation

Index

Constants

View Source
const BuiltinPipelineDir = "/usr/share/melange/pipelines"

Variables

This section is empty.

Functions

func BuildCmd

func BuildCmd(ctx context.Context, archs []apko_types.Architecture, baseOpts ...build.Option) error

func CompileCmd added in v0.9.0

func CompileCmd(ctx context.Context, opts ...build.Option) error

func Diff added in v0.7.0

func Diff(oldName string, old []byte, newName string, new []byte, comments bool) []byte

Diff returns an anchored diff of the two texts old and new in the “unified diff” format. If old and new are identical, Diff returns a nil slice (no output).

Unix diff implementations typically look for a diff with the smallest number of lines inserted and removed, which can in the worst case take time quadratic in the number of lines in the texts. As a result, many implementations either can be made to run for a long time or cut off the search after a predetermined amount of work.

In contrast, this implementation looks for a diff with the smallest number of “unique” lines inserted and removed, where unique means a line that appears just once in both old and new. We call this an “anchored diff” because the unique lines anchor the chosen matching regions. An anchored diff is usually clearer than a standard diff, because the algorithm does not try to reuse unrelated blank lines or closing braces. The algorithm also guarantees to run in O(n log n) time instead of the standard O(n²) time.

Some systems call this approach a “patience diff,” named for the “patience sorting” algorithm, itself named for a solitaire card game. We avoid that name for two reasons. First, the name has been used for a few different variants of the algorithm, so it is imprecise. Second, the name is frequently interpreted as meaning that you have to wait longer (to be patient) for the diff, meaning that it is a slower algorithm, when in fact the algorithm is faster than the standard one.

func IndexCmd added in v0.2.0

func IndexCmd(ctx context.Context, opts ...index.Option) error

IndexCmd is the backend implementation of the "melange index" command.

func KeygenCmd

func KeygenCmd(ctx context.Context, keyName string, bitSize int) error

func New

func New() *cobra.Command

func QueryCmd added in v0.3.0

func QueryCmd(ctx context.Context, configFile, pattern string) error

func RebuildCmd added in v0.35.1

func RebuildCmd(ctx context.Context, flags *RebuildFlags, args []string) error

RebuildCmd is the implementation of the rebuild command. It rebuilds the provided APK packages using their embedded metadata.

func TestCmd added in v0.5.4

func TestCmd(ctx context.Context, archs []apko_types.Architecture, baseOpts ...build.TestOption) error

Types

type BuildFlags added in v0.34.1

type BuildFlags struct {
	BuildDate            string
	WorkspaceDir         string
	PipelineDir          string
	SourceDir            string
	CacheDir             string
	CacheSource          string
	ApkCacheDir          string
	SigningKey           string
	GenerateIndex        bool
	EmptyWorkspace       bool
	StripOriginName      bool
	OutDir               string
	Archstrs             []string
	ExtraKeys            []string
	ExtraRepos           []string
	DependencyLog        string
	EnvFile              string
	VarsFile             string
	PurlNamespace        string
	BuildOption          []string
	CreateBuildLog       bool
	PersistLintResults   bool
	Debug                bool
	DebugRunner          bool
	Interactive          bool
	Remove               bool
	Runner               string
	CPU                  string
	CPUModel             string
	Memory               string
	Disk                 string
	Timeout              time.Duration
	ExtraPackages        []string
	Libc                 string
	LintRequire          []string
	LintWarn             []string
	IgnoreSignatures     bool
	Cleanup              bool
	ConfigFileGitCommit  string
	ConfigFileGitRepoURL string
	ConfigFileLicense    string
	GenerateProvenance   bool
	TraceFile            string
}

BuildFlags holds all parsed build command flags

func ParseBuildFlags added in v0.34.1

func ParseBuildFlags(args []string) (*BuildFlags, []string, error)

ParseBuildFlags parses build flags from the provided args and returns a BuildFlags struct

func (*BuildFlags) BuildOptions added in v0.34.3

func (flags *BuildFlags) BuildOptions(ctx context.Context, args ...string) ([]build.Option, error)

BuildOptions converts BuildFlags into a slice of build.Option This includes all core build options that are directly derived from the flags.

type KeygenContext

type KeygenContext struct {
	KeyName string
	BitSize int
}

func (*KeygenContext) GenerateKeypair

func (kc *KeygenContext) GenerateKeypair() (*rsa.PrivateKey, *rsa.PublicKey, error)

type RebuildFlags added in v0.34.1

type RebuildFlags struct {
	Runner     string
	OutDir     string
	SourceDir  string
	SigningKey string
	Diff       bool
}

RebuildFlags holds all parsed rebuild command flags

func ParseRebuildFlags added in v0.34.1

func ParseRebuildFlags(args []string) (*RebuildFlags, []string, error)

ParseRebuildFlags parses rebuild flags from the provided args and returns a RebuildFlags struct

func (*RebuildFlags) RebuildOptions added in v0.34.3

func (flags *RebuildFlags) RebuildOptions(ctx context.Context, pkginfo *goapk.PackageInfo, cfg *config.Configuration, cfgpkg *spdx.Package, cfgpurl purl.PackageURL) ([]build.Option, error)

RebuildOptions converts RebuildFlags into a slice of build.Option This includes all options needed for rebuilding a package from its embedded metadata.

type TestFlags added in v0.34.1

type TestFlags struct {
	WorkspaceDir      string
	SourceDir         string
	CacheDir          string
	CacheSource       string
	ApkCacheDir       string
	Archstrs          []string
	PipelineDirs      []string
	ExtraKeys         []string
	ExtraRepos        []string
	EnvFile           string
	TestOption        []string
	Debug             bool
	DebugRunner       bool
	Interactive       bool
	Runner            string
	ExtraTestPackages []string
	Remove            bool
	IgnoreSignatures  bool
	CPU               string
	CPUModel          string
	Memory            string
	Disk              string
	Timeout           time.Duration
}

TestFlags holds all parsed test command flags

func ParseTestFlags added in v0.34.1

func ParseTestFlags(args []string) (*TestFlags, []string, error)

ParseTestFlags parses test flags from the provided args and returns a TestFlags struct

func (*TestFlags) TestOptions added in v0.34.3

func (flags *TestFlags) TestOptions(ctx context.Context, args ...string) ([]build.TestOption, error)

TestOptions converts TestFlags into a slice of build.TestOption This includes all core test options that are directly derived from the flags.

Jump to

Keyboard shortcuts

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