Pacman

class rmote.tools.pacman.State(*values)[source]

Bases: IntEnum

ABSENT = 1
LATEST = 2
PRESENT = 0
class rmote.tools.pacman.Package(name, state=State.PRESENT, version='')[source]

Bases: object

classmethod from_string(s, state=State.PRESENT)[source]
Return type:

Package

name: str
classmethod parse(s, state=State.PRESENT)[source]
Return type:

Package

state: int = 0
version: str = ''
class rmote.tools.pacman.Result(name, changed, version='')[source]

Bases: object

changed: bool
classmethod from_package(package, changed)[source]
Return type:

Result

name: str
version: str = ''
class rmote.tools.pacman.Pacman[source]

Bases: Tool

Manage Arch Linux packages via pacman. Requires root on the remote host.

classmethod converge(*packages)[source]

Ensure all packages are present.

Parameters:

*packages (Text | Package) – Package names or Package instances.

Return type:

list[Result]

Returns:

List of Result objects, one per package, in the same order as the input.

static package(package, state=State.PRESENT)[source]

Install, remove, or upgrade a single package.

Parameters:
Return type:

Result

Returns:

Result with the package name, installed version, and whether the system was changed.

Raises:

RuntimeError – If the underlying pacman invocation fails.

static update(ttl=-1)[source]

Synchronise the package database (pacman -Sy), with optional TTL-based skipping.

Parameters:

ttl (int | float) – Minimum age in seconds of the last sync before re-running. -1 (default) always synchronises.

Return type:

bool

Returns:

True if pacman -Sy was executed, False if the database is fresher than ttl seconds.

Raises:

RuntimeError – If pacman -Sy exits with a non-zero status.