aur

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: 0BSD Imports: 15 Imported by: 0

Documentation

Overview

Package aur provides a native Go client for the Arch User Repository.

Unlike other snack backends that wrap CLI tools, aur uses the AUR RPC API directly for queries and git+makepkg for building. Packages are built in a temporary directory and installed via pacman -U.

Requirements: git, makepkg, pacman (all present on any Arch Linux system).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AUR

type AUR struct {
	snack.Locker

	// BuildDir is the base directory for cloning and building packages.
	// If empty, a temporary directory is created per build.
	BuildDir string

	// MakepkgFlags are extra flags passed to makepkg (e.g. "--skippgpcheck").
	MakepkgFlags []string
}

AUR wraps the Arch User Repository using its RPC API and makepkg.

func New

func New() *AUR

New returns a new AUR manager with default settings.

func NewWithOptions

func NewWithOptions(opts ...AUROption) *AUR

NewWithOptions returns a new AUR manager with the given options.

func (*AUR) Autoremove

func (a *AUR) Autoremove(ctx context.Context, opts ...snack.Option) error

Autoremove removes orphaned packages via pacman.

func (*AUR) Available

func (a *AUR) Available() bool

Available reports whether the AUR toolchain (git, makepkg, pacman) is present.

func (*AUR) Clean

func (a *AUR) Clean(_ context.Context) error

Clean removes cached build artifacts from the build directory.

func (*AUR) Info

func (a *AUR) Info(ctx context.Context, pkg string) (*snack.Package, error)

Info returns details about a specific AUR package from the RPC API.

func (*AUR) Install

func (a *AUR) Install(ctx context.Context, pkgs []snack.Target, opts ...snack.Option) (snack.InstallResult, error)

Install clones, builds, and installs AUR packages.

func (*AUR) IsInstalled

func (a *AUR) IsInstalled(ctx context.Context, pkg string) (bool, error)

IsInstalled reports whether a package is currently installed.

func (*AUR) LatestVersion

func (a *AUR) LatestVersion(ctx context.Context, pkg string) (string, error)

LatestVersion returns the latest version available in the AUR.

func (*AUR) List

func (a *AUR) List(ctx context.Context) ([]snack.Package, error)

List returns all installed foreign (non-repo) packages, which are typically AUR packages.

func (*AUR) ListUpgrades

func (a *AUR) ListUpgrades(ctx context.Context) ([]snack.Package, error)

ListUpgrades returns installed foreign packages that have newer versions in the AUR.

func (*AUR) Name

func (a *AUR) Name() string

Name returns "aur".

func (*AUR) Purge

func (a *AUR) Purge(ctx context.Context, pkgs []snack.Target, opts ...snack.Option) error

Purge removes packages including config files via pacman.

func (*AUR) Remove

func (a *AUR) Remove(ctx context.Context, pkgs []snack.Target, opts ...snack.Option) (snack.RemoveResult, error)

Remove removes packages via pacman (AUR packages are regular pacman packages once installed).

func (*AUR) Search

func (a *AUR) Search(ctx context.Context, query string) ([]snack.Package, error)

Search queries the AUR RPC API for packages matching the query.

func (*AUR) Update

func (a *AUR) Update(_ context.Context) error

Update is a no-op for AUR (there is no local package index to refresh).

func (*AUR) Upgrade

func (a *AUR) Upgrade(ctx context.Context, opts ...snack.Option) error

Upgrade rebuilds and reinstalls all foreign (AUR) packages.

func (*AUR) UpgradeAvailable

func (a *AUR) UpgradeAvailable(ctx context.Context, pkg string) (bool, error)

UpgradeAvailable reports whether a newer version is available in the AUR.

func (*AUR) UpgradePackages

func (a *AUR) UpgradePackages(ctx context.Context, pkgs []snack.Target, opts ...snack.Option) (snack.InstallResult, error)

UpgradePackages rebuilds and reinstalls specific AUR packages.

func (*AUR) Version

func (a *AUR) Version(ctx context.Context, pkg string) (string, error)

Version returns the installed version of a package.

func (*AUR) VersionCmp

func (a *AUR) VersionCmp(ctx context.Context, ver1, ver2 string) (int, error)

VersionCmp compares two version strings using pacman's vercmp.

type AUROption

type AUROption func(*AUR)

Option configures an AUR manager.

func WithBuildDir

func WithBuildDir(dir string) AUROption

WithBuildDir sets a persistent build directory.

func WithMakepkgFlags

func WithMakepkgFlags(flags ...string) AUROption

WithMakepkgFlags sets extra flags for makepkg.

Jump to

Keyboard shortcuts

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