Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCompletions ¶ added in v0.2.0
func GenerateCompletions(ctx context.Context, binaryPath string, command []string, dir string) (map[string]string, error)
GenerateCompletions runs `<binaryPath> <command...> <shell>` for bash, zsh and fish, writes each captured script under dir, and returns keg-relative archive path -> local path entries suitable for BuildOptions.ExtraFiles. Any shell failing to generate is an error: shipping partial completions silently is worse than failing the build.
Types ¶
type BinaryInstall ¶ added in v0.2.0
BinaryInstall names a binary and the keg-relative directory it installs into (empty means "bin").
type Bottle ¶
type Bottle struct {
Formula string // e.g., "myapp"
Version string // e.g., "1.2.3"
Platform platform.Platform // The Homebrew platform
SHA256 string // SHA256 of the bottle tarball (formula sha256 == OCI layer digest)
UncompressedSHA256 string // SHA256 of the raw tar stream (OCI diff_id)
UncompressedSize int64 // raw tar size in bytes (installed_size basis)
Path string // Local path to bottle file
Binaries []string // Binaries included
Cellar string // e.g., ":any_skip_relocation"
Rebuild int // Rebuild number (usually 0)
Tab *Tab // INSTALL_RECEIPT content (also pushed as sh.brew.tab)
}
Bottle represents a built Homebrew bottle
func (*Bottle) BottleName ¶
BottleName returns the local bottle filename, matching brew's convention: formula--version.platform.bottle[.rebuild].tar.gz
func (*Bottle) RefName ¶
RefName returns the org.opencontainers.image.ref.name annotation value: "version.platform_tag" or "version.platform_tag.rebuild".
func (*Bottle) VersionRebuild ¶
VersionRebuild returns the OCI tag for this bottle's version: "version" or "version-rebuild" (GitHubPackages.version_rebuild).
type BuildOptions ¶
type BuildOptions struct {
Formula string
Version string
Platform platform.Platform
ArtifactPath string // Path to archive containing the binaries
Binaries []BinaryInstall // Binaries to include
Cellar string
Rebuild int
Tap string // Tap name for INSTALL_RECEIPT.json (e.g., "user/homebrew-tap")
FormulaRb string // Rendered formula source (sans bottle block) for .brew/<formula>.rb
ExtraFiles map[string]string // Keg-relative archive path -> local path (e.g. completions)
SourceDate time.Time
OutputDir string // Where to write the bottle (default: builder temp dir, removed on Close)
}
BuildOptions contains the parameters for building a bottle
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder transforms build artifacts into Homebrew bottles
func NewBuilder ¶
NewBuilder creates a new bottle builder with a temp work directory
type RuntimeDependency ¶
type RuntimeDependency struct {
FullName string `json:"full_name"`
Version string `json:"version"`
Revision int `json:"revision,omitempty"`
PkgVersion string `json:"pkg_version"`
DeclaredDirectly bool `json:"declared_directly"`
}
RuntimeDependency represents a runtime dependency in the tab
type Tab ¶
type Tab struct {
HomebrewVersion string `json:"homebrew_version"`
UsedOptions []string `json:"used_options"`
UnusedOptions []string `json:"unused_options"`
BuiltAsBottle bool `json:"built_as_bottle"`
PouredFromBottle bool `json:"poured_from_bottle"`
InstalledAsDependency bool `json:"installed_as_dependency"`
InstalledOnRequest bool `json:"installed_on_request"`
ChangedFiles []string `json:"changed_files"`
Time int64 `json:"time"`
SourceModifiedTime int64 `json:"source_modified_time"`
Compiler string `json:"compiler"`
Stdlib *string `json:"stdlib"`
Aliases []string `json:"aliases"`
RuntimeDependencies []RuntimeDependency `json:"runtime_dependencies"`
Source TabSource `json:"source"`
Arch string `json:"arch"`
BuiltOn TabBuiltOn `json:"built_on"`
}
Tab represents the INSTALL_RECEIPT.json structure used by Homebrew to track bottle metadata and installation information.
type TabBuiltOn ¶
type TabBuiltOn struct {
OS string `json:"os"`
OSVersion string `json:"os_version"`
CPUFamily string `json:"cpu_family"`
Xcode string `json:"xcode,omitempty"`
CLT string `json:"clt,omitempty"`
PreferredPerl string `json:"preferred_perl,omitempty"`
}
TabBuiltOn contains build environment information
type TabOptions ¶
type TabOptions struct {
// Formula name
Formula string
// Version string
Version string
// Architecture (arm64 or x86_64)
Arch string
// OS (darwin or linux)
OS string
// OS version (e.g., "15.0" for macOS Sequoia)
OSVersion string
// Tap name (e.g., "user/homebrew-tap")
Tap string
// Compiler used (default: "go" for Go-built bottles)
Compiler string
// Time overrides the build timestamp (for reproducible bottles).
// Falls back to SOURCE_DATE_EPOCH, then the Unix epoch — never
// time.Now(), so identical inputs marshal identically.
Time time.Time
}
TabOptions contains options for creating a new Tab
type TabSource ¶
type TabSource struct {
Spec string `json:"spec"`
Versions TabVersions `json:"versions"`
Path string `json:"path,omitempty"`
Tap string `json:"tap,omitempty"`
TapGitHead string `json:"tap_git_head,omitempty"`
}
TabSource contains source information for the formula
type TabVersions ¶
type TabVersions struct {
Stable string `json:"stable"`
Head *string `json:"head"`
VersionScheme int `json:"version_scheme"`
}
TabVersions contains version information