- pacman
- makepkg
- libalpm.so.13
- libgit2.so
Warning
This program is meant to be used within a docker container.
Manifest file is always named build-pacman-repo.yaml. It contains instruction to build a pacman repository.
# build-pacman-repo.yaml
global-settings:
repository: repo/repo.db.tar.gz
container: container
read-build-metadata: either
record-failed-builds: failed-builds.yaml
install-missing-dependencies: false
clean-before-build: false
clean-after-build: false
force-rebuild: true
pacman: pacman
arch-filter: [x86_64]
check: inherit
packager: Bob <bob@example.com>
allow-failure: true
dereference-database-symlinks: true
members:
- directory: foo
- directory: bar
read-build-metadata: pkgbuild
clean-before-build: false
force-rebuild: true
allow-failure: false
- directory: bar
install-missing-dependencies: true
clean-after-build: false
check: enabled
pacman: yay
- directory: baz
read-build-metadata: srcinfo
install-missing-dependencies: false
clean-before-build: true
clean-after-build: false
force-rebuild: true
check: disabled
pacman: yay
allow-failure: falseTop-Level:
| Field | Type | Description |
|---|---|---|
global-settings |
object | Includes global settings from which all members inherit from. Some settings can be overwritten by member customized properties. |
member |
list | List all members. |
global-settings's own fields:
| Field | Type | Required/Optional | Description |
|---|---|---|---|
repository |
string |
required | Path to repository file (typically ends with .db.tar.gz).It will be passed to repo-add command after each build. |
container |
string |
optional, default = . |
Directory that contains all build directories (a.k.a. members). |
record-failed-builds |
string |
optional | If specified, old failed builds shall be skipped, and new failed builds shall be added to the file. |
arch-filter |
"any" | string[] |
optional, default = any |
Specify all CPU architectures to build. Either any or an array of strings (e.g. [x86_64, i686]). |
packager |
string |
optional, default = Unknown Packager |
Identity of person or entity that produces the packages (i.e. the one who run this program). |
dereference-database-symlinks |
boolean |
optional, default = false |
If true, all *.db and *.files symlinks will be converted to real files. |
member's own fields:
| Field | Type | Required/Optional | Description |
|---|---|---|---|
directory |
string |
required | Path to build directory of each member (relative to global-settings.container). |
Shared Fields: Fields that exist in both global-settings and member. If global-settings and member both contain a field, member's field will be prioritized.
| Field | Type | Default ( global-settings) |
Description |
|---|---|---|---|
read-build-metadata |
either | srcinfo | pkgbuild |
either |
Where to read build metadata:srcinfo: From .SRCINFO file.pkgbuild: From output of makepkg --printsrcinfo.either: From .SRCINFO file if it exists, otherwise execute makepkg --printsrcinfo. |
install-missing-dependencies |
boolean |
false |
Install packages found in depends and makedepends before each build. |
clean-before-build |
boolean |
false |
Clean $srcdir and $pkgdir before each build. |
clean-after-build |
boolean |
false |
Clean up after each build. |
force-rebuild |
boolean |
false |
Force build even if target package already exists. |
check |
enabled | disabled | inherit |
inherit |
Whether to add --check or --nocheck to makepkg command. |
pacman |
string |
pacman |
Package manager program to use. The program must recognize pacman's CLI arguments and options. |
allow-failure |
boolean |
false |
If false, exits immediately when a build fails.If true, ignore build failure should one occurs. |
Listing every member in a manifest file can be a chore. So when there are no members with customized properties, you can generate the manifest file to reflect the build directories instead:
build-pacman-repo print-config \
--repository $repo_dir/$repo_name.db.tar.gz \
--container build-directories \
--require-pkgbuild \
--require-srcinfo \
--with-install-missing-dependencies true \
> build-pacman-repo.yamlNote
Replace $repo_dir with path of your repository directory. This directory will contain all built packages.
Note
Replace $repo_name with name of your repository file. This file will be fetched by pacman to check for updates.
The normal makepkg script does not allow running as root. While it may make sense in a user's machine,
it inconveniences a Docker container.
build-pacman-repo patch-makepkg --replacebuild-pacman-repo buildUse an empty output repository and pass the preceding published snapshot with
build --previous /path/to/previous. A missing snapshot builds all recipes.
The builder records recipe input and archive hashes in build-state.yaml.
It carries forward matching archives and indexes the active recipe set.
Start from a fresh recipe checkout so old local build files do not affect the
input hashes. Keep build-state.yaml with the release assets.
Use --build-context for a pinned SDK or toolchain revision. A changed value
invalidates the cached archives. force-rebuild still works per manifest or
recipe. For cross-compiled archives, --build-only skips installing built or
reused packages into the host database. Host build dependencies still follow
the manifest settings. Increment pkgrel when a published package is rebuilt
with changed contents at the same upstream version.
Build consumers using GitHub Releases can call ci/github-actions/fetch-repo.sh
with the GitHub repository, release tag, Pacman repository name, and output
directory. It downloads the build state and the packages listed by the current
index for that tag.
build-pacman-repo sign NAME SOURCE DESTINATION stages signed packages, indexes,
and the public signing key in a new output directory. Set
PACMAN_SIGNING_FINGERPRINT to the full 40-digit primary fingerprint and
PACMAN_SIGNING_PRIVATE_KEY to the armored signing key or exported signing
subkey. Set PACMAN_SIGNING_PASSPHRASE for a protected key. The command uses a
temporary GnuPG keyring, includes package signatures in the index, and carries
forward the incremental build metadata. It requires GnuPG and repo-add.
Note
Make sure that build-pacman-repo.yaml file exists in current working directory.
build-pacman-repo helpbuild-pacman-repo --helpbuild-pacman-repo help $commandbuild-pacman-repo $command --helpThe main purpose is to build a pacman repository. When the build command is called, it will read all source infos
from either .SRCINFO or PKGBUILD, sort them by their dependency relationship, then build them one by one.
In order for this program to function properly, it must make several changes to the host system, such as:
- Replace
/usr/bin/makepkgwith one that allows running as root, so that it may be used in a CI environment. - Install every built package just in case it may be depended upon by another package.