apk
ApkAutoremovablePackages
¶
Orphaned packages that purge would remove.
Commands:
apk add --purge --simulate 2>/dev/null
Returns:
list[ApkPackageVersion]
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_apk_autoremovable.py.
ApkExplicitPackages
¶
The explicitly installed apk packages.
Commands:
cat -- /etc/apk/world 2>/dev/null || true
Returns:
list[ApkPackageVersion]
Raises:
HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_apk_explicit_packages.py.
ApkHeldPackages
¶
The version-pinned apk packages.
Commands:
cat -- /etc/apk/world 2>/dev/null || true
Returns:
list[ApkPackageVersion]
Raises:
HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_hold.py.
ApkInstalledPackages
¶
The installed apk packages.
Commands:
apk list --installed
Returns:
list[ApkPackageVersion]
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_apk_packages.py.
ApkPackage
¶
Detailed information about a specific apk package, as an ApkPackageInfo.
Commands:
apk info -a <package> 2>/dev/null || true
Returns:
ApkPackageInfo | None
Raises:
HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_apk_package.py.
ApkPackageInfo
¶
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The package name, e.g. |
|
version |
The version-and-release apk reports, e.g. |
|
description |
The one-line package description (apk's |
|
url |
The upstream homepage (apk's |
|
license |
The SPDX license identifier (apk's |
|
size |
The installed size in bytes (apk's |
|
depends |
The package's dependency strings (apk's |
|
provides |
The virtual names the package provides (apk's |
ApkPackageVersion
¶
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The bare package name, e.g. |
|
version |
The version-and-release ( |
ApkRepositories
¶
The configured apk repositories, as a list of ApkRepository dicts.
Commands:
cat -- /etc/apk/repositories 2>/dev/null || true
Returns:
list[ApkRepository]
Raises:
HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_apk_repositories.py.
ApkRepositoriesFile
¶
The current content of the apk repositories file, or None when it is absent.
Commands:
test -e <path> && { printf '#reemote-apkrepositories\n'; cat -- <path>; }
Returns:
str | None
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_repository.py.
ApkRepository
¶
Attributes:
| Name | Type | Description |
|---|---|---|
url |
The repository URL, e.g.
|
|
tag |
The repository tag selecting the repository -- the |
autoremove
async
¶
Remove orphan packages nothing reaches any more.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
The apk purge command, when orphans are purgable. |
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_autoremove.py.
hold
async
¶
hold(
ctx: OpContext,
packages: str | list[str] | tuple[str, ...],
present: bool = True,
version: str | None = None,
**kwargs: Any,
) -> AsyncGenerator[Command]
Hold packages back from upgrades, or release held ones (apk pins).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
packages
|
str | list[str] | tuple[str, ...]
|
Package names to hold or
unhold; a single string or a list/tuple. Prefer tuples when
building requests via |
required |
present
|
bool
|
Whether the hold should be present
( |
True
|
version
|
str | None
|
The optional version constraint to pin
to -- a bare |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
Generated apk hold commands. |
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_hold.py.
packages
async
¶
packages(
ctx: OpContext,
packages: str
| list[str]
| tuple[str, ...]
| None = None,
present: bool = True,
latest: bool = False,
no_cache: bool = False,
no_scripts: bool = False,
**kwargs: Any,
) -> AsyncGenerator[Command]
Add/remove/update apk packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
packages
|
str | list[str] | tuple[str, ...] | None
|
Packages
to ensure. Prefer tuples when building requests via |
None
|
present
|
bool
|
Whether the packages should be installed. Defaults to True. |
True
|
latest
|
bool
|
Whether to upgrade installed packages without a pinned version. Defaults to False. |
False
|
no_cache
|
bool
|
Add |
False
|
no_scripts
|
bool
|
Add |
False
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
Generated apk package commands. |
Raises:
CommandNotFoundError, HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_apk_packages.py.
repository
async
¶
repository(
ctx: OpContext,
src: str,
present: bool = True,
**kwargs: Any,
) -> AsyncGenerator[Command]
Add/remove an apk repository line in /etc/apk/repositories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
src
|
str
|
Repository line -- a bare URL
( |
required |
present
|
bool
|
Whether the repository should exist in the file. Defaults to True. |
True
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
Generated apk repository line commands. |
Raises:
CommandNotFoundError, HostConnectionError, ValueError
Examples:
Examples can be found in examples/modules/apk/apk_repository.py.
virtual
async
¶
virtual(
ctx: OpContext,
tag: str,
packages: str
| list[str]
| tuple[str, ...]
| None = None,
present: bool = True,
**kwargs: Any,
) -> AsyncGenerator[Command]
Manage an apk virtual package group..
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
tag
|
str
|
The virtual package name apk records in |
required |
packages
|
str | list[str] | tuple[str, ...] | None
|
The
member packages the virtual group depends on; a single string, a
list/tuple, or None. Prefer tuples when building requests via
|
None
|
present
|
bool
|
Whether the virtual group should exist. Defaults to True. |
True
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
Generated apk virtual package commands. |
Raises:
HostConnectionError
Examples:
Examples can be found in examples/modules/apk/apk_virtual.py.