]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Use build image prepare scripts for tools tree as well 36861/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 25 Mar 2025 20:02:24 +0000 (21:02 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 28 Mar 2025 11:29:09 +0000 (12:29 +0100)
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.

26 files changed:
.github/workflows/mkosi.yml
.packit.yml
docs/HACKING.md
mkosi.conf
mkosi.conf.d/05-tools/mkosi.conf
mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf
mkosi.conf.d/05-tools/mkosi.conf.d/centos-fedora.conf
mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf
mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf
mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf [new file with mode: 0644]
mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf.d/non-x86.conf [new file with mode: 0644]
mkosi.conf.d/05-tools/mkosi.conf.d/ubuntu/mkosi.conf.d/x86.conf [new file with mode: 0644]
mkosi.conf.d/10-arch/mkosi.conf
mkosi.conf.d/10-centos-fedora/mkosi.conf
mkosi.conf.d/10-debian-ubuntu/mkosi.conf
mkosi.conf.d/10-opensuse/mkosi.conf
mkosi.images/build/mkosi.conf.d/arch/mkosi.conf
mkosi.images/build/mkosi.conf.d/arch/mkosi.prepare
mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf
mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.prepare
mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf
mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.prepare
mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf
mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare
mkosi.sync [moved from mkosi.images/build/mkosi.sync with 100% similarity]
tools/fetch-distro.py

index 2614ee84d9491b9a5f721a49e8f153a57ddd36db..2f130792520c729ee522fe0509aa1b99697b0e80 100644 (file)
@@ -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
index d5d2ef363689135259949ce0275bd8dfe65b17c4..75d5f6557ac5b1595410c40d874e6d88323b0b3c 100644 (file)
@@ -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'
index 5a6e57da53676bf9f01cd9fedd789dd5c385afd2..6baa3ae393a287f3301942d4df8635661f650b9d 100644 (file)
@@ -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
index fc2b12bda2a9a5772e3b42c5f226d555c80e4c47..033b92d59159af4b6e0ac975471ecbd405f05b51 100644 (file)
@@ -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
index 6656cee287f7bda9cd3268eb3dff0ea653d78eb5..adbbf98ebff02dc451bf026b41614ca82ef0ca93 100644 (file)
@@ -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.
index fdb147a1c79450ab25e385b56c8774d72987076b..4de8b2bd5884c0cccc133f940d6d7fe2df37eebb 100644 (file)
@@ -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
index 5dc5662115c3c0d09147a32ca5eb82cee316f491..2645e6df5d253e480e2ba764d2178b6bae8e959e 100644 (file)
@@ -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
index c060e57e82a081e7d9a10408c0b74671e25dcdf6..b6715b5c507d9b7336a459362c9bbd12a41590df 100644 (file)
@@ -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
index aeaa325d069e2a0a4c5560416152cc0587710fb1..b7af1419645f2f15bde67c3a77792a5fe3a6fe77 100644 (file)
@@ -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 (file)
index 0000000..3078782
--- /dev/null
@@ -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 (file)
index 0000000..bbddf8e
--- /dev/null
@@ -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 (file)
index 0000000..9a6aa05
--- /dev/null
@@ -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
index f897d7d31c17554951df72d1f992e3ea0d1ae167..79c189bf034b1cdd14ea91e9a4b35660309918fa 100644 (file)
@@ -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
index 7c941046f77a501da5bdc9e08f9daf82af2d9945..6f996fd578a5faee0e6d5e2e5aad829aede8c5b2 100644 (file)
@@ -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
index 30138c00fbc2b73469743cd731b034fb30440c9f..3b85be300bef98efe939dec9ce4a7bc601664e36 100644 (file)
@@ -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
index 32ff446fec53747ea839e0710ab471e65ea55a80..6509ea4f168419eadb06c83eaca49b8919babab3 100644 (file)
@@ -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=
index e239f7129477a8b4319c8de03c2248d5d89cce8f..d7a79d11c1051244a46508d84e9b15de3eac643f 100644 (file)
@@ -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
index d9e3221d313c0611fd29ebe9627c2578db092d18..500928279a95aaaa5753e2f0b33463d19dfb6122 100755 (executable)
@@ -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
 
index 5a846ae085e74c98a467b1d973d9dfe6628b085d..4d0ca8917d83fd40d0921b3d8f7a6ef71334ca33 100644 (file)
@@ -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
index 3b7a4707336e160b3f22639bf8e27c8e8ab1197b..4118e2e59fcc6398ebe239d1468108ca7b9f82ea 100755 (executable)
@@ -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
 
index e83cb6e73e938b8f5852e9d2ea7f9d1ba0c12b10..81c79a2c219dc623d4b1eeac75dd1cd4a17268c0 100644 (file)
@@ -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
index cec81ec1d5fadc73c50958fccd68726bb107963a..86852a588ae0d02a25b681aac0a6f87186d54077 100755 (executable)
@@ -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
 
index cd852ed8836807105e97b8db94601d768d60e3cf..70a1b31b641964740337434db5bb8483a0a72841 100644 (file)
@@ -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
index ab2a42d8b424004382f23c115f63308dc9b29201..1090f4818f54c1282dbb47641b4405d82d955062 100755 (executable)
@@ -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
 
similarity index 100%
rename from mkosi.images/build/mkosi.sync
rename to mkosi.sync
index b91833a68f0cd96b241ca1158d1e1df93074674a..77c46d45a2096d472925fbd1f39ccce06b651988 100755 (executable)
@@ -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()