prefix

package
v0.1.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 23 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 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. Matches the behavior of the "$(brew --prefix)" command. Obeys the HOMEBREW_PREFIX environment variable to override.

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) 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) (int, int, 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.Keg, error)

InstalledKegs returns all currently installed prefix directories.

func (Prefix) InstalledKegsByName

func (p Prefix) InstalledKegsByName(names ...string) ([]keg.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.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) (int, int, 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.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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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