prefix

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// KegLinkDirectories.
	KegLinkDirectories = []string{
		"bin", "etc", "include", "lib", "sbin", "share", "var",
	}

	// MustExistSubdirectories.
	MustExistSubdirectories = []string{
		"bin", "etc", "include", "lib", "sbin", "share",
	}

	// KegSharePaths returns the share paths of a keg (Keg:SHARE_PATHS).
	// These paths relative to the keg's share directory should always be real directories in the prefix, never symlinks.
	KegSharePaths = []string{
		"aclocal", "doc", "info", "java", "locale", "man",
		"man/man1", "man/man2", "man/man3", "man/man4",
		"man/man5", "man/man6", "man/man7", "man/man8",
		"man/cat1", "man/cat2", "man/cat3", "man/cat4",
		"man/cat5", "man/cat6", "man/cat7", "man/cat8",
		"applications", "gnome", "gnome/help", "icons",
		"mime-info", "pixmaps", "sounds", "postgresql",
	}
)

Functions

func FilterInstalled

func FilterInstalled[T formula.Formula](p Prefix, list []T) (uninstalled []T, installed []T, err error)

FilterInstalledGeneric categorizes Formulae by install status.

func KegKegLinkDirectories

func KegKegLinkDirectories() []string

KegKegLinkDirectories.

Types

type Keg added in v0.2.0

type Keg string

Keg represents a keg as its path.

func (Keg) FS added in v0.2.0

func (k Keg) FS() fs.FS

FS opens an fs.FS in the keg.

func (Keg) Name added in v0.2.0

func (k Keg) Name() string

Name produces the name of the formula.

func (Keg) Paths added in v0.2.0

func (k Keg) Paths() ([]string, error)

Paths returns a list of paths in the keg.

func (Keg) String added in v0.2.0

func (k Keg) String() string

String implement fmt.Stringer.

func (Keg) Version added in v0.2.0

func (k Keg) Version() string

Version produces the version of the keg.

type LinkOptions

type LinkOptions symlink.Options

LinkOptions configure the link step.

type Prefix

type Prefix string

Prefix represents a Homebrew prefix.

const (
	DarwinArm64Default Prefix = "/opt/homebrew"              // the default prefix on ARM64 macOS
	DarwinAmd64Default Prefix = "/usr/local"                 // the default prefix on x86 macOS
	LinuxDefault       Prefix = "/home/linuxbrew/.linuxbrew" // the default prefix on linux
)

func Default

func Default() Prefix

Default returns the default Homebrew prefix value.

func EnvOrDefault added in v0.2.0

func EnvOrDefault() Prefix

EnvOrDefault returns the Homebrew prefix value set by the HOMEBREW_PREFIX environment variable or the default Homebrew prefix value.

func (Prefix) AnyInstalled

func (p Prefix) AnyInstalled(f formula.Formula) bool

AnyInstalled reports if any versions of the given formula are installed.

func (p Prefix) BrokenLinks() ([]string, error)

BrokenLinks finds all broken links in the prefix.

func (Prefix) CanPourBottle added in v0.2.0

func (p Prefix) CanPourBottle(ctx context.Context, f formula.PlatformFormula) error

CanPourBottle verifies that the PlatformFormula's bottle can be poured.

func (Prefix) CanPourBottles added in v0.2.0

func (p Prefix) CanPourBottles(ctx context.Context, formulae []formula.PlatformFormula) error

CanPourBottles verifies that all formulae's bottles can be poured.

func (Prefix) Cellar

func (p Prefix) Cellar() string

Cellar.

func (Prefix) CompatibleWithCellar

func (p Prefix) CompatibleWithCellar(f formula.PlatformFormula) error

CompatibleWithCellar reports whether the Formula's Bottle is compatible with the Prefix's Cellar.

func (Prefix) DataPath

func (p Prefix) DataPath() string

DataPath.

func (Prefix) FormulaKegPath

func (p Prefix) FormulaKegPath(f formula.Formula) string

FormulaKegPath produces the keg for a formula.

func (p Prefix) FormulaLink(f formula.Formula, opts *LinkOptions) (links, files int, err error)

FormulaLink links a keg from the Cellar into the prefix.

func (Prefix) FormulaOutdated

func (p Prefix) FormulaOutdated(f formula.Formula) (bool, error)

FormulaOutdated reports whether the formula is outdated.

func (Prefix) FormulaOutdatedFromName

func (p Prefix) FormulaOutdatedFromName(name, latest string) (bool, error)

FormulaOutdated reports whether the formula is outdated.

func (Prefix) InstalledKegs

func (p Prefix) InstalledKegs(f formula.Formula) ([]Keg, error)

InstalledKegs returns all currently installed prefix directories.

func (Prefix) InstalledKegsByName

func (p Prefix) InstalledKegsByName(names ...string) ([]Keg, error)

InstalledPrefixes returns all currently installed prefix directories.

func (Prefix) KegPath

func (p Prefix) KegPath(name, version string) string

KegPath produces the keg for the given name and version.

func (Prefix) Kegs

func (p Prefix) Kegs() ([]Keg, error)

Kegs returns the list of available kegs.

func (Prefix) Library

func (p Prefix) Library() string

Library.

func (p Prefix) Link(name, version string, opts *LinkOptions) (links, files int, err error)

Link links a keg from the Cellar into the prefix.

https://github.com/Homebrew/brew/blob/ea2892f8ee58494623fc3c15cc8ce81b9124e6e6/Library/Homebrew/keg.rb

TODO: make sure etc and var directories are installed correctly: https://github.com/Homebrew/brew/blob/caff1359de1ae7ac198fa7081d905d2a535af3a1/Library/Homebrew/formula.rb#L1339

func (Prefix) LinkedFiles

func (p Prefix) LinkedFiles(kegs ...string) ([]string, error)

LinkedFiles finds all files in the prefix that link into the given kegs.

func (Prefix) LinkedKegRecords

func (p Prefix) LinkedKegRecords() string

LinkedKegRecords.

func (Prefix) Locks

func (p Prefix) Locks() string

Locks.

func (Prefix) MustExistDirectories

func (p Prefix) MustExistDirectories() []string

MustExistDirectories.

func (Prefix) MustExistSubdirectories

func (p Prefix) MustExistSubdirectories() []string

MustExistSubdirectories.

func (Prefix) NewErrNoSuchKeg

func (p Prefix) NewErrNoSuchKeg(name string) error

NewErrNoSuchKeg creates an error when a keg is not found.

func (Prefix) Opt

func (p Prefix) Opt() string

Opt.

func (p Prefix) OptLink(name, version string, opts *symlink.Options) error

OptLink.

func (Prefix) OptRecord

func (p Prefix) OptRecord(name string) string

OptRecord.

func (Prefix) PinnedKegRecords

func (p Prefix) PinnedKegRecords() string

PinnedKegRecords.

func (Prefix) Pour

func (p Prefix) Pour(btl io.Reader) error

Pour pours a Bottle into the Cellar.

func (Prefix) Racks

func (p Prefix) Racks() ([]Rack, error)

Racks returns the list of available racks.

func (Prefix) ShimsPath

func (p Prefix) ShimsPath() string

ShimsPath.

func (Prefix) String

func (p Prefix) String() string

String implements fmt.Stringer.

func (Prefix) Uninstall

func (p Prefix) Uninstall(kegs ...string) error

Uninstall removes the keg and any symlinks into the keg.

type Rack added in v0.2.0

type Rack string

Rack represents a rack in the Cellar.

func (Rack) Name added in v0.2.0

func (r Rack) Name() string

Name implements formula.Namer.

func (Rack) String added in v0.2.0

func (r Rack) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

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