Documentation
¶
Index ¶
- func IsStale(storeDir string, r *recipe.Recipe, goos, goarch string, ...) (bool, error)
- type InstallMethod
- type InstallResult
- type Installer
- func (inst *Installer) Install(r *recipe.Recipe) (*InstallResult, error)
- func (inst *Installer) InstallBuildDeps(r *recipe.Recipe) (*build.BuildDeps, error)
- func (inst *Installer) InstallBuildOnlyDeps(r *recipe.Recipe) (*build.BuildDeps, error)
- func (inst *Installer) InstallGitWithFinalize(r *recipe.Recipe, finalize func(*InstallResult) error) (*InstallResult, error)
- func (inst *Installer) InstallLocalWithFinalize(r *recipe.Recipe, sourceDir string, finalize func(*InstallResult) error) (*InstallResult, error)
- func (inst *Installer) InstallRuntimeDeps(r *recipe.Recipe) (*build.BuildDeps, error)
- func (inst *Installer) InstallWithFinalize(r *recipe.Recipe, force bool, finalize func(*InstallResult) error) (*InstallResult, error)
- func (inst *Installer) Reinstall(r *recipe.Recipe) (*InstallResult, error)
- func (inst *Installer) ResolveDirectDeps(r *recipe.Recipe) ([]depsmeta.ResolvedDep, error)
- type RecipeResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsStale ¶ added in v0.12.0
func IsStale(storeDir string, r *recipe.Recipe, goos, goarch string, resolver RecipeResolver) (bool, error)
IsStale reports whether an installed package is stale relative to the current recipes of its declared dependencies. Stale means the package was built against a dep version-revision that differs from what the current recipe for that dep produces.
goos and goarch identify the current platform (typically runtime.GOOS and runtime.GOARCH). They are passed to DependenciesForPlatform so that platform-scoped dep lists and constraints are included in the staleness check.
A missing .gale-deps.toml causes IsStale to return true (stale) so a soft migration reinstalls old installs that predate this metadata.
Only the Runtime deps declared on `r` (for the given platform) are considered: build-only tools (cmake, rust, go) and external system libraries are ignored, because the shipped binary cannot link them, so a bump to one must not force a re-download (gh#157).
Types ¶
type InstallMethod ¶ added in v0.10.0
type InstallMethod string
InstallMethod represents how a package was installed.
const ( MethodBinary InstallMethod = "binary" MethodSource InstallMethod = "source" MethodCached InstallMethod = "cached" )
type InstallResult ¶
type InstallResult struct {
Name string
Version string
Method InstallMethod
SHA256 string // hex hash of installed archive
// ManifestDigest is the OCI manifest digest from
// .binaries.toml; empty for source builds.
ManifestDigest string
}
InstallResult holds the outcome of an install.
type Installer ¶
type Installer struct {
Store *store.Store
Resolver RecipeResolver
// Verifier checks Sigstore attestations for prebuilt
// binaries. Production wiring always sets it (a native
// in-process verifier); nil is a test-only seam meaning
// "skip attestation entirely". When non-nil, sigstore
// trust ALWAYS verifies — there is no availability probe
// and no silent skip.
Verifier attestation.Verifier
SourceOnly bool // skip binary, build from source
// BinaryFallbackLog receives a one-line warning when a
// binary install fails and the installer falls back to a
// source build. nil means write to os.Stderr — the failure
// is always reported because reaching this branch means a
// binary was advertised in the recipe and could not be
// fetched/verified. Tests inject a buffer to assert on
// the message. Because dep installs run in parallel, this
// writer may receive concurrent writes; callers injecting a
// non-os.Stderr writer must make it concurrency-safe.
BinaryFallbackLog io.Writer
// Downloads bounds the number of concurrent binary network
// fetches across all installs sharing this Installer. A nil
// limiter (the zero value) is unbounded.
Downloads *parallel.Limiter
}
Installer installs packages into the store.
func (*Installer) Install ¶
func (inst *Installer) Install(r *recipe.Recipe) (*InstallResult, error)
Install installs a recipe into the store and links binaries.
func (*Installer) InstallBuildDeps ¶ added in v0.2.0
InstallBuildDeps installs every declared direct dependency (build + runtime, after applying the platform overlay and merging in implicit system tools). Used by the source-build paths (`gale build`, InstallLocal, InstallGit) where the full toolchain is needed.
The binary-first install path uses InstallRuntimeDeps and InstallBuildOnlyDeps instead so build-only deps can be skipped when a prebuilt binary install succeeds.
func (*Installer) InstallBuildOnlyDeps ¶ added in v0.16.2
InstallBuildOnlyDeps installs only the build-tagged direct deps of r (plus implicit system tools). Used by the binary-fallback-to-source path after InstallRuntimeDeps has already installed the runtime deps: now we top up with the build-only pieces before running the source build.
func (*Installer) InstallGitWithFinalize ¶ added in v0.16.3
func (inst *Installer) InstallGitWithFinalize(r *recipe.Recipe, finalize func(*InstallResult) error) (*InstallResult, error)
InstallGitWithFinalize acquires the per-package lock (keyed on the resolved commit hash), runs the git install, then invokes finalize() while still holding the lock, then releases. finalize == nil is a no-op. finalize errors are returned alongside the InstallResult so the caller sees partial state.
func (*Installer) InstallLocalWithFinalize ¶ added in v0.16.3
func (inst *Installer) InstallLocalWithFinalize( r *recipe.Recipe, sourceDir string, finalize func(*InstallResult) error, ) (*InstallResult, error)
InstallLocalWithFinalize acquires the per-package lock, runs the local source install, then invokes finalize() while still holding the lock, then releases. finalize == nil is a no-op. finalize errors are returned alongside the InstallResult so the caller sees partial state.
func (*Installer) InstallRuntimeDeps ¶ added in v0.16.2
InstallRuntimeDeps installs only the runtime-tagged direct deps of r. Build-only deps are not installed. Transitive resolution inside each runtime dep is unchanged — that dep's own build deps still get installed if it has to be built from source.
Called by the binary-first install path so a prebuilt binary install doesn't drag in autoconf et al.
func (*Installer) InstallWithFinalize ¶ added in v0.16.3
func (inst *Installer) InstallWithFinalize(r *recipe.Recipe, force bool, finalize func(*InstallResult) error) (*InstallResult, error)
InstallWithFinalize acquires the per-package lock, runs the install, then invokes finalize() while still holding the lock, then releases. finalize == nil is a no-op. finalize errors are returned alongside the InstallResult so the caller sees partial state.
func (*Installer) Reinstall ¶ added in v0.12.0
func (inst *Installer) Reinstall(r *recipe.Recipe) (*InstallResult, error)
Reinstall is Install but skips the IsInstalled cache check so callers can force a fresh install even when the store already satisfies the request. Used by sync's stale-reinstall path to migrate pre-revision bare-dir installs into the canonical layout.
func (*Installer) ResolveDirectDeps ¶ added in v0.16.2
ResolveDirectDeps returns the (name, version, revision) tuple for every declared runtime dep of r (deduped, after platform overlay). Does NOT install anything — the binary-install path uses this to populate .gale-deps.toml with the runtime closure the shipped binary links. Build-only deps are excluded (gh#157): recording them would pin build tools in the store for gc/farm even though the binary never links them, and IsStale ignores them.