Skip to content

pacman Operations

Manage pacman packages. (Arch Linux package manager)

Facts used in these operations: pacman.PacmanPackages, pacman.PacmanUnpackGroup.

pacman.packages

Add/remove pacman packages.

pacman.packages(packages: 'str | list[str] | None' = None, present=True, update=False, upgrade=False,
         **kwargs,
    )
  • packages: list of packages to ensure
  • present: whether the packages should be installed
  • update: run pacman -Sy before installing packages
  • upgrade: run pacman -Su before installing packages

Versions: Package versions can be pinned like pacman: <pkg>=<version>.

Example:

from pyinfra.operations import pacman
pacman.packages(
    name="Install Vim and a plugin",
    packages=["vim-fugitive", "vim"],
    update=True,
)

Global arguments

This operation also inherits all global arguments.

pacman.update

Stateless operation

This operation will always execute commands and is not idempotent.

Updates pacman repositories.

pacman.update**kwargs,    )

Global arguments

This operation also inherits all global arguments.

pacman.upgrade

Stateless operation

This operation will always execute commands and is not idempotent.

Upgrades all pacman packages.

pacman.upgrade**kwargs,    )

Global arguments

This operation also inherits all global arguments.