formula

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BottleFileName

func BottleFileName(f PlatformFormula) string

BottleFileName returns a short name for the downloaded bottle .tar.gz file for the formula.

Pattern:

NAME--VERSION[_REVISION][-REBUILD]

Example:

cowsay--3.04_1.arm64_sonoma.bottle.tar.gz

func Names

func Names[T Namer](formulae []T) []string

func PkgVersion

func PkgVersion(v Version) string

PkgVersion is a helper for producing the package version.

func Tag

func Tag(v Version) string

Tag is a helper for producing the bottle tag.

Types

type Bottle

type Bottle struct {
	RootURL  string
	Sha256   string
	Cellar   string
	Platform platform.Platform // stores Bottle platform, which can vary from PlatformFormula.Platform() iff the Bottle is for "all" platforms.
}

Bottle defines bottle metadata.

type ConcurrentFormulary

type ConcurrentFormulary interface {
	Formulary
	FetchFormulae(ctx context.Context, names []string) ([]MultiPlatformFormula, error)
}

ConcurrentFormulary is a source of Formulae that supports concurrent fetching.

type ConcurrentPlatformFormulary

type ConcurrentPlatformFormulary interface {
	PlatformFormulary
	ConcurrentFormulary
	FetchPlatformFormulae(ctx context.Context, names []string, plat platform.Platform) ([]PlatformFormula, error)
}

ConcurrentFormulary is a source of Formulae that supports platform metadata and concurrent fetching.

type ConcurrentSearchableFormulary

type ConcurrentSearchableFormulary interface {
	ConcurrentFormulary
	NameLister
}

SearchableFormulary is a Formulary that supports search and concurrent fetching.

type Conflict

type Conflict struct {
	Name   string
	Reason string
}

Conflict defines a conflicting package.

type DependencyTags

type DependencyTags struct {
	IncludeBuild    bool
	IncludeTest     bool
	SkipRecommended bool
	IncludeOptional bool
}

DependencyTags defines the available dependency tags.

func (*DependencyTags) LogAttr

func (deps *DependencyTags) LogAttr() slog.Attr

LogAttr formats the tags as a slog.Attr.

type Formula

type Formula interface {
	NameVersioner
	// Info produces basic information about the Formula.
	Info() *Info
}

Formula represents a Homebrew Formula.

type Formulary

type Formulary interface {
	FetchFormula(ctx context.Context, name string) (MultiPlatformFormula, error)
}

Formulary is a source of Formulae.

type GitSource

type GitSource struct {
	Revision string
	Tag      string
	Branch   string
}

GitSource defines the Git source for a Formula.

type Info

type Info struct {
	Desc     string
	License  string
	Homepage string
}

Info defines the most general information for a Formula.

type MultiPlatformFormula

type MultiPlatformFormula interface {
	Formula
	// ForPlatform produces a PlatformFormula for the given platform.
	ForPlatform(plat platform.Platform) (PlatformFormula, error)
}

MultiPlatformFormula is implemented by formulae that support multiple platforms.

func Fetch

func Fetch(ctx context.Context, src Formulary, name string) (MultiPlatformFormula, error)

Fetch fetches a Formula from the Formulary.

func FetchAll

func FetchAll(ctx context.Context, src Formulary, names []string) ([]MultiPlatformFormula, error)

FetchAll fetches Formulae from the Formulary.

func FromV1

func FromV1(input *brewv1.Info) MultiPlatformFormula

FromV1 produces a Formula from v1 API input.

type NameLister

type NameLister interface {
	ListNames(ctx context.Context) ([]string, error)
}

NameLister is implemented by searchable Formularies.

type NameVersioner

type NameVersioner interface {
	Namer
	Versioner
}

NameVersioner is implemented by all Formula types.

type Namer

type Namer interface {
	Name() string
}

Namer has a name.

type PlatformFormula

type PlatformFormula interface {
	Formula
	// Platform produces the platform for this Formula.
	Platform() platform.Platform
	// SourceInfo produces information about the Formula's source.
	SourceInfo() *SourceInfo
	// Caveats produces the Formula's caveats, if any.
	Caveats() string
	// Dependencies lists dependencies on other Formulae.
	Dependencies() *TaggedDependencies
	// SystemDependencies lists dependencies on system software.
	SystemDependencies() *TaggedDependencies
	// Conflicts lists conflicts with other formulae.
	Conflicts() []Conflict
	// LinkOverwrite lists links to be overwritten in the prefix.
	LinkOverwrite() []string
	// IsKegOnly reports whether the Formula is keg-only.
	IsKegOnly() bool
	// KegOnlyReason produces the reason why a Formula is keg-only.
	KegOnlyReason() (reason string)
	// Requirements lists other system requirements.
	// Requirements() []any
	// Service produces the Formula's service, if any.
	Service() *brewv1.Service
	// Bottle produces information about the Formula's Bottle.
	// Bottle will return nil if the Formula does not provide a Bottle.
	Bottle() *Bottle
}

PlatformFormula represents a Homebrew Formula for a specific platform.

func FetchAllPlatform

func FetchAllPlatform(ctx context.Context, src Formulary, names []string, plat platform.Platform) ([]PlatformFormula, error)

FetchAllPlatform fetches PlatformFormulae from the Formulary.

func FetchPlatform

func FetchPlatform(ctx context.Context, src Formulary, name string, plat platform.Platform) (PlatformFormula, error)

FetchPlatform fetches a PlatformFormula from the Formulary.

func PlatformFromV1

func PlatformFromV1(plat platform.Platform, input *brewv1.PlatformInfo) PlatformFormula

PlatformFromV1 creates a Formula from v1 API input.

type PlatformFormulary

type PlatformFormulary interface {
	Formulary
	FetchPlatformFormula(ctx context.Context, name string, plat platform.Platform) (PlatformFormula, error)
}

PlatformFormulary is a source of Formulae that supports platform metadata.

type RubySource

type RubySource struct {
	Path   string
	Sha256 string
}

RubySource defines the Ruby source for a Formula.

type SearchableFormulary

type SearchableFormulary interface {
	Formulary
	NameLister
}

SearchableFormulary is a Formulary that supports search.

type SourceInfo

type SourceInfo struct {
	URL      string
	Using    string
	Checksum string
	Git      GitSource
	Ruby     RubySource
}

SourceInfo defines source information for a Formula.

type TaggedDependencies

type TaggedDependencies struct {
	Required    []string
	Build       []string
	Test        []string
	Recommended []string
	Optional    []string
}

TaggedDependencies stores dependencies in lists by tag.

func (*TaggedDependencies) ForTags

func (deps *TaggedDependencies) ForTags(tags *DependencyTags) []string

ForTags implements Dependencies.

type V1

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

V1 implements Formula for v1 API output.

func (*V1) ForPlatform

func (f *V1) ForPlatform(plat platform.Platform) (PlatformFormula, error)

ForPlatform implements MultiPlatformFormula.

func (*V1) Info

func (f *V1) Info() *Info

Info implements Formula.

func (*V1) Name

func (f *V1) Name() string

Name implements Formula.

func (*V1) SourceV1

func (f *V1) SourceV1() *brewv1.Info

SourceV1 returns the underlying v1 API output.

func (*V1) Version

func (f *V1) Version() Version

Version implements Formula.

type Version

type Version interface {
	Upstream() string
	Revision() int
	Rebuild() int
}

Version represents a formula version.

type Versioner

type Versioner interface {
	Version() Version
}

Versioner has a version.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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