gpak(1) | General Commands Manual | gpak(1) |
gpak - build Debian packages from PKGBUILD repositories
gpak [options...] [packages...]
gpak automates building binary Debian packages from PKBUILD source scripts. gpak reads PKGBUILD scripts from repositories of source packages. Each source package resides in a separate directory with at least one PKGBUILD file inside. For example:
. ├── package1 │ └── PKGBUILD ├── package2 │ ├── PKGBUILD │ └── PKGBUILD.sid └── package3
├── changelog.Debian
├── copyright
├── PKGBUILD.bullseye
└── PKGBUILD.bookworm
By default gpak treats its current working directory as a root of package repository, Using --packages-dir option changes that and allows running gpak from a different directory than repository root. Gpak builds all packages found in the repository, unless the list of wanted packages is narrowed down by passing a packages list.
To build packages, gpak uses OSI containers. Gpak builds in a sandboxed environment and for different distributions. Once built, gpak copies packages to a directory which is available on a host and automatically accessible for the user who runs the gpak command. Output Output directories for packages are located inside a build directory (see: --build-dir).
Engine must support the classical docker interface for creating and running containers.
-b, --build-dir=DIRECTORY
-d, --distribution=NAME
When building a package for a specific distribution, gpak prefers distribution-specific PKGBUILD files, with extension the same as a distribution name, for example PKGBUILD.sid. If distribution-specific PKGBUILD file doesn't exist, then gpak will select ordinary PKGBUILD file for package source.
Name of currently built distribution is propagated to the environment in which gpak executes PKGBUILD. It is accessible as GPAK_DISTRO environment variable. As such, it doesn't rely on the output of lsb_release(1) command.
-r, --remote-path=PATH
--clean
-p, --packages-dir=DIRECTORY
--context
--build-image, --no-build-image
--build, --no-build
--lint, --no-lint
--send, --no-send
Gpak will refuse sending unsafe packages, i.e. the ones which aren't built inside a container (--build-local) or with cache enabled (--cache). To send them anyway, --force switch should be used.
By default sending packages is disabled.
-l, --build-local
This option is unsafe because local environment can have unpredicted side effects on build process. When it's enabled, gpak will refuse to send packages to remote hosts. Using --force switch sends packages anyway.
Using this option requires makedeb(8) program installed on the host system.
By default, packages are built inside the containers (this switch is disabled).
--cache
Normally containers used for package building are ephemeral: gpak creates a new one before build and removes it after. This option saves package containers for future builds of particular package. Note however that containers are never shared between packages.
This option is unsafe because old builds might leave artifacts inside cached containers which may cause side effects for any future builds. Because of that, gpak will refuse to send packages built in cached containers. Using --force switch sends packages anyway.
-f, --force
--ugly
--emoji, --no-emoji
--version
-h, --help
All OPTIONS can be set in a configuration file. Gpak's configuration is a Bash script which defines gpak options in the UPPERCASE_SNAKE_CASE format. Following rules apply:
Options in configuration file have precedens over gpak's default values for options. Options passed directly to gpak during its invocation have precedence over options set inside configuration file.
Gpak searches the following paths for configuration file and uses the first one found:
PACKAGES_DIR="${HOME}/packages" SEND=1 LINT=0 DISTRIBUTIONS=( bullseye bookworm )
Using --context option changes the default Docker Context directory. It holds a source code and instructions (Dockerfile) for building base container images in which packages are built. Normally it isn't necessary to change it, unless a custom, specialized image is needed, for example one with a different set of packages which are built by default.
Users should be very careful when providing their own Docker Contexts. Preferably they should copy-paste default gpak's Docker Context, or inherit through a FROM: Dockerfile's clause. Some gpak's features are tightly coupled with how containers are run.
Below is a typical safe session with gpak, which allows inspecting packages at user's pace:
$ gpak --clean --no-send --lint -d sid mypackage $ dpkg-info build/gpak/sid/mypackage/*.deb $ dpkg-deb -c build/gpak/sid/mypackage/*.deb $ gpak --send --no-build-image --no-build -d sid mypackage
However, when developing new packages, using "unsafe" options should allow faster iterations:
$ gpak --build-local --lint mypackage $ gpak --cache --no-build-image mypackage
makedeb(8), PKGBUILD(5), podman(1), docker(1), dpkg(1), lintian(1), rsync(1)
Michał Góral <dev@goral.net.pl>
Source code: https://git.goral.net.pl/gpak.git
2024-12-21 |