Skip to content

Add pacman package manager commands #31

Description

@andrew

Version: git-pkgs/managers current main at 241e284.

Trying to build an Arch package operation after registering the embedded definitions currently returns unknown manager: pacman:

_, err := tr.BuildCommand("pacman", "add", managers.CommandInput{
	Args: map[string]string{"package": "core/bash", "version": "5.3.3-1"},
})

Add a pacman definition for Arch's system package manager. Include definitions/pacman.yaml, captured version and command help under references/pacman, translator tests, and Docker coverage as described in the new manager contribution guide.

Pacman has no project manifest or lockfile, so this definition should be selected explicitly through DetectOptions.Manager. A PKGBUILD belongs to the makepkg build flow and should not trigger this installed-package manager.

Use the native pacman operations:

  • Map add to pacman -S --needed --noconfirm PACKAGE and remove to pacman -R --noconfirm PACKAGE. The pacman(8) sync documentation covers repository-qualified targets such as testing/qt and constraints such as bash>=3.2.
  • Map list to pacman -Q, outdated to pacman -Qu, and update to pacman -Syu --noconfirm. The query options define installed and upgrade filtering.
  • Keep repository refresh and system upgrade in the same -Syu transaction. The sync options describe -u and recommend using -y with it. outdated should query the current sync database without silently running pacman -Sy first.

The generic install operation has no package set to pass to pacman -S, so leave it unsupported unless the public API gains a safe way to provide the desired packages. Pacman's -T operation checks named dependency constraints but does not return a dependency graph. -Ql returns all files owned by a package rather than one package directory. Do not advertise resolve or path for those commands.

Repository URLs are configured in pacman.conf, while a command can select a configured repository with the repository/package target syntax. The checked-in pacman.conf template provides an example configuration file for tests and documentation.

Reuse the per-command privilege metadata requested in #30. Generated commands should not prepend sudo; callers need to choose how system-changing operations are elevated. Use pacman's documented --noconfirm flag for non-interactive mutations.

Tests should cover repository-qualified names, exact and range versions, --needed, non-interactive add and remove commands, installed and outdated listings, the atomic -Syu update, and privilege metadata. Include cases proving that outdated does not refresh repositories and that unsupported install, resolve, and path capabilities are not declared.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions