From: Daan De Meyer Date: Tue, 25 Mar 2025 20:02:24 +0000 (+0100) Subject: mkosi: Use build image prepare scripts for tools tree as well X-Git-Tag: v258-rc1~995^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1b49fb9aaa7d5d6dc84d4a1ca56acda2385ef10e;p=thirdparty%2Fsystemd.git mkosi: Use build image prepare scripts for tools tree as well Instead of listing dependencies manually for the default tools tree, let's reuse the prepare scripts from the build image. To make this work, the sync script has to be configured for the tools tree as well so that it's invoked both when building the tools tree and for the regular image, otherwise, when doing the first build in a fresh checkout, the sync script won't have executed yet as sync scripts for the regular images are executed after building the default tools tree. --- diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 2614ee84d94..2f130792520 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -191,10 +191,14 @@ jobs: - name: Configure meson run: | + # /usr/sbin/bpftool is completely broken inside containers on Ubuntu which makes meson blow up so + # disable the bpf-framework stuff to avoid the issue. + # TODO: Drop when we move off Ubuntu Noble as this will be fixed in the next Ubuntu LTS release. sudo mkosi sandbox -- \ meson setup \ --buildtype=debugoptimized \ -Dintegration-tests=true \ + -Dbpf-framework=disabled \ build - name: Build image diff --git a/.packit.yml b/.packit.yml index d5d2ef36368..75d5f6557ac 100644 --- a/.packit.yml +++ b/.packit.yml @@ -19,7 +19,7 @@ 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.images/build/mkosi.conf.d/centos-fedora/mkosi.conf | cut -d= -f2)"' + - bash -c 'git -C .packit_rpm checkout "$(grep GIT_COMMIT= mkosi.conf.d/10-centos-fedora/mkosi.conf | cut -d= -f2)"' - 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' diff --git a/docs/HACKING.md b/docs/HACKING.md index 5a6e57da536..6baa3ae393a 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -39,7 +39,7 @@ chance that your distribution's packaged version of mkosi will be too old. Then, you can build, run and test systemd executables as follows: ```sh -$ mkosi -f sandbox -- meson setup build +$ mkosi -f sandbox -- meson setup -Dbpf-framework=disabled build # bpftool detection inside mkosi sandbox is broken on Ubuntu Noble and older $ mkosi -f sandbox -- meson compile -C build $ mkosi -f sandbox -- build/systemctl --version $ mkosi -f sandbox -- meson test -C build # Run the unit tests diff --git a/mkosi.conf b/mkosi.conf index fc2b12bda2a..033b92d5915 100644 --- a/mkosi.conf +++ b/mkosi.conf @@ -11,7 +11,6 @@ Dependencies= PassEnvironment= NO_BUILD - NO_SYNC WIPE SANITIZERS CFLAGS @@ -24,6 +23,11 @@ PassEnvironment= ASAN_OPTIONS COVERAGE VCS_TAG + GIT_URL + GIT_SUBDIR + GIT_BRANCH + GIT_COMMIT + PKG_SUBDIR [Output] RepartDirectories=mkosi.repart diff --git a/mkosi.conf.d/05-tools/mkosi.conf b/mkosi.conf.d/05-tools/mkosi.conf index 6656cee287f..adbbf98ebff 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf @@ -1,11 +1,8 @@ # SPDX-License-Identifier: LGPL-2.1-or-later [Build] +ToolsTreeSyncScripts=%D/mkosi.sync ToolsTreePackages= - gcc gdb - gperf llvm - meson - pkgconf - rsync + meson # Also needed in the NO_BUILD case so we list it explicitly. diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf index fdb147a1c79..4de8b2bd588 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf @@ -4,19 +4,11 @@ ToolsTreeDistribution=arch [Build] +ToolsTreePrepareScripts=%D/mkosi.images/build/mkosi.conf.d/arch/mkosi.prepare ToolsTreePackages= - cryptsetup + base-devel github-cli lcov - libcap - libmicrohttpd - libxslt mypy - perl-json-xs - python-jinja - python-lxml - python-pytest ruff shellcheck - tpm2-tss - util-linux-libs diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/centos-fedora.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/centos-fedora.conf index 5dc5662115c..2645e6df5d2 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/centos-fedora.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/centos-fedora.conf @@ -5,18 +5,7 @@ ToolsTreeDistribution=|fedora ToolsTreeDistribution=|centos [Build] +ToolsTreePrepareScripts=%D/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.prepare ToolsTreePackages= - pkgconfig(blkid) - pkgconfig(libcap) - pkgconfig(libcryptsetup) - pkgconfig(libcurl) - pkgconfig(fdisk) - pkgconfig(libmicrohttpd) - pkgconfig(mount) - tpm2-tss-devel - python3-jinja2 - python3-lxml python3-mypy - python3-pytest - libxslt - docbook-style-xsl + rpm-build diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf index c060e57e82a..b6715b5c507 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf @@ -5,20 +5,9 @@ ToolsTreeDistribution=|debian ToolsTreeDistribution=|ubuntu [Build] +ToolsTreePrepareScripts=%D/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.prepare ToolsTreePackages= gh lcov - libblkid-dev - libcap-dev - libcryptsetup-dev - libcurl4-openssl-dev - libfdisk-dev - libmicrohttpd-dev - libmount-dev - libtss2-dev mypy - python3-jinja2 - python3-lxml - python3-pytest shellcheck - xsltproc diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf index aeaa325d069..b7af1419645 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf @@ -4,23 +4,11 @@ ToolsTreeDistribution=opensuse [Build] +ToolsTreePrepareScripts=%D/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare ToolsTreePackages= - lcov - libz1 gh + lcov mypy - pkgconfig(blkid) - pkgconfig(libcap) - pkgconfig(libcryptsetup) - pkgconfig(libcurl) - pkgconfig(fdisk) - pkgconfig(libmicrohttpd) - pkgconfig(mount) - pkgconfig(libopenssl) python3-ruff - tpm2-0-tss-devel - python3-jinja2 - python3-lxml - python3-pytest - xsltproc + rpm-build ShellCheck diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf new file mode 100644 index 00000000000..3078782ae30 --- /dev/null +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +ToolsTreeDistribution=ubuntu diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf.d/non-x86.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf.d/non-x86.conf new file mode 100644 index 00000000000..bbddf8e25fa --- /dev/null +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf.d/non-x86.conf @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# The ports Ubuntu archive is for non i386/amd64 repositories + +[Match] +Architecture=!x86-64 +Architecture=!x86 +ToolsTreeRelease=noble + +[Build] +ToolsTreeSandboxTrees=%D/mkosi.conf.d/10-ubuntu/noble-backports-ports.sources:/etc/apt/sources.list.d/noble-backports-ports.sources diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf.d/x86.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf.d/x86.conf new file mode 100644 index 00000000000..9a6aa05cfbd --- /dev/null +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf.d/x86.conf @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# The main Ubuntu archive is only for i386/amd64 repositories + +[Match] +Architecture=|x86-64 +Architecture=|x86 +ToolsTreeRelease=noble + +[Build] +ToolsTreeSandboxTrees=%D/mkosi.conf.d/10-ubuntu/noble-backports.sources:/etc/apt/sources.list.d/noble-backports.sources diff --git a/mkosi.conf.d/10-arch/mkosi.conf b/mkosi.conf.d/10-arch/mkosi.conf index f897d7d31c1..79c189bf034 100644 --- a/mkosi.conf.d/10-arch/mkosi.conf +++ b/mkosi.conf.d/10-arch/mkosi.conf @@ -3,6 +3,13 @@ [Match] Distribution=arch +[Build] +Environment= + GIT_URL=https://gitlab.archlinux.org/archlinux/packaging/packages/systemd.git + GIT_BRANCH=main + GIT_COMMIT=1b4994657df1c7495607f0c2f20db73550b94f34 + PKG_SUBDIR=arch + [Content] VolatilePackages= systemd diff --git a/mkosi.conf.d/10-centos-fedora/mkosi.conf b/mkosi.conf.d/10-centos-fedora/mkosi.conf index 7c941046f77..6f996fd578a 100644 --- a/mkosi.conf.d/10-centos-fedora/mkosi.conf +++ b/mkosi.conf.d/10-centos-fedora/mkosi.conf @@ -4,6 +4,13 @@ Distribution=|centos Distribution=|fedora +[Build] +Environment= + GIT_URL=https://src.fedoraproject.org/rpms/systemd.git + GIT_BRANCH=rawhide + GIT_COMMIT=617952132de4ed882b9b00ceeed077f843130f91 + PKG_SUBDIR=fedora + [Content] VolatilePackages= systemd diff --git a/mkosi.conf.d/10-debian-ubuntu/mkosi.conf b/mkosi.conf.d/10-debian-ubuntu/mkosi.conf index 30138c00fbc..3b85be300be 100644 --- a/mkosi.conf.d/10-debian-ubuntu/mkosi.conf +++ b/mkosi.conf.d/10-debian-ubuntu/mkosi.conf @@ -4,6 +4,14 @@ Distribution=|debian Distribution=|ubuntu +[Build] +Environment= + GIT_URL=https://salsa.debian.org/systemd-team/systemd.git + GIT_SUBDIR=debian + GIT_BRANCH=debian/master + GIT_COMMIT=d8c7f8f7f461b1edc3bf5040509e697ea574c990 + PKG_SUBDIR=debian + [Content] VolatilePackages= libnss-myhostname diff --git a/mkosi.conf.d/10-opensuse/mkosi.conf b/mkosi.conf.d/10-opensuse/mkosi.conf index 32ff446fec5..6509ea4f168 100644 --- a/mkosi.conf.d/10-opensuse/mkosi.conf +++ b/mkosi.conf.d/10-opensuse/mkosi.conf @@ -9,6 +9,12 @@ Repositories=non-oss [Build] SandboxTrees=macros.db_backend:/etc/rpm/macros.db_backend +Environment= + GIT_URL=https://github.com/bmwiedemann/openSUSE + GIT_SUBDIR=packages/s/systemd + GIT_BRANCH=master + GIT_COMMIT=9002a773f0ab185908dc8fb6c831c1cd9fdf11f0 + PKG_SUBDIR=opensuse [Content] VolatilePackages= diff --git a/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf b/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf index e239f712947..d7a79d11c10 100644 --- a/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf @@ -3,13 +3,6 @@ [Match] Distribution=arch -[Build] -Environment= - GIT_URL=https://gitlab.archlinux.org/archlinux/packaging/packages/systemd.git - GIT_BRANCH=main - GIT_COMMIT=1b4994657df1c7495607f0c2f20db73550b94f34 - PKG_SUBDIR=arch - [Content] Packages= base diff --git a/mkosi.images/build/mkosi.conf.d/arch/mkosi.prepare b/mkosi.images/build/mkosi.conf.d/arch/mkosi.prepare index d9e3221d313..500928279a9 100755 --- a/mkosi.images/build/mkosi.conf.d/arch/mkosi.prepare +++ b/mkosi.images/build/mkosi.conf.d/arch/mkosi.prepare @@ -2,7 +2,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -e -if [[ "$1" == "build" ]]; then +if [[ "$1" == "build" ]] || ((NO_BUILD)); then exit 0 fi diff --git a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf index 5a846ae085e..4d0ca8917d8 100644 --- a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf @@ -4,13 +4,6 @@ Distribution=|centos Distribution=|fedora -[Build] -Environment= - GIT_URL=https://src.fedoraproject.org/rpms/systemd.git - GIT_BRANCH=rawhide - GIT_COMMIT=617952132de4ed882b9b00ceeed077f843130f91 - PKG_SUBDIR=fedora - [Content] Packages= clang-devel diff --git a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.prepare b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.prepare index 3b7a4707336..4118e2e59fc 100755 --- a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.prepare +++ b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.prepare @@ -2,7 +2,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -e -if [[ "$1" == "build" ]]; then +if [[ "$1" == "build" ]] || ((NO_BUILD)); then exit 0 fi diff --git a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf index e83cb6e73e9..81c79a2c219 100644 --- a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf @@ -4,14 +4,6 @@ Distribution=|debian Distribution=|ubuntu -[Build] -Environment= - GIT_URL=https://salsa.debian.org/systemd-team/systemd.git - GIT_SUBDIR=debian - GIT_BRANCH=debian/master - GIT_COMMIT=d8c7f8f7f461b1edc3bf5040509e697ea574c990 - PKG_SUBDIR=debian - [Content] Packages= apt diff --git a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.prepare b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.prepare index cec81ec1d5f..86852a588ae 100755 --- a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.prepare +++ b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.prepare @@ -2,7 +2,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -e -if [[ "$1" == "build" ]]; then +if [[ "$1" == "build" ]] || ((NO_BUILD)); then exit 0 fi diff --git a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf index cd852ed8836..70a1b31b641 100644 --- a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf @@ -3,14 +3,6 @@ [Match] Distribution=opensuse -[Build] -Environment= - GIT_URL=https://github.com/bmwiedemann/openSUSE - GIT_SUBDIR=packages/s/systemd - GIT_BRANCH=master - GIT_COMMIT=9002a773f0ab185908dc8fb6c831c1cd9fdf11f0 - PKG_SUBDIR=opensuse - [Content] Packages= clang diff --git a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare index ab2a42d8b42..1090f4818f5 100755 --- a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare +++ b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare @@ -2,7 +2,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -e -if [[ "$1" == "build" ]]; then +if [[ "$1" == "build" ]] || ((NO_BUILD)); then exit 0 fi diff --git a/mkosi.images/build/mkosi.sync b/mkosi.sync similarity index 100% rename from mkosi.images/build/mkosi.sync rename to mkosi.sync diff --git a/tools/fetch-distro.py b/tools/fetch-distro.py index b91833a68f0..77c46d45a20 100755 --- a/tools/fetch-distro.py +++ b/tools/fetch-distro.py @@ -126,7 +126,7 @@ 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.images/build/mkosi.conf.d') + conf_dir = Path('mkosi.conf.d') files = conf_dir.glob('*/*.conf') for file in files: s = file.read_text()