state

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSources = []string{"https://github.com/cashapp/hermit-packages.git"}

DefaultSources if no others are defined.

Functions

This section is empty.

Types

type AutoMirror

type AutoMirror struct {
	// Origin URL regex to generate a mirror from. Named patterns will be substituted into mirror.
	Origin string
	// Mirror URL to add.
	Mirror string
}

AutoMirror defines a dynamically generated mirror URL mapping.

type Config

type Config struct {
	// List of sources to sync packages from.
	Sources []string
	// Auto-generated mirrors.
	AutoMirrors []AutoMirror
	// Builtin sources.
	Builtin *sources.BuiltInSource
}

Config for Hermit's global state.

type State

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

State is the global hermit state shared between all local environments

func Open

func Open(stateDir string, config Config, cache *cache.Cache) (*State, error)

Open the global Hermit state.

See cache.Open for details on downloadStrategies.

func (*State) BinaryDir added in v0.2.26

func (s *State) BinaryDir() string

BinaryDir returns path to the directory for bin symlinks

func (*State) CacheAndUnpack

func (s *State) CacheAndUnpack(b *ui.Task, p *manifest.Package) error

CacheAndUnpack downloads a package and extracts it if it is not present. If the package has already been extracted, this is a no-op

func (*State) CleanCache

func (s *State) CleanCache(b ui.Logger) error

CleanCache clears the download cache

func (*State) CleanPackages

func (s *State) CleanPackages(b *ui.UI) error

CleanPackages removes all extracted packages

func (*State) Config

func (s *State) Config() Config

Config returns the configuration stored in the global state.

func (*State) PkgDir

func (s *State) PkgDir() string

PkgDir returns path to the directory for extracted packages

func (*State) ReadPackageState

func (s *State) ReadPackageState(pkg *manifest.Package)

ReadPackageState updates the package fields from the global database

func (*State) Resolve

func (s *State) Resolve(l *ui.UI, mathcer manifest.Selector) (*manifest.Package, error)

Resolve package reference without an active environment.

func (*State) Root

func (s *State) Root() string

Root returns the root directory for the hermit state

func (*State) Search added in v0.2.3

func (s *State) Search(l *ui.UI, glob string) (manifest.Packages, error)

Search for packages without an active environment.

func (*State) Sources added in v0.2.13

func (s *State) Sources(l *ui.UI) (*sources.Sources, error)

Sources associated with the State.

func (*State) SourcesDir

func (s *State) SourcesDir() string

SourcesDir returns the global directory for manifests

func (*State) UpgradeChannel

func (s *State) UpgradeChannel(b *ui.Task, pkg *manifest.Package) error

UpgradeChannel checks if the given binary has changed in its channel, and if so, downloads it.

If the channel is upgraded this will return a clone of the updated manifest.

func (*State) WritePackageState

func (s *State) WritePackageState(p *manifest.Package) error

WritePackageState updates the fields and usage time stamp of the given package

Jump to

Keyboard shortcuts

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