pacman-repo-builder 0.0.0-rc.36

Build a custom pacman repository from a collection of PKGBUILD directories
Documentation

PacMan Repo Builder

Test Crates.io Version

Build a custom pacman repository from a collection of PKGBUILD directories.

Usage

⚠ WARNING: This program is meant to be used within a docker container.

Manifest file

Manifest file is always named build-pacman-repo.yaml. It contains instruction to build a pacman repository.

Example Manifest File:

# 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]
  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
    pacman: yay
  - directory: baz
    read-build-metadata: srcinfo
    install-missing-dependencies: false
    clean-before-build: true
    clean-after-build: false
    force-rebuild: true
    pacman: yay
    allow-failure: false

Field Explanations:

Top-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`
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.
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.

Generate manifest file

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 the 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.yaml

Note: Replace $repo_dir with path of your repository directory. This directory would contains all built packages. Note: Replace $repo_name with name of your repository file. This file would be fetched by pacman to check for updates.

Replace /usr/bin/makepkg with one that allows running as root

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 --replace

Build a pacman repositories

build-pacman-repo build

Note: Make sure that build-pacman-repo.yaml file exists in current working directory.

Print help message

build-pacman-repo help
build-pacman-repo --help
build-pacman-repo help $command
build-pacman-repo $command --help

GitHub Action

pacman-repo-builder/action let you run build-pacman-repo on an Arch Linux container.

License

GPLv3 © Hoàng Văn Khải.