Documentation ¶
Overview ¶
Package v1 defines data types for v1 of the formulae.brew.sh JSON API and some utility functions for working with the data.
Index ¶
Constants ¶
const (
// RubySourceChecksumSha256 is the key for the sha256 checksum of a Formula's Ruby source.
RubySourceChecksumSha256 = "sha256"
)
const (
Stable = "stable" // Key used for stable bottles
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bottle ¶
type Bottle struct { Rebuild int `json:"rebuild"` RootURL string `json:"root_url"` Files map[platform.Platform]*BottleFile `json:"files"` }
Bottle represents the bottle section.
type BottleFile ¶
type BottleFile struct { Cellar string `json:"cellar"` URL string `json:"url"` Sha256 string `json:"sha256"` }
BottleFile defines a bottle.files entry.
func (*BottleFile) Relocatable ¶
func (file *BottleFile) Relocatable() bool
Relocatable reports if the bottle is relocatable.
type FormulaURL ¶
type FormulaURL struct { URL string `json:"url"` Branch string `json:"branch,omitempty"` Tag string `json:"tag,omitempty"` Revision string `json:"revision,omitempty"` Using string `json:"using,omitempty"` Checksum string `json:"checksum,omitempty"` }
FormulaURL represents the urls block.
type HeadDependencies ¶
type HeadDependencies struct { BuildDependencies []string `json:"build_dependencies"` Dependencies []string `json:"dependencies"` TestDependencies []string `json:"test_dependencies"` RecommendedDependencies []string `json:"recommended_dependencies"` OptionalDependencies []string `json:"optional_dependencies"` UsesFromMacOS []any `json:"uses_from_macos"` UsesFromMacOSBounds []*MacOSBounds `json:"uses_from_macos_bounds"` }
HeadDependencies represents the head_dependencies field.
type Info ¶
type Info struct { PlatformInfo `json:",inline"` Variations map[platform.Platform]*PlatformInfo `json:"variations"` }
Info represents Homebrew API information for a formula.
func (*Info) ForPlatform ¶
func (info *Info) ForPlatform(plat platform.Platform) (*PlatformInfo, error)
ForPlatform produces the "compiled" metadata for the given platform by evaluating its variations.
type InstalledInfo ¶
type InstalledInfo struct { Version string `json:"version"` UsedOptions []any `json:"used_options"` BuiltAsBottle bool `json:"built_as_bottle"` PouredFromBottle bool `json:"poured_from_bottle"` Time int `json:"time"` RuntimeDependencies []*RuntimeDependency `json:"runtime_dependencies"` InstalledAsDependency bool `json:"installed_as_dependency"` InstalledOnRequest bool `json:"installed_on_request"` }
InstalledInfo represents the installed block.
type MacOSBounds ¶
type MacOSBounds struct {
Since string `json:"since"`
}
MacOSBounds represents the uses_from_macos_bounds entries.
type PlatformInfo ¶
type PlatformInfo struct { Name string `json:"name"` FullName string `json:"full_name"` // Deprecated: Evaluate from Tap/Name Tap string `json:"tap"` OldName string `json:"oldname"` // Deprecated: Use OldNames list OldNames []string `json:"oldnames"` Aliases []string `json:"aliases"` VersionedFormulae []string `json:"versioned_formulae"` Desc string `json:"desc"` License string `json:"license"` Homepage string `json:"homepage"` Versions Versions `json:"versions"` URLs map[string]FormulaURL `json:"urls"` Revision int `json:"revision"` VersionScheme int `json:"version_scheme"` Bottle map[string]*Bottle `json:"bottle"` PourBottleOnlyIf *string `json:"pour_bottle_only_if"` KegOnly bool `json:"keg_only"` KegOnlyReason common.KegOnlyConfig `json:"keg_only_reason"` Options []any `json:"options"` BuildDependencies []string `json:"build_dependencies"` Dependencies []string `json:"dependencies"` TestDependencies []string `json:"test_dependencies"` RecommendedDependencies []string `json:"recommended_dependencies"` OptionalDependencies []string `json:"optional_dependencies"` UsesFromMacOS []any `json:"uses_from_macos"` UsesFromMacOSBounds []*MacOSBounds `json:"uses_from_macos_bounds"` Requirements []*Requirement `json:"requirements"` ConflictsWith []string `json:"conflicts_with"` ConflictsWithReasons []string `json:"conflicts_with_reasons"` LinkOverwrite []string `json:"link_overwrite"` Caveats *string `json:"caveats"` Installed []InstalledInfo `json:"installed"` LinkedKeg string `json:"linked_keg"` Pinned bool `json:"pinned"` Outdated bool `json:"outdated"` Deprecated bool `json:"deprecated"` DeprecationDate *string `json:"deprecation_date"` DeprecationReason *string `json:"deprecation_reason"` Disabled bool `json:"disabled"` DisabledDate *string `json:"disable_date"` DisabledReason *string `json:"disable_reason"` PostInstallDefined bool `json:"post_install_defined"` Service *common.Service `json:"service"` TapGitHead string `json:"tap_git_head"` RubySourcePath string `json:"ruby_source_path"` RubySourceChecksum map[string]string `json:"ruby_source_checksum"` HeadDependencies *HeadDependencies `json:"head_dependencies,omitempty"` }
PlatformInfo represents Homebrew API information for a formula.
func (*PlatformInfo) PossibleNames ¶
func (info *PlatformInfo) PossibleNames() []string
PossibleNames returns all possible names for the formula. This is a combination of the current name, old names, and any aliases.
func (*PlatformInfo) Version ¶
func (info *PlatformInfo) Version() string
Version returns the version of the formula according to Homebrew.
Pattern:
VERSION[_REVISION]
This version will vary from the formula project's version when the "revision" field is set in the formula, which signals the formula was updated without changing the version being installed.
type Requirement ¶
type Requirement struct { Name string `json:"name"` Cask any `json:"cask"` Download any `json:"download"` Version string `json:"version"` Contexts []string `json:"contexts"` Specs []string `json:"specs"` }
Requirement represents a requirement.
type RuntimeDependency ¶
type RuntimeDependency struct { FullName string `json:"full_name"` Version string `json:"version"` Revision int `json:"revision"` PkgVersionValue string `json:"pkg_version"` DeclaredDirectly bool `json:"declared_directly"` }
RuntimeDependency represents a required dependency.