Skip to content

Add apk package manager commands #30

Description

@andrew

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

Trying to build Alpine package operations after registering the embedded definitions currently returns unknown manager: apk:

_, err := tr.BuildCommand("apk", "add", managers.CommandInput{
	Args: map[string]string{"package": "curl", "version": "8.14.1-r2"},
})

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

The command mapping should follow apk's own command and file formats:

  • Use apk add and apk del for package constraints. The apk-world(5) package specification covers exact versions such as curl=8.14.1-r2 and tagged repositories such as curl@edge.
  • Use apk list --installed for list, apk list --upgradable for outdated, and apk upgrade [packages] for update. apk update only refreshes repository indexes, so it should not be exposed as a package update.
  • apk dot --installed can provide raw dependency graph output for resolve; the command supports the shared query filters documented by apk-query(8).
  • Do not advertise path from apk info --contents. That command returns every owned file, not one package directory.

The generic install operation needs a safe definition because it has no package argument. apk fix repairs or reinstalls packages, so it should not be used as an install alias. Leave install unsupported unless the operation can reconcile a supplied world file without changing the existing API contract.

Repository flags need a small translator change. Apk requires global options before the command, while the current translator adds the command, positional arguments, and then dynamic flags. Add support for pre-command flags so repository selection is emitted as apk --repository URL add PACKAGE. The upstream apk-repositories(5) examples show repository configuration files that can be used as fixtures.

Commands that change the system normally require elevated permissions. The current Command schema does not expose this to callers. Add per-command privilege metadata and keep sudo out of generated commands so the caller controls elevation.

Tests should cover exact versions, repository tags and URLs, flag placement, installed and upgradable listings, package-specific and system upgrades, dependency graph output, and privilege metadata. Apk is non-interactive by default, so the definition should not add a nonexistent -y flag.

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