catalog

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const PackagesSubdir = "pkgs"

On-disk layout: <repoRoot>/<PackagesSubdir>/<name>/pkg.yaml.

Variables

View Source
var ErrPackageNotFound = errors.New("package not found in catalog")

Functions

This section is empty.

Types

type CopyAction

type CopyAction struct {
	From string `yaml:"from"`
	To   string `yaml:"to"`
}

type Entry

type Entry struct {
	Name   string
	Source Source
}

type ExtractAction

type ExtractAction struct {
	From string `yaml:"from"`
	As   string `yaml:"as,omitempty"`
}

type Git

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

func NewGit

func NewGit(localDir, remote, ref string, engine *fetcher.Engine, reporter Reporter) *Git

func (*Git) FetchArchive

func (a *Git) FetchArchive(ctx context.Context, name, version string, platform fetcher.Platform) (io.ReadCloser, int64, error)

func (*Git) FetchSource

func (a *Git) FetchSource(ctx context.Context, name, version string) (io.ReadCloser, int64, error)

func (*Git) Info

func (a *Git) Info(ctx context.Context, pkgName string) (*Package, error)

func (*Git) List

func (a *Git) List(ctx context.Context) ([]string, error)

func (*Git) ListVersions

func (a *Git) ListVersions(ctx context.Context, pkgName string) ([]string, error)

func (*Git) Update

func (a *Git) Update(ctx context.Context) error

type LocalDir

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

func NewLocalDir

func NewLocalDir(localDir string, engine *fetcher.Engine) *LocalDir

func (*LocalDir) FetchArchive

func (a *LocalDir) FetchArchive(ctx context.Context, name, version string, platform fetcher.Platform) (io.ReadCloser, int64, error)

func (*LocalDir) FetchSource

func (a *LocalDir) FetchSource(ctx context.Context, name, version string) (io.ReadCloser, int64, error)

func (*LocalDir) Info

func (a *LocalDir) Info(ctx context.Context, pkgName string) (*Package, error)

func (*LocalDir) List

func (a *LocalDir) List(ctx context.Context) ([]string, error)

func (*LocalDir) ListVersions

func (a *LocalDir) ListVersions(ctx context.Context, pkgName string) ([]string, error)

type MkdirAction

type MkdirAction struct {
	Path string `yaml:"path"`
}

type Multi

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

func NewMulti

func NewMulti(entries []Entry, reporter Reporter) *Multi

func (*Multi) Latest

func (m *Multi) Latest(ctx context.Context, pkgName string) (string, Entry, error)

func (*Multi) Locate

func (m *Multi) Locate(ctx context.Context, pkgName string) (Entry, *Package, error)

func (*Multi) Search

func (m *Multi) Search(ctx context.Context, query string) []SearchResult

func (*Multi) UpdateAll

func (m *Multi) UpdateAll(ctx context.Context) []UpdateResult

func (*Multi) UpdateOne

func (m *Multi) UpdateOne(ctx context.Context, name string) error

func (*Multi) VersionsOf

func (m *Multi) VersionsOf(ctx context.Context, pkgName string) []VersionResult

type Package

type Package struct {
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	License     string   `yaml:"license"`
	Homepage    string   `yaml:"homepage"`
	DependsOn   []string `yaml:"dependsOn"`

	BuildFromSource bool `yaml:"buildFromSource"`

	Archive *fetcher.Artifact `yaml:"archive,omitempty"`
	Source  *fetcher.Artifact `yaml:"source,omitempty"`

	Versions []VersionEntry `yaml:"versions"`

	Build   []Step `yaml:"build,omitempty"`
	Install []Step `yaml:"install,omitempty"`
	Test    []Step `yaml:"test,omitempty"`
}
func Search(ctx context.Context, r Source, query string) ([]*Package, error)

func (*Package) Phases

func (p *Package) Phases() []PhaseSteps

func (*Package) Validate

func (p *Package) Validate() error

type Phase

type Phase string

Closed set; declarative.go and the linter iterate Phases() in order — keep in sync.

const (
	PhaseBuild   Phase = "build"
	PhaseInstall Phase = "install"
	PhaseTest    Phase = "test"
)

type PhaseSteps

type PhaseSteps struct {
	Name  Phase
	Steps []Step
}

type Reporter

type Reporter interface {
	Info(format string, args ...any)
	Warn(format string, args ...any)
}
var DiscardReporter Reporter = discardReporter{}

type RunAction

type RunAction struct {
	Cmd []string `yaml:"cmd"`
	Cwd string   `yaml:"cwd,omitempty"`
}

type SearchResult

type SearchResult struct {
	Catalog string
	Package *Package
}

type Source

type Source interface {
	List(ctx context.Context) ([]string, error)
	ListVersions(ctx context.Context, pkgName string) ([]string, error)
	Info(ctx context.Context, pkgName string) (*Package, error)
	FetchArchive(ctx context.Context, name, version string, platform fetcher.Platform) (io.ReadCloser, int64, error)
	FetchSource(ctx context.Context, name, version string) (io.ReadCloser, int64, error)
}

type Step

type Step struct {
	Extract *ExtractAction `yaml:"extract,omitempty"`
	Copy    *CopyAction    `yaml:"copy,omitempty"`
	Mkdir   *MkdirAction   `yaml:"mkdir,omitempty"`
	Run     *RunAction     `yaml:"run,omitempty"`
}

func (Step) Validate

func (s Step) Validate(phase Phase) error

type UpdateResult

type UpdateResult struct {
	Catalog string
	Skipped bool
	Err     error
}

type Updater

type Updater interface {
	Update(ctx context.Context) error
}

type VersionEntry

type VersionEntry struct {
	Version       string `yaml:"version"`
	ArchiveSHA256 string `yaml:"archiveSHA256,omitempty"`
	SourceSHA256  string `yaml:"sourceSHA256,omitempty"`
}

type VersionResult

type VersionResult struct {
	Catalog string
	Version string
}

Jump to

Keyboard shortcuts

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