apkg commands¶
To get a summary of available apkg
commands, simply run it without parameters:
$> apkg
Usage: apkg [OPTIONS] COMMAND [ARGS]...
apkg the upstream packaging automation tool
Options:
-L, --log-level [debug|verbose|info|brief|quiet]
set log level [default: info]
-h, --help show this help message
--version show apkg version
Commands:
build build packages
build-dep install or list build dependencies
clean clean apkg output directory (pkg/)
compat check apkg compat level
get-archive download upstream archive for current project
info show various apkg information
install install packages using native package manager
lint run native distro linter on packages
make-archive create dev archive from current project state
srcpkg create source package (files to build packages from)
status show status of current project
system-setup setup system for packaging
test run packaging tests
test-dep install or list testing dependencies
Use --help
/-h
after a command to get help for that particular command instead:
$> apkg command --help
status¶
$> apkg status --help
Usage: apkg status [OPTIONS]
show status of current project
Options:
-d, --distro TEXT override target distro [default: current]
-h, --help show this help
Example:
$> apkg status
project name: apkg
project base path: /home/u/src/apkg
project VCS: git
project config: distro/config/apkg.toml (exists)
package templates path: distro/pkg (exists)
package templates:
arch: arch pkgstyle default: arch
deb: deb pkgstyle default: ubuntu | debian | linuxmint | raspbian
nix: nix pkgstyle default: nix | nixos
rpm: rpm pkgstyle default: fedora | centos | rocky | rhel | opensuse | oracle | pidora | scientific
current distro: arch / Arch Linux
package style: arch
package template: distro/pkg/arch
system-setup¶
$> apkg system-setup --help
Usage: apkg system-setup [OPTIONS]
setup system for packaging
Install native distro packages required for packaging.
Select desired packages with a combination of
-c / --core: core packages for direct package builds [default]
-I / --isolated`: packages for isolated package builds
-L / --lint`: packages for linting (apkg lint)
or
-a / --all to select all above.
Defaults to --core when no options are supplied.
Options:
-c, --core install core packages for direct package builds
[default]
-I, --isolated install packages for isolated package builds
-L, --lint install packages for linting (apkg lint)
-a, --all install all of above (-cIL)
-d, --distro TEXT override target distro [default: current]
--ask / --no-ask enable/disable interactive mode [default: no-ask]
-h, --help show this help message
make-archive¶
$> apkg make-archive --help
Usage: apkg make-archive [OPTIONS]
create dev archive from current project state
Options:
-O, --result-dir TEXT put results into specified dir
--cache / --no-cache enable/distable cache [default: cache]
-h, --help show this help
make-archive
requires
project.make_archive_script
config option to be set.
This command will only succeed when the script finishes successfully (with exit code 0) and the resulting archive it created and printed to stdout followed by one line for each additional file (like signature).
Resulting archive is copied to pkg/archives/dev/
or to --result-dir
.
Resulting archive is cached if cache.source is enabled. See source cache for requirements.
get-archive¶
$> apkg get-archive --help
Usage: apkg get-archive [OPTIONS]
download upstream archive for current project
Options:
-v, --version TEXT version of archive to download
-O, --result-dir TEXT put results into specified dir
--cache / --no-cache enable/distable cache [default: cache]
-h, --help show this help
get-archive
requires
upstream.archive_url
config option to be set with additional options available in
upstream config section.
This command will only succeed when it managed to download specified archive.
Archive is downloaded into pkg/archives/upstream/
or to --result-dir
.
If automatic latest upstream version detection doesn't work,
you can always supply version manually with -v
/--version
option,
i.e. apkg get-archive -v 1.2.3
Resulting archive is cached if cache.remote is enabled.
srcpkg¶
$> apkg srcpkg --help
Usage: apkg srcpkg [OPTIONS] [INPUT_FILES]...
create source package (files to build packages from)
Options:
-a, --archive source package from speficied archive file(s)
-u, --upstream upstream source package from archive templates
-v, --version TEXT upstream archive version to use, implies --upstream,
exclusive with --archive
-r, --release TEXT set packagge release [default: 1]
-d, --distro TEXT set target distro [default: current]
-O, --result-dir TEXT put results into specified dir [default:
pkg/srcpkg/DISTRO/NVR]
--render-template only render source package template
--cache / --no-cache enable/disable cache [default: cache]
-F, --file-list TEXT specify text file listing one input file per line,
use '-' to read from stdin
-h, --help show this help message
Resulting source package is cached if both cache.local and
cache.source are enabled, unless using --upstream
which only requires cache.local.
See source cache for more info.
build¶
$> apkg build --help
Usage: apkg build [OPTIONS] [INPUT_FILES]...
build packages
Options:
-s, --srcpkg use source package
-a, --archive use template (/build srcpkg) from archive
-u, --upstream use upstream template / archive / srcpkg
-v, --version TEXT upstream archive version to use, implies --upstream,
exclusive with --srcpkg and --archive
-r, --release TEXT set packagge release [default: 1]
-d, --distro TEXT override target distro [default: current]
-b, --build-dep install build dependencies on host (apkg build-dep)
-O, --result-dir TEXT put results into specified dir [default:
pkg/srcpkg/DISTRO/NVR]
--cache / --no-cache enable/disable cache [default: cache]
-F, --file-list TEXT specify text file listing one input file per line,
use '-' to read from stdin
-I, --isolated use isolated builder (pbuilder, mock, ...)
-i, --install-dep [DEPRECATED] compat alias for --build-dep
-h, --help show this help message
Resulting packages are cached if cache.local is enabled.
build-dep¶
$> apkg build-dep --help
Usage: apkg build-dep [OPTIONS] [INPUT_FILES]...
install or list build dependencies
Options:
-l, --list list build deps only, don't install
-t, --test-dep include testing deps as well
-u, --upstream use upstream template / archive / srcpkg
-s, --srcpkg use source package
-a, --archive use template (/build srcpkg) from archive
-d, --distro TEXT override target distro [default: current]
-F, --file-list TEXT specify text file listing one input file per line, use
'-' to read from stdin
--ask / --no-ask enable/disable interactive mode [default: no-ask]
-y, --yes compat alias for --no-ask
-h, --help show this help message
install¶
$> apkg install --help
Usage: apkg install [OPTIONS] [INPUT_FILES]...
install packages using native package manager
Default: build packages and install them
`apkg build` options are available
you can supply a list of --custom-pkgs or --distro-pkgs to install specified
custom/distro packages directly without any build
Options:
-C, --custom-pkgs install custom packages (no build)
-D, --distro-pkgs install packages from distro repos (no build)
-s, --srcpkg build and install packages from srcpkg
-a, --archive build and install packages from archive
-u, --upstream build and install upstream packages
-v, --version TEXT upstream archive version to use, implies --upstream
-r, --release TEXT set release for built packages [default: 1]
-b, --build-dep install build deps on host (apkg build-dep)
-d, --distro TEXT override target distro [default: current]
--cache / --no-cache enable/disable cache [default: cache]
--ask / --no-ask enable/disable interactive mode [default: no-ask]
-F, --file-list TEXT specify text file listing one input file per line, use
'-' to read from stdin
-y, --yes [DEPRECATED] compat alias for --no-ask
-h, --help show this help message
lint¶
$> apkg lint --help
Usage: apkg lint [OPTIONS] [INPUT_FILES]...
run native distro linter on packages
Default: build packages from source and lint them
You can supply files to lint as arguments or use --file-list.
Use --pedantic to run extra / all checks.
Use --info to get details explanations about individual messages.
Use --strict to treat all messages as errors (useful for pedantic CI).
To install linter packages on host system use --lint-dep which calls
apkg system-setup --lint
before linting.
Options:
-p, --pedantic enable extra / all warnings and infos
-i, --info give detailed info about warnings
-s, --strict treat all messages as errors
-d, --distro TEXT override target distro [default: current]
-L, --lint-dep install linting dependencies on host (apkg system-
setup --lint)
--cache / --no-cache enable/disable cache [default: cache]
-F, --file-list TEXT specify text file listing one input file per line, use
'-' to read from stdin
-h, --help show this help message
Info
Added in apkg
0.6.0
clean¶
$> apkg clean --help
Usage: apkg clean [OPTIONS]
clean apkg output directory (pkg/)
Options:
-c, --cache clean apkg cache metadata only
--hard [!] HARD RESET project from VCS and REMOVE extra files
-h, --help show this help
test¶
$> apkg test --help
Usage: apkg test [OPTIONS] [INPUT_FILES]...
run packaging tests
Options:
-i, --info show tests information and exit
-l, --list-tests list tests and exit
-c, --show-control print tests control file and exit (render if needed)
-u, --upstream use upstream archive
-a, --archive use test deps from archive
-d, --distro TEXT override target distro [default: current]
-t, --test-dep install testing dependencies on host (apkg test-dep)
-k, --test-filter TEXT only select tests matching supplied REGEX
-F, --file-list TEXT specify text file listing one input file per line,
use '-' to read from stdin
-h, --help show this help message
test-dep¶
$> apkg test-dep --help
Usage: apkg test-dep [OPTIONS] [INPUT_FILES]...
install or list testing dependencies
Options:
-l, --list list test deps only, don't install
-u, --upstream use upstream archive
-a, --archive use test deps from archive
-d, --distro TEXT override target distro [default: current]
-F, --file-list TEXT specify text file listing one input file per line, use
'-' to read from stdin
--ask / --no-ask enable/disable interactive mode [default: no-ask]
-h, --help show this help message
info¶
$> apkg info
Usage: apkg info [OPTIONS] COMMAND [ARGS]...
show various apkg information
Options:
-h, --help show command help
Commands:
cache show apkg cache contents
config show apkg project configuration
distro show current distro information
distro-aliases list available distro aliases
pkgstyles list available packaging styles
template-variables show variables available in packaging template
upstream-version show detected project upstream version
info cache¶
$> apkg info cache
I apkg cache: pkg/.cache.json
{
"archive/dev/194e7c1ba5": [
[
"pkg/archives/dev/apkg-v0.3.1.dev34+g194e7c1.tar.gz",
"739f1da7fc4bd49bdb81"
]
],
...
}
info config¶
$> apkg info config
I project config: distro/config/apkg.toml
[project]
name = "apkg"
make_archive_script = "scripts/make-archive.sh"
[upstream]
archive_url = "https://gitlab.nic.cz/packaging/apkg/-/archive/v{{ version }}/apkg-v{{ version }}.tar.gz"
version_script = "scripts/upstream-version.py"
[template]
[[template.variables]]
python_module = "apkg.templatevars.debseries"
[apkg]
compat = 4
info distro¶
$> apkg info distro
id = "debian"
version = "12"
like = ""
codename = "bookworm"
[version_parts]
major = "12"
minor = ""
build_number = ""
info distro¶
$> apkg info distro-aliases
deb-old: debian <= 9 | ubuntu < 20.04
el-8: rocky == 8 | centos == 8 | rhel == 8
info pkgstyles¶
$> apkg info pkgstyles
arch
module: apkg.pkgstyles.arch
file: /usr/local/lib/python3.11/dist-packages/apkg/pkgstyles/arch.py
distros: arch | manjaro
deb
module: apkg.pkgstyles.deb
file: /usr/local/lib/python3.11/dist-packages/apkg/pkgstyles/deb.py
distros: debian | linuxmint | pop | raspbian | ubuntu
nix
module: apkg.pkgstyles.nix
file: /usr/local/lib/python3.11/dist-packages/apkg/pkgstyles/nix.py
distros: nix | nixos
rpm
module: apkg.pkgstyles.rpm
file: /usr/local/lib/python3.11/dist-packages/apkg/pkgstyles/rpm.py
distros: almalinux | centos | fedora | opensuse | oracle | pidora | rhel | rocky | scientific
info upstream-version¶
$> apkg info upstream-version
I detected upstream version (from script): 0.5.1
upstream version: 0.5.1