cli

package
v0.0.0-...-fc57355 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCmdWithConfig

func BuildCmdWithConfig(ctx context.Context, archs []apko_types.Architecture, baseCfg *build.BuildConfig) error

BuildCmdWithConfig executes builds for the given architectures using the provided BuildConfig. This is the preferred entry point for programmatic builds.

func CompileCmd

func CompileCmd(ctx context.Context, cfg *build.BuildConfig) error

CompileCmd compiles a melange configuration file using BuildConfig.

func Diff

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

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

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

func TestCmdWithConfig

func TestCmdWithConfig(ctx context.Context, archs []apko_types.Architecture, baseCfg *build.TestConfig) error

TestCmdWithConfig executes tests for the given architectures using the provided TestConfig.

Types

type BuildFlags

type BuildFlags struct {
	BuildDate            string
	WorkspaceDir         string
	PipelineDir          string
	SourceDir            string
	CacheDir             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
	Remove               bool
	BuildKitAddr         string
	MaxLayers            int
	ExtraPackages        []string
	Libc                 string
	LintRequire          []string
	LintWarn             []string
	IgnoreSignatures     bool
	Cleanup              bool
	ConfigFileGitCommit  string
	ConfigFileGitRepoURL string
	ConfigFileLicense    string
	GenerateProvenance   bool
	TraceFile            string
	ExportOnFailure      string
	ExportRef            string
	ApkoRegistry         string
	ApkoRegistryInsecure bool
}

BuildFlags holds all parsed build command flags

func ParseBuildFlags

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

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

func (*BuildFlags) ToBuildConfig

func (flags *BuildFlags) ToBuildConfig(ctx context.Context, args ...string) (*build.BuildConfig, error)

ToBuildConfig converts BuildFlags into a BuildConfig struct. This is the preferred way to create build configuration from CLI flags.

type KeygenContext

type KeygenContext struct {
	KeyName string
	BitSize int
}

func (*KeygenContext) GenerateKeypair

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

type TestFlags

type TestFlags struct {
	WorkspaceDir      string
	SourceDir         string
	CacheDir          string
	ApkCacheDir       string
	Archstrs          []string
	PipelineDirs      []string
	ExtraKeys         []string
	ExtraRepos        []string
	EnvFile           string
	Debug             bool
	ExtraTestPackages []string
	IgnoreSignatures  bool
	BuildKitAddr      string
}

TestFlags holds all parsed test command flags

func ParseTestFlags

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

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

func (*TestFlags) ToTestConfig

func (flags *TestFlags) ToTestConfig(ctx context.Context, args ...string) (*build.TestConfig, error)

ToTestConfig converts TestFlags into a TestConfig struct.

Jump to

Keyboard shortcuts

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