mkosi: share packaging pins with other build tools

The packaging references are part of mkosi's configuration, so tine can't
build a checkout with the same pinned spec. Let's share the pins in one
JSON file keyed by distro and keep mkosi, the packaging updater and
Packit using it.
This commit is contained in:
Daan De Meyer authored and Daan De Meyer committed 2026-10-30 13:20:54 +01:00
1 parent 5b2642de22
commit 12d8bb84b1
12 files changed
+68 -51

No files matched your search

+5 -3
View File
@@ -10,7 +10,7 @@ files_to_sync:
# `git describe` returns in systemd's case 'v245-xxx' which breaks RPM version
# detection (that expects 245-xxxx'). Let's tweak the version string accordingly
upstream_tag_template: "v{version}"
srpm_build_deps: []
srpm_build_deps: [jq]
actions:
get-current-version:
@@ -18,8 +18,10 @@ actions:
post-upstream-clone:
# Use the Fedora Rawhide specfile
- git clone https://src.fedoraproject.org/rpms/systemd .packit_rpm
- bash -c 'git -C .packit_rpm checkout "$(grep GIT_COMMIT= mkosi/mkosi.pkgenv/mkosi.conf.d/centos-fedora.conf | cut -d= -f2)"'
- >-
bash -ec 'read -r url branch commit < <(jq -r ".fedora // empty | [.url, .branch, .commit] | @tsv" tools/packaging.json);
git clone --branch "$branch" "$url" .packit_rpm;
git -C .packit_rpm checkout "$commit"'
- bash -c 'echo "%bcond upstream 1" > .packit_rpm/systemd.spec.new'
- bash -c 'echo "%define meson_extra_configure_options --werror" >> .packit_rpm/systemd.spec.new'
- bash -c 'cat .packit_rpm/systemd.spec >> .packit_rpm/systemd.spec.new'
+3
View File
@@ -36,6 +36,9 @@ or via your distribution's package manager. Note that systemd regularly adopts
newer mkosi features that are not in an official release yet so there's a good
chance that your distribution's packaged version of mkosi will be too old.
Install `jq` on the host as well. The packaging sync script runs before the
mkosi tools tree is available.
Make sure to read the "Unprivileged User Namespaces" section in the mkosi documentation
(run `mkosi documentation` to view the mkosi docs) and apply any necessary instructions
to make sure unprivileged user namespaces work on your system.
+1 -1
View File
@@ -29,7 +29,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
20. [FINAL] Edit in the new -stable branch `.obs/workflows.yml`, changing `project` from `system:systemd` to `system:systemd:stable` and the branch from `main` to `v${version}-stable`. This should be backported to older active stable branches too.
21. [FINAL] Build and upload the documentation (on the -stable branch): `ninja -C build doc-sync`
22. [FINAL] Create a new `ci/v${version}-stable` branch for deb package builds on https://github.com/systemd/systemd-deb
23. [FINAL] Switch `.semaphore/semaphore-runner.sh` and `mkosi/mkosi.pkgenv/mkosi.conf.d/debian-ubuntu.conf`
23. [FINAL] Switch `.semaphore/semaphore-runner.sh` and the `debian.branch` field in `tools/packaging.json`
to the new `ci/v${version}-stable` branch on the -stable branch
24. [FINAL] Switch `versionrewrite-pattern` and `versionrewrite-replacement` to release mode in https://build.opensuse.org/projects/system:systemd/packages/systemd/files/_service?expand=1
25. [FINAL] Change the Github Pages branch to the newly created branch (https://github.com/systemd/systemd/settings/pages) and set the 'Custom domain' to 'systemd.io'
+1 -5
View File
@@ -4,8 +4,4 @@
Distribution=arch
[Build]
Environment=
GIT_URL=https://gitlab.archlinux.org/archlinux/packaging/packages/systemd.git
GIT_BRANCH=main
GIT_COMMIT=1a366822100fc46edec7308b8cb2424fde7f037f
PKG_SUBDIR=arch
Environment=PKG_SUBDIR=arch
@@ -6,8 +6,4 @@ Distribution=|centos
Profiles=!hyperscale
[Build]
Environment=
GIT_URL=https://src.fedoraproject.org/rpms/systemd.git
GIT_BRANCH=rawhide
GIT_COMMIT=57cbcf979ce2dd872a871c59e87d2c65dfa996e6
PKG_SUBDIR=fedora
Environment=PKG_SUBDIR=fedora
@@ -6,8 +6,5 @@ Distribution=|ubuntu
[Build]
Environment=
GIT_URL=https://github.com/systemd/systemd-deb.git
GIT_SUBDIR=debian
GIT_BRANCH=deb/main
GIT_COMMIT=23cf74c5cde1e6c8b17b2157c7660a6a97c7a092
PKG_SUBDIR=debian
@@ -7,8 +7,4 @@ Profiles=hyperscale
Distribution=centos
[Build]
Environment=
GIT_URL=https://gitlab.com/CentOS/Hyperscale/rpms/systemd.git
GIT_BRANCH=c10s-sig-hyperscale
GIT_COMMIT=417b671b173ea6271c00a3c605215b5f68795a3a
PKG_SUBDIR=hyperscale
Environment=PKG_SUBDIR=hyperscale
@@ -5,8 +5,5 @@ Distribution=nura
[Build]
Environment=
GIT_URL=https://gitlab.postmarketos.org/postmarketOS/pmaports
GIT_SUBDIR=extra-repos/systemd/systemd
GIT_BRANCH=main
GIT_COMMIT=7a6b81a4f1a7a510d088a5874bebcf2b200b69b3
PKG_SUBDIR=nura
@@ -5,8 +5,5 @@ Distribution=opensuse
[Build]
Environment=
GIT_URL=https://github.com/bmwiedemann/openSUSE
GIT_SUBDIR=packages/s/systemd
GIT_BRANCH=master
GIT_COMMIT=60fbc2d95581a933f9dcdfdb8d7e27d2a7d13e35
PKG_SUBDIR=opensuse
+4
View File
@@ -13,6 +13,10 @@ if [[ -z "${PKG_SUBDIR:-}" ]]; then
exit 0
fi
read -r GIT_URL GIT_BRANCH GIT_COMMIT < <(
jq -r --arg distro "$PKG_SUBDIR" '.[$distro] // empty | [.url, .branch, .commit] | @tsv' tools/packaging.json
)
if [[ -d "pkg/$PKG_SUBDIR/.git" ]]; then
if [[ "$(git -C "pkg/$PKG_SUBDIR" rev-parse HEAD 2>/dev/null)" == "$GIT_COMMIT" ]]; then
exit 0
+20 -23
View File
@@ -12,6 +12,8 @@ import shlex
import subprocess
from pathlib import Path
PACKAGING = Path('tools/packaging.json')
def parse_args():
p = argparse.ArgumentParser(
@@ -46,7 +48,11 @@ def read_config(distro: str):
data = json.loads(text)
images = {image['Image']: image for image in data['Images']}
return images['build']
environment = images['build']['Environment']
return json.loads(PACKAGING.read_text())[environment['PKG_SUBDIR']] | {
'subdir': environment.get('GIT_SUBDIR'),
'pkg_subdir': environment['PKG_SUBDIR'],
}
def commit_file(distro: str, files: list[Path], commit: str, changes: str):
@@ -58,10 +64,10 @@ def commit_file(distro: str, files: list[Path], commit: str, changes: str):
def checkout_distro(args, distro: str, config: dict):
url = config['Environment']['GIT_URL']
branch = config['Environment']['GIT_BRANCH']
subdir = config['Environment'].get('GIT_SUBDIR')
pkg_subdir = config['Environment']['PKG_SUBDIR']
url = config['url']
branch = config['branch']
subdir = config['subdir']
pkg_subdir = config['pkg_subdir']
dest = Path(f'pkg/{pkg_subdir}')
if dest.exists():
@@ -101,10 +107,10 @@ def checkout_distro(args, distro: str, config: dict):
def update_distro(args, distro: str, config: dict):
branch = config['Environment']['GIT_BRANCH']
subdir = config['Environment'].get('GIT_SUBDIR')
old_commit = config['Environment']['GIT_COMMIT']
pkg_subdir = config['Environment']['PKG_SUBDIR']
branch = config['branch']
subdir = config['subdir']
old_commit = config['commit']
pkg_subdir = config['pkg_subdir']
if args.fetch:
cmd = [
@@ -149,18 +155,12 @@ def update_distro(args, distro: str, config: dict):
print(f'+ {shlex.join(cmd)}')
changes = subprocess.check_output(cmd, text=True).strip()
conf_dir = Path('mkosi/mkosi.pkgenv/mkosi.conf.d')
files = conf_dir.glob('*.conf')
for file in files:
s = file.read_text()
if old_commit in s:
print(f'{distro}: {file}: found old hash, updating…')
new = s.replace(old_commit, new_commit)
assert new != s
file.write_text(new)
tocommit = [file]
pins = json.loads(PACKAGING.read_text())
pins[pkg_subdir]['commit'] = new_commit
PACKAGING.write_text(json.dumps(pins, indent=2) + '\n')
tocommit = [PACKAGING]
if distro == 'fedora':
if pkg_subdir == 'fedora':
packit = Path('.packit.yml')
s = packit.read_text()
assert old_commit in s
@@ -169,9 +169,6 @@ def update_distro(args, distro: str, config: dict):
tocommit += [packit]
commit_file(distro, tocommit, new_commit, changes)
break
else:
raise ValueError(f'{distro}: hash {new_commit} not found under {conf_dir}')
if __name__ == '__main__':
+32
View File
@@ -0,0 +1,32 @@
{
"arch": {
"url": "https://gitlab.archlinux.org/archlinux/packaging/packages/systemd.git",
"branch": "main",
"commit": "1a366822100fc46edec7308b8cb2424fde7f037f"
},
"debian": {
"url": "https://github.com/systemd/systemd-deb.git",
"branch": "deb/main",
"commit": "23cf74c5cde1e6c8b17b2157c7660a6a97c7a092"
},
"fedora": {
"url": "https://src.fedoraproject.org/rpms/systemd.git",
"branch": "rawhide",
"commit": "57cbcf979ce2dd872a871c59e87d2c65dfa996e6"
},
"hyperscale": {
"url": "https://gitlab.com/CentOS/Hyperscale/rpms/systemd.git",
"branch": "c10s-sig-hyperscale",
"commit": "417b671b173ea6271c00a3c605215b5f68795a3a"
},
"nura": {
"url": "https://gitlab.postmarketos.org/postmarketOS/pmaports",
"branch": "main",
"commit": "7a6b81a4f1a7a510d088a5874bebcf2b200b69b3"
},
"opensuse": {
"url": "https://github.com/bmwiedemann/openSUSE",
"branch": "master",
"commit": "60fbc2d95581a933f9dcdfdb8d7e27d2a7d13e35"
}
}