Documentation
¶
Overview ¶
Package pkg provides package management actions for the operation graph.
Index ¶
- type Provider
- func (p *Provider) CompensateInstall(state Tombstone) error
- func (p *Provider) CompensateRemove(state Tombstone) error
- func (p *Provider) CompensateUpgrade(_ Tombstone) error
- func (p *Provider) Install(packages []Resource, manager string, cask bool) (result []Resource, state Tombstone, err error)
- func (p *Provider) Installed(name Resource) (bool, error)
- func (p *Provider) NotInstalled(name Resource) (bool, error)
- func (p *Provider) Remove(packages []Resource, manager string, cask bool) (result []Resource, state Tombstone, err error)
- func (p *Provider) Update(manager string) (string, error)
- func (p *Provider) Upgrade(packages []Resource, manager string, cask bool) (result []Resource, state Tombstone, err error)
- func (p *Provider) VersionGTE(name Resource, version string) (bool, error)
- type Resource
- type Tombstone
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
op.ProviderBase
}
Provider provides platform-independent package management. Platform-specific behavior is delegated to p.Context().Platform.
+devlore:access=planned
func (*Provider) CompensateInstall ¶
CompensateInstall undoes an Install by removing packages that weren't already installed before the action.
func (*Provider) CompensateRemove ¶
CompensateRemove undoes a Remove by reinstalling the removed packages.
func (*Provider) CompensateUpgrade ¶
CompensateUpgrade is a diagnostic no-op. Previous versions are captured in state for manual recovery, but automatic downgrade is not reliable across package managers.
func (*Provider) Install ¶
func (p *Provider) Install(packages []Resource, manager string, cask bool) (result []Resource, state Tombstone, err error)
Install installs packages using the platform's package manager. Returns compensation state with pre-install status per package.
Parameters:
- packages: package resources to install
- manager: Package manager override (empty for auto-detect)
- cask: If true, use Homebrew cask for macOS GUI apps
func (*Provider) Installed ¶
Installed returns true if the named package is installed.
Parameters:
- name: package resource to check
func (*Provider) NotInstalled ¶
NotInstalled returns true if the named package is not installed.
Parameters:
- name: package resource to check
func (*Provider) Remove ¶
func (p *Provider) Remove(packages []Resource, manager string, cask bool) (result []Resource, state Tombstone, err error)
Remove removes packages using the platform's package manager. Returns compensation state for reinstallation.
Parameters:
- packages: package resources to remove
- manager: Package manager override (empty for auto-detect)
- cask: If true, use Homebrew cask for macOS GUI apps
func (*Provider) Update ¶
Update refreshes the package manager index.
Parameters:
- manager: Package manager override (empty for auto-detect)
func (*Provider) Upgrade ¶
func (p *Provider) Upgrade(packages []Resource, manager string, cask bool) (result []Resource, state Tombstone, err error)
Upgrade upgrades packages using the platform's package manager. Returns compensation state with pre-upgrade versions per package.
Parameters:
- packages: package resources to upgrade
- manager: Package manager override (empty for auto-detect)
- cask: If true, use Homebrew cask for macOS GUI apps
type Resource ¶
type Resource struct {
op.ResourceBase
Name string // package name ("jq", "curl", "VisualStudioCode")
Type string // purl type / manager ("brew", "deb", "port", "winget")
Version string // populated by Resolve()
}
Resource represents a system package.
func NewResource ¶
NewResource creates a Resource with the given package name. The Type is left empty for auto-detection at Resolve() time.
func NewTypedResource ¶
NewTypedResource creates a Resource with explicit package name and type.
func ResourceFromValue ¶
ResourceFromValue constructs a pkg.Resource from a string package name.
Parameters:
- v: expected to be a string package name
Returns:
- Resource: initialized with the given name
- error: if v is not a string
func (*Resource) Purl ¶
Purl returns the canonical package-url string. For this implementation, URI() and Purl() produce the same string.