build_configs/README.md
2026-04-30 15:31:31 +03:00

215 lines
6.5 KiB
Markdown

# build_configs
Per-package build overrides for [AlmaLinux Build System (ALBS)](https://build.almalinux.org).
This repository contains a single file `build_configs.json` that defines per-package build parameters.
## Format
```json
{
"package_name": {
"branch_pattern": {
"secure_boot": true,
"platform_flavors": ["flavor-name"],
"linked_builds": [123],
"mock_options": {
"definitions": {"key": "value"},
"module_enable": ["module:stream"],
"yum_exclude": ["package-name"],
"with": ["option"],
"without": ["option"],
"target_arch": "noarch"
}
}
}
}
```
The top-level key is the **source package name** (as in the SRPM filename, e.g. `kernel`, `dotnet8.0`, `gcc-toolset-14-gcc`).
Each package maps one or more **branch patterns** to an overrides object. Patterns use [fnmatch](https://docs.python.org/3/library/fnmatch.html) syntax and are matched against the `build_configs_branch` field in the product's `albs_config` (e.g. `almalinux-epel-10`, `kitten-epel-10`) or the `git_branch` for git-based builds.
When multiple patterns match, the most specific one wins (more literal characters = higher priority).
## Field Reference
### Per-build parameters
These affect the entire ALBS build. If packages in the same batch have different values for these, they are automatically split into separate ALBS builds.
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `secure_boot` | `bool` | `false` | Enable SecureBoot signing for the build |
| `platform_flavors` | `list[str]` | `[]` | Additional platform flavors (appended to the product's base flavors) |
| `linked_builds` | `list[int]` | `[]` | ALBS build IDs to link (appended to product-level linked_builds) |
### Per-task parameters (mock_options)
These are applied per-package within a single ALBS build. Different mock_options do **not** require separate builds.
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `mock_options.definitions` | `dict[str, str]` | `{}` | RPM macro definitions (merged with product-level definitions; package values win on conflict) |
| `mock_options.module_enable` | `list[str]` | `[]` | DNF module streams to enable in the chroot (format: `module:stream`) |
| `mock_options.yum_exclude` | `list[str]` | `[]` | Packages to exclude from the mock chroot |
| `mock_options.with` | `list[str]` | `[]` | `--with` conditional build options |
| `mock_options.without` | `list[str]` | `[]` | `--without` conditional build options |
| `mock_options.target_arch` | `str` | `""` | Override the RPM build target arch for this package (mock `--target=<arch>`). Useful for packages whose SRPM must always produce a fixed arch — e.g. `"noarch"` for Java packages like `maven`. Empty string = no override. Applied per-task; does not split the build. |
## Branch Patterns
Patterns use fnmatch syntax. Common conventions:
| Pattern | Matches | Use case |
|---------|---------|----------|
| `a*` | `a8`, `a9`, `a10`, `almalinux-epel-10` | AlmaLinux branches |
| `c*` | `c8`, `c8s`, `c9s`, `c10s` | CentOS Stream branches |
| `c8` | `c8` only | Exact CentOS 8 branch |
| `*` | Everything | Catch-all for all branches |
| `*portable*` | `a10-portable`, `c10s-portable` | Portable builds |
| `almalinux-epel-10` | `almalinux-epel-10` only | Exact EPEL for AlmaLinux 10 |
| `kitten-epel-10` | `kitten-epel-10` only | Exact EPEL for AlmaLinux Kitten 10 |
When multiple patterns match, specificity is determined by the number of literal (non-wildcard) characters. For example, `*portable*` beats `*` because it has more literal content.
## Examples
### SecureBoot signing
```json
{
"kernel": {
"a*": { "secure_boot": true }
},
"grub2": {
"a*": { "secure_boot": true }
}
}
```
Kernel and grub2 will have `is_secure_boot: true` in ALBS builds for all AlmaLinux branches.
### Platform flavors (dotnet)
```json
{
"dotnet8.0": {
"c*": { "platform_flavors": ["dotnet-build"] }
}
}
```
dotnet8.0 builds for CentOS Stream branches will include the `dotnet-build` flavor (appended to the product's base flavors).
### RPM macro definitions (gcc-toolset)
```json
{
"gcc-toolset-14-gcc": {
"c*": {
"mock_options": {
"definitions": { "scl": "gcc-toolset-14" }
}
}
}
}
```
The `%scl` macro will be set to `gcc-toolset-14` in the mock chroot. This is merged with any product-level definitions (e.g. `epel: 10`).
### Module dependencies
```json
{
"sssd": {
"c8": {
"mock_options": {
"module_enable": ["idm:DL1"]
}
},
"a8": {
"mock_options": {
"module_enable": ["idm:DL1"]
}
}
}
}
```
sssd on EL8 branches requires the `idm:DL1` module stream enabled in the build chroot.
### SecureBoot + custom definitions
```json
{
"nvidia-open-kmod": {
"a*": {
"secure_boot": true,
"mock_options": {
"definitions": { "modsign_os": "almalinux-nvidia-signing" }
}
}
}
}
```
nvidia-open-kmod gets both SecureBoot signing and a custom signing identity macro.
### Per-package build target (mock `--target`)
```json
{
"maven": {
"*": {
"mock_options": {
"target_arch": "noarch"
}
}
}
}
```
### Portable builds (disable %check)
```json
{
"java-21-openjdk": {
"*": { "platform_flavors": ["java-portable"] },
"*portable*": {
"mock_options": {
"definitions": { "__spec_check_template": "exit 0;" }
}
}
}
}
```
All java-21-openjdk builds get the `java-portable` flavor. Portable branch builds additionally skip `%check` via a mock definition override. The `*portable*` pattern is more specific than `*` and takes priority for portable branches.
## How It Works
1. `releng-monitoring` fetches this file periodically (every 30 minutes)
2. When creating ALBS builds, it looks up each package name and matches against branch patterns
3. Per-build overrides (`secure_boot`, `platform_flavors`) determine build grouping — packages with different per-build params go into separate ALBS builds
4. Per-task overrides (`mock_options`) are applied individually to each package's task within a build
5. Product-level `albs_config` (from `repositories.yaml`) is always the base layer; this file acts as an overlay
## Adding a New Package
1. Add a new top-level key with the source package name
2. Add one or more branch patterns with the desired overrides
3. Commit and push — changes take effect within 30 minutes (next refresh cycle)
```json
{
"my-package": {
"a*": {
"mock_options": {
"definitions": { "my_macro": "value" }
}
}
}
}
```