Pacman¶
- class rmote.tools.pacman.State(*values)[source]¶
Bases:
IntEnum- ABSENT = 1¶
- LATEST = 2¶
- PRESENT = 0¶
- class rmote.tools.pacman.Pacman[source]¶
Bases:
ToolManage Arch Linux packages via pacman. Requires root on the remote host.
- static package(package, state=State.PRESENT)[source]¶
Install, remove, or upgrade a single package.
- Parameters:
package (
Text|Package) – Package name or aPackageinstance. Version pinning (name=version) is parsed but ignored by pacman.state (
State|int) – Desired state -State.PRESENT(install if absent),State.ABSENT(remove if installed), orState.LATEST(install or upgrade).
- Return type:
- Returns:
Resultwith the package name, installed version, and whether the system was changed.- Raises:
RuntimeError – If the underlying
pacmaninvocation 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:
- Returns:
Trueifpacman -Sywas executed,Falseif the database is fresher than ttl seconds.- Raises:
RuntimeError – If
pacman -Syexits with a non-zero status.