From 4cc17467a1254a09b15657aa0288fae168bd3f7e Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 8 Mar 2024 12:57:31 +0100 Subject: [PATCH 1/3] mkosi: Use same pkg/ subdirectory for debian and ubuntu Instead of cloning the same repository twice, let's make sure we use the same directory for both debian/ubuntu. --- .../base/mkosi.conf.d/10-arch/mkosi.build.chroot | 14 +++++++------- mkosi.images/base/mkosi.conf.d/10-arch/mkosi.conf | 1 + .../base/mkosi.conf.d/10-arch/mkosi.prepare | 8 ++++---- .../10-centos-fedora/mkosi.build.chroot | 8 ++++---- .../mkosi.conf.d/10-centos-fedora/mkosi.prepare | 14 +++++++------- .../base/mkosi.conf.d/10-centos/mkosi.conf | 1 + .../10-debian-ubuntu/mkosi.build.chroot | 6 +++--- .../base/mkosi.conf.d/10-debian-ubuntu/mkosi.conf | 1 + .../mkosi.conf.d/10-debian-ubuntu/mkosi.prepare | 6 +++--- .../base/mkosi.conf.d/10-fedora/mkosi.conf | 1 + .../mkosi.conf.d/10-opensuse/mkosi.build.chroot | 12 ++++++------ .../base/mkosi.conf.d/10-opensuse/mkosi.conf | 1 + .../base/mkosi.conf.d/10-opensuse/mkosi.prepare | 12 ++++++------ mkosi.images/base/mkosi.sync | 8 ++++---- 14 files changed, 49 insertions(+), 44 deletions(-) diff --git a/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.build.chroot b/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.build.chroot index 9acfde1635..aff566f94c 100755 --- a/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.build.chroot +++ b/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.build.chroot @@ -2,17 +2,17 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -ex -if [ ! -f "pkg/$DISTRIBUTION/PKGBUILD" ]; then - echo "PKGBUILD not found at pkg/$DISTRIBUTION/PKGBUILD, run mkosi once with -ff to make sure the PKGBUILD is cloned" >&2 +if [ ! -f "pkg/$PKG_SUBDIR/PKGBUILD" ]; then + echo "PKGBUILD not found at pkg/$PKG_SUBDIR/PKGBUILD, run mkosi once with -ff to make sure the PKGBUILD is cloned" >&2 exit 1 fi # We can't configure the source or build directory so we use bind mounts instead to make sure they are in the # expected locations. -mount --mkdir --bind "$SRCDIR" "pkg/$DISTRIBUTION/systemd-stable/" -mount --mkdir --bind "$BUILDDIR" "pkg/$DISTRIBUTION/build/" +mount --mkdir --bind "$SRCDIR" "pkg/$PKG_SUBDIR/systemd-stable/" +mount --mkdir --bind "$BUILDDIR" "pkg/$PKG_SUBDIR/build/" # Because we run with --noextract we are responsible for making sure the source files appear in src/. -mount --mkdir --rbind "$PWD/pkg/$DISTRIBUTION" "pkg/$DISTRIBUTION/src/" +mount --mkdir --rbind "$PWD/pkg/$PKG_SUBDIR" "pkg/$PKG_SUBDIR/src/" # shellcheck source=/dev/null . /etc/makepkg.conf @@ -37,7 +37,7 @@ fi # We get around makepkg's root check by setting EUID to something else. # shellcheck disable=SC2046 -env --chdir="pkg/$DISTRIBUTION" \ +env --chdir="pkg/$PKG_SUBDIR" \ EUID=123 \ makepkg \ --noextract \ @@ -45,7 +45,7 @@ env --chdir="pkg/$DISTRIBUTION" \ --force \ UPSTREAM=1 \ QUIET=1 \ - BUILDDIR="$PWD/pkg/$DISTRIBUTION" \ + BUILDDIR="$PWD/pkg/$PKG_SUBDIR" \ PKGDEST="$PACKAGEDIR" \ PKGEXT=".pkg.tar" \ PKGVER="$(cat meson.version)" \ diff --git a/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.conf b/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.conf index 58a57d0283..75dbbb2dde 100644 --- a/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.conf +++ b/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.conf @@ -12,6 +12,7 @@ InitrdInclude=initrd/ Environment= PKG_URL="https://gitlab.archlinux.org/daandemeyer/systemd" PKG_BRANCH="strip" + PKG_SUBDIR="arch" SYSTEMD_PACKAGES="systemd systemd-ukify systemd-sysvcompat systemd-resolvconf" Packages= diff --git a/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.prepare b/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.prepare index d6e2d4eb3d..24c91e5665 100755 --- a/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.prepare +++ b/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.prepare @@ -2,14 +2,14 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -e -if [ ! -f "pkg/$DISTRIBUTION/PKGBUILD" ]; then - echo "PKGBUILD not found at pkg/$DISTRIBUTION/PKGBUILD, run mkosi once with -ff to make sure the PKGBUILD is cloned" >&2 +if [ ! -f "pkg/$PKG_SUBDIR/PKGBUILD" ]; then + echo "PKGBUILD not found at pkg/$PKG_SUBDIR/PKGBUILD, run mkosi once with -ff to make sure the PKGBUILD is cloned" >&2 exit 1 fi if [ "$1" = "final" ]; then # We get depends and optdepends from .SRCINFO as getting them from the PKGBUILD is rather complex. - sed --expression 's/^[ \t]*//' "pkg/$DISTRIBUTION/.SRCINFO" | + sed --expression 's/^[ \t]*//' "pkg/$PKG_SUBDIR/.SRCINFO" | grep --regexp '^depends =' --regexp '^optdepends =' | sed --expression 's/^depends = //' --expression 's/^optdepends = //' --expression 's/:.*//' | xargs --delimiter '\n' mkosi-install @@ -17,7 +17,7 @@ else # We get makedepends from the PKGBUILD as .SRCINFO can't encode conditional dependencies depending on # whether some environment variable is set or not. # shellcheck source=/dev/null - UPSTREAM=1 . "pkg/$DISTRIBUTION/PKGBUILD" + UPSTREAM=1 . "pkg/$PKG_SUBDIR/PKGBUILD" # shellcheck disable=SC2154 mkosi-install "${makedepends[@]}" diff --git a/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot b/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot index cf3be64538..3ee0900175 100755 --- a/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot +++ b/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot @@ -2,8 +2,8 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -ex -if [ ! -f "pkg/$DISTRIBUTION/systemd.spec" ]; then - echo "spec not found at pkg/$DISTRIBUTION/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2 +if [ ! -f "pkg/$PKG_SUBDIR/systemd.spec" ]; then + echo "spec not found at pkg/$PKG_SUBDIR/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2 exit 1 fi @@ -22,7 +22,7 @@ rpmbuild \ --with upstream \ $( ((WITH_TESTS)) || echo --nocheck) \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$DISTRIBUTION" \ + --define "_sourcedir pkg/$PKG_SUBDIR" \ --define "_rpmdir $PACKAGEDIR" \ ${BUILDDIR:+--define} \ ${BUILDDIR:+"_vpath_builddir $BUILDDIR"} \ @@ -44,4 +44,4 @@ rpmbuild \ --define "__elf_exclude_path ^/usr/lib/systemd/tests/unit-tests/.*$" \ --define "__script_requires %{nil}" \ --undefine _lto_cflags \ - "pkg/$DISTRIBUTION/systemd.spec" + "pkg/$PKG_SUBDIR/systemd.spec" diff --git a/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.prepare b/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.prepare index c07251a7e1..0b48e1e474 100755 --- a/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.prepare +++ b/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.prepare @@ -2,8 +2,8 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -ex -if [ ! -f "pkg/$DISTRIBUTION/systemd.spec" ]; then - echo "spec not found at pkg/$DISTRIBUTION/systemd.spec, run mkosi with -ff to make sure the spec is cloned" >&2 +if [ ! -f "pkg/$PKG_SUBDIR/systemd.spec" ]; then + echo "spec not found at pkg/$PKG_SUBDIR/systemd.spec, run mkosi with -ff to make sure the spec is cloned" >&2 exit 1 fi @@ -19,8 +19,8 @@ mkosi-chroot \ --query \ "$DEPS" \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$DISTRIBUTION" \ - "pkg/$DISTRIBUTION/systemd.spec" | + --define "_sourcedir pkg/$PKG_SUBDIR" \ + "pkg/$PKG_SUBDIR/systemd.spec" | grep --invert-match --regexp systemd --regexp /bin/sh --regexp "rpmlib(" --regexp udev | sort --unique | tee /tmp/buildrequires | @@ -33,7 +33,7 @@ fi # rpmbuild -br tries to build a source package which means all source files have to exist which isn't the # case when using --build-in-place so we get rid of the source file that doesn't exist to make it happy. # TODO: Use -bd instead of -br and get rid of this once we don't need to build on CentOS Stream 9 anymore. -sed '/Source0/d' --in-place "pkg/$DISTRIBUTION/systemd.spec" +sed '/Source0/d' --in-place "pkg/$PKG_SUBDIR/systemd.spec" until mkosi-chroot \ rpmbuild \ @@ -41,9 +41,9 @@ until mkosi-chroot \ --build-in-place \ --with upstream \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$DISTRIBUTION" \ + --define "_sourcedir pkg/$PKG_SUBDIR" \ --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ - "pkg/$DISTRIBUTION/systemd.spec" + "pkg/$PKG_SUBDIR/systemd.spec" do EXIT_STATUS=$? if [ $EXIT_STATUS -ne 11 ]; then diff --git a/mkosi.images/base/mkosi.conf.d/10-centos/mkosi.conf b/mkosi.images/base/mkosi.conf.d/10-centos/mkosi.conf index dd08467aaf..607c2d2daf 100644 --- a/mkosi.images/base/mkosi.conf.d/10-centos/mkosi.conf +++ b/mkosi.images/base/mkosi.conf.d/10-centos/mkosi.conf @@ -7,6 +7,7 @@ Distribution=centos Environment= PKG_URL="https://git.centos.org/rpms/systemd" PKG_BRANCH="c9s-sig-hyperscale" + PKG_SUBDIR="centos" Packages= kernel-modules # For squashfs support diff --git a/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot b/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot index d1ec8c1894..7fb650f501 100755 --- a/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot +++ b/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot @@ -2,13 +2,13 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -e -if [ ! -d "pkg/$DISTRIBUTION/debian" ]; then - echo "deb rules not found at pkg/$DISTRIBUTION/debian, run mkosi once with -ff to make sure the rules are cloned" >&2 +if [ ! -d "pkg/$PKG_SUBDIR/debian" ]; then + echo "deb rules not found at pkg/$PKG_SUBDIR/debian, run mkosi once with -ff to make sure the rules are cloned" >&2 exit 1 fi # We transplant the debian/ folder from the deb package sources into the upstream sources. -mount --mkdir --bind "$SRCDIR/pkg/$DISTRIBUTION/debian" "$SRCDIR"/debian +mount --mkdir --bind "$SRCDIR/pkg/$PKG_SUBDIR/debian" "$SRCDIR"/debian # We hide the patches/ directory by mounting an empty directory on top so they don't get applied. TMP=$(mktemp -d) diff --git a/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.conf b/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.conf index c2a9c399e1..f6fc43a848 100644 --- a/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.conf +++ b/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.conf @@ -11,6 +11,7 @@ InitrdInclude=initrd/ Environment= PKG_URL="https://salsa.debian.org/systemd-team/systemd" PKG_BRANCH="debian/master" + PKG_SUBDIR="debian" SYSTEMD_PACKAGES="systemd systemd-userdbd systemd-oomd diff --git a/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.prepare b/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.prepare index 32c60feb7e..ae0d6fd92f 100755 --- a/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.prepare +++ b/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.prepare @@ -6,10 +6,10 @@ if [ "$1" = "final" ]; then exit 0 fi -if [ ! -d "pkg/$DISTRIBUTION/debian" ]; then - echo "deb rules not found at pkg/$DISTRIBUTION/debian, run mkosi once with -ff to make sure the rules are cloned" >&2 +if [ ! -d "pkg/$PKG_SUBDIR/debian" ]; then + echo "deb rules not found at pkg/$PKG_SUBDIR/debian, run mkosi once with -ff to make sure the rules are cloned" >&2 exit 1 fi -cd "pkg/$DISTRIBUTION" +cd "pkg/$PKG_SUBDIR" DEB_BUILD_PROFILES="pkg.systemd.upstream" apt-get build-dep . diff --git a/mkosi.images/base/mkosi.conf.d/10-fedora/mkosi.conf b/mkosi.images/base/mkosi.conf.d/10-fedora/mkosi.conf index cea31ed697..1424709cef 100644 --- a/mkosi.images/base/mkosi.conf.d/10-fedora/mkosi.conf +++ b/mkosi.images/base/mkosi.conf.d/10-fedora/mkosi.conf @@ -7,6 +7,7 @@ Distribution=fedora Environment= PKG_URL="https://src.fedoraproject.org/rpms/systemd" PKG_BRANCH="rawhide" + PKG_SUBDIR="fedora" Packages= btrfs-progs diff --git a/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.build.chroot b/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.build.chroot index e1abe0b135..e6246e52d5 100755 --- a/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.build.chroot +++ b/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.build.chroot @@ -2,8 +2,8 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -ex -if [ ! -f "pkg/$DISTRIBUTION/systemd.spec" ]; then - echo "spec not found at pkg/$DISTRIBUTION/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2 +if [ ! -f "pkg/$PKG_SUBDIR/systemd.spec" ]; then + echo "spec not found at pkg/$PKG_SUBDIR/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2 exit 1 fi @@ -16,7 +16,7 @@ fi # The openSUSE filelists hardcode the manpage compression extension. This causes rpmbuild errors since we # disable manpage compression as the files cannot be found. Fix the issue by removing the compression # extension. -find "pkg/$DISTRIBUTION" -name "files.*" -exec sed --in-place 's/\.gz$//' {} \; +find "pkg/$PKG_SUBDIR" -name "files.*" -exec sed --in-place 's/\.gz$//' {} \; build() { # TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once @@ -28,7 +28,7 @@ build() { --with upstream \ $( ((WITH_TESTS)) || echo --nocheck) \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$DISTRIBUTION" \ + --define "_sourcedir pkg/$PKG_SUBDIR" \ --define "_rpmdir $PACKAGEDIR" \ ${BUILDDIR:+--define} \ ${BUILDDIR:+"_vpath_builddir $BUILDDIR"} \ @@ -46,7 +46,7 @@ build() { --define "__elf_exclude_path ^/usr/lib/systemd/tests/unit-tests/.*$" \ --define "__script_requires %{nil}" \ "$@" \ - "pkg/$DISTRIBUTION/systemd.spec" + "pkg/$PKG_SUBDIR/systemd.spec" } if ! build; then @@ -58,6 +58,6 @@ if ! build; then # warnings. rm systemd.lang - cat /tmp/unpackaged-files >>"pkg/$DISTRIBUTION/files.systemd" + cat /tmp/unpackaged-files >>"pkg/$PKG_SUBDIR/files.systemd" build --noprep --nocheck fi diff --git a/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.conf b/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.conf index 4ef13b6ca5..1fca47b7cb 100644 --- a/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.conf +++ b/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.conf @@ -10,6 +10,7 @@ InitrdInclude=initrd/ Environment= PKG_URL="https://code.opensuse.org/package/systemd" PKG_BRANCH="master" + PKG_SUBDIR="opensuse" SYSTEMD_PACKAGES="systemd udev systemd-experimental diff --git a/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.prepare b/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.prepare index dd01a3f20e..a35a8f3bba 100755 --- a/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.prepare +++ b/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.prepare @@ -2,8 +2,8 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -e -if [ ! -f "pkg/$DISTRIBUTION/systemd.spec" ]; then - echo "spec not found at pkg/$DISTRIBUTION/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2 +if [ ! -f "pkg/$PKG_SUBDIR/systemd.spec" ]; then + echo "spec not found at pkg/$PKG_SUBDIR/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2 exit 1 fi @@ -19,8 +19,8 @@ mkosi-chroot \ --query \ "$DEPS" \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$DISTRIBUTION" \ - "pkg/$DISTRIBUTION/systemd.spec" | + --define "_sourcedir pkg/$PKG_SUBDIR" \ + "pkg/$PKG_SUBDIR/systemd.spec" | grep --invert-match --regexp systemd --regexp /bin/sh --regexp "rpmlib(" --regexp udev | sort --unique | tee /tmp/buildrequires | @@ -36,9 +36,9 @@ until mkosi-chroot \ --build-in-place \ --with upstream \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$DISTRIBUTION" \ + --define "_sourcedir pkg/$PKG_SUBDIR" \ --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ - "pkg/$DISTRIBUTION/systemd.spec" + "pkg/$PKG_SUBDIR/systemd.spec" do EXIT_STATUS=$? if [ $EXIT_STATUS -ne 11 ]; then diff --git a/mkosi.images/base/mkosi.sync b/mkosi.images/base/mkosi.sync index 5ab43befc1..b95a73bc08 100755 --- a/mkosi.images/base/mkosi.sync +++ b/mkosi.images/base/mkosi.sync @@ -6,8 +6,8 @@ if ((CACHED)); then exit 0 fi -if [ -z "$(ls --almost-all "pkg/$DISTRIBUTION")" ]; then - git clone "$PKG_URL" --branch "$PKG_BRANCH" "pkg/$DISTRIBUTION" -elif [ -d "pkg/$DISTRIBUTION/.git" ] && [ "$(git -C "pkg/$DISTRIBUTION" rev-parse --abbrev-ref HEAD)" = "$PKG_BRANCH" ]; then - git -C "pkg/$DISTRIBUTION" pull +if [ -z "$(ls --almost-all "pkg/$PKG_SUBDIR")" ]; then + git clone "$PKG_URL" --branch "$PKG_BRANCH" "pkg/$PKG_SUBDIR" +elif [ -d "pkg/$PKG_SUBDIR/.git" ] && [ "$(git -C "pkg/$PKG_SUBDIR" rev-parse --abbrev-ref HEAD)" = "$PKG_BRANCH" ]; then + git -C "pkg/$PKG_SUBDIR" pull fi From d008a9cfad2ccd582129179ccb76c74a5e4a7adb Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 9 Mar 2024 14:38:00 +0100 Subject: [PATCH 2/3] mkosi: Remove some leftover shell debugging --- .../base/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot | 2 +- mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.prepare | 2 +- mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.build.chroot | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot b/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot index 3ee0900175..73c1910f8b 100755 --- a/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot +++ b/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot @@ -1,6 +1,6 @@ #!/bin/bash # SPDX-License-Identifier: LGPL-2.1-or-later -set -ex +set -e if [ ! -f "pkg/$PKG_SUBDIR/systemd.spec" ]; then echo "spec not found at pkg/$PKG_SUBDIR/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2 diff --git a/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.prepare b/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.prepare index 0b48e1e474..5bcb1ad481 100755 --- a/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.prepare +++ b/mkosi.images/base/mkosi.conf.d/10-centos-fedora/mkosi.prepare @@ -1,6 +1,6 @@ #!/bin/bash # SPDX-License-Identifier: LGPL-2.1-or-later -set -ex +set -e if [ ! -f "pkg/$PKG_SUBDIR/systemd.spec" ]; then echo "spec not found at pkg/$PKG_SUBDIR/systemd.spec, run mkosi with -ff to make sure the spec is cloned" >&2 diff --git a/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.build.chroot b/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.build.chroot index e6246e52d5..b809a10bb0 100755 --- a/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.build.chroot +++ b/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.build.chroot @@ -1,6 +1,6 @@ #!/bin/bash # SPDX-License-Identifier: LGPL-2.1-or-later -set -ex +set -e if [ ! -f "pkg/$PKG_SUBDIR/systemd.spec" ]; then echo "spec not found at pkg/$PKG_SUBDIR/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2 From 37bd860c22b60d6d389ebf1a27c93a32d4af9bc1 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 8 Mar 2024 11:33:25 +0100 Subject: [PATCH 3/3] mkosi: Introduce packaging sources as submodules By always cloning the latest branch commit, we can't bisect properly using mkosi as when bisecting wildly different packaging sources will be used compared to when the commit was merged. By using submodules, we track individual commits which means when bisecting the same packaging sources will be used. We use git submodules as dependabot has support for automatically making PRs to update git submodules. This commit also includes the necessary dependabot configuration to enable this. We make ubuntu/debian use the same submodule instead of adding the debian packaging sources twice by introducing a new $PKG_SUBDIR environment variable and using it instead of $DISTRIBUTION. --- .github/dependabot.yml | 5 +++++ .gitmodules | 20 +++++++++++++++++++ .../base/mkosi.conf.d/10-arch/mkosi.conf | 2 -- .../base/mkosi.conf.d/10-centos/mkosi.conf | 2 -- .../mkosi.conf.d/10-debian-ubuntu/mkosi.conf | 2 -- .../base/mkosi.conf.d/10-fedora/mkosi.conf | 2 -- .../base/mkosi.conf.d/10-opensuse/mkosi.conf | 2 -- mkosi.images/base/mkosi.sync | 11 +++------- pkg/arch | 1 + pkg/centos | 1 + pkg/debian | 1 + pkg/fedora | 1 + pkg/opensuse | 1 + 13 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 .gitmodules create mode 160000 pkg/arch create mode 160000 pkg/centos create mode 160000 pkg/debian create mode 160000 pkg/fedora create mode 160000 pkg/opensuse diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3e067c176f..54593c50f7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,3 +17,8 @@ updates: schedule: interval: "monthly" open-pull-requests-limit: 2 + - package-ecosystem: "gitsubmodule" + directory: "/" + schedule: + interval: "daily" + open-pull-requests-limit: 2 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..c69576e9bb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,20 @@ +[submodule "pkg/fedora"] + path = pkg/fedora + url = https://src.fedoraproject.org/rpms/systemd + branch = rawhide +[submodule "pkg/opensuse"] + path = pkg/opensuse + url = https://code.opensuse.org/package/systemd + branch = master +[submodule "pkg/debian"] + path = pkg/debian + url = https://salsa.debian.org/systemd-team/systemd + branch = debian/master +[submodule "pkg/centos"] + path = pkg/centos + url = https://git.centos.org/rpms/systemd + branch = c9s-sig-hyperscale +[submodule "pkg/arch"] + path = pkg/arch + url = https://gitlab.archlinux.org/daandemeyer/systemd + branch = strip diff --git a/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.conf b/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.conf index 75dbbb2dde..9cb45cc954 100644 --- a/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.conf +++ b/mkosi.images/base/mkosi.conf.d/10-arch/mkosi.conf @@ -10,8 +10,6 @@ InitrdInclude=initrd/ # https://gitlab.archlinux.org/archlinux/packaging/packages/systemd/-/merge_requests/8 is merged. [Content] Environment= - PKG_URL="https://gitlab.archlinux.org/daandemeyer/systemd" - PKG_BRANCH="strip" PKG_SUBDIR="arch" SYSTEMD_PACKAGES="systemd systemd-ukify systemd-sysvcompat systemd-resolvconf" diff --git a/mkosi.images/base/mkosi.conf.d/10-centos/mkosi.conf b/mkosi.images/base/mkosi.conf.d/10-centos/mkosi.conf index 607c2d2daf..0f57319c2a 100644 --- a/mkosi.images/base/mkosi.conf.d/10-centos/mkosi.conf +++ b/mkosi.images/base/mkosi.conf.d/10-centos/mkosi.conf @@ -5,8 +5,6 @@ Distribution=centos [Content] Environment= - PKG_URL="https://git.centos.org/rpms/systemd" - PKG_BRANCH="c9s-sig-hyperscale" PKG_SUBDIR="centos" Packages= diff --git a/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.conf b/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.conf index f6fc43a848..47f3b7f488 100644 --- a/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.conf +++ b/mkosi.images/base/mkosi.conf.d/10-debian-ubuntu/mkosi.conf @@ -9,8 +9,6 @@ InitrdInclude=initrd/ [Content] Environment= - PKG_URL="https://salsa.debian.org/systemd-team/systemd" - PKG_BRANCH="debian/master" PKG_SUBDIR="debian" SYSTEMD_PACKAGES="systemd systemd-userdbd diff --git a/mkosi.images/base/mkosi.conf.d/10-fedora/mkosi.conf b/mkosi.images/base/mkosi.conf.d/10-fedora/mkosi.conf index 1424709cef..a0b9f6f0fe 100644 --- a/mkosi.images/base/mkosi.conf.d/10-fedora/mkosi.conf +++ b/mkosi.images/base/mkosi.conf.d/10-fedora/mkosi.conf @@ -5,8 +5,6 @@ Distribution=fedora [Content] Environment= - PKG_URL="https://src.fedoraproject.org/rpms/systemd" - PKG_BRANCH="rawhide" PKG_SUBDIR="fedora" Packages= diff --git a/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.conf b/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.conf index 1fca47b7cb..63498c5098 100644 --- a/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.conf +++ b/mkosi.images/base/mkosi.conf.d/10-opensuse/mkosi.conf @@ -8,8 +8,6 @@ InitrdInclude=initrd/ [Content] Environment= - PKG_URL="https://code.opensuse.org/package/systemd" - PKG_BRANCH="master" PKG_SUBDIR="opensuse" SYSTEMD_PACKAGES="systemd udev diff --git a/mkosi.images/base/mkosi.sync b/mkosi.images/base/mkosi.sync index b95a73bc08..72b5cf7c33 100755 --- a/mkosi.images/base/mkosi.sync +++ b/mkosi.images/base/mkosi.sync @@ -2,12 +2,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -e -if ((CACHED)); then - exit 0 -fi - -if [ -z "$(ls --almost-all "pkg/$PKG_SUBDIR")" ]; then - git clone "$PKG_URL" --branch "$PKG_BRANCH" "pkg/$PKG_SUBDIR" -elif [ -d "pkg/$PKG_SUBDIR/.git" ] && [ "$(git -C "pkg/$PKG_SUBDIR" rev-parse --abbrev-ref HEAD)" = "$PKG_BRANCH" ]; then - git -C "pkg/$PKG_SUBDIR" pull +if [ -z "$(ls --almost-all "pkg/$PKG_SUBDIR")" ] || [ -f "pkg/$PKG_SUBDIR/.git" ]; then + git submodule sync "pkg/$PKG_SUBDIR" + git submodule update --init "pkg/$PKG_SUBDIR" fi diff --git a/pkg/arch b/pkg/arch new file mode 160000 index 0000000000..733045c8f6 --- /dev/null +++ b/pkg/arch @@ -0,0 +1 @@ +Subproject commit 733045c8f6b0acf2f0cfaac207500483a678f4d2 diff --git a/pkg/centos b/pkg/centos new file mode 160000 index 0000000000..3cf45106c8 --- /dev/null +++ b/pkg/centos @@ -0,0 +1 @@ +Subproject commit 3cf45106c8bc5a050901851be6b2ac85b6f5c571 diff --git a/pkg/debian b/pkg/debian new file mode 160000 index 0000000000..49132a870d --- /dev/null +++ b/pkg/debian @@ -0,0 +1 @@ +Subproject commit 49132a870dfe281e1973a8c44acffb87a1db5336 diff --git a/pkg/fedora b/pkg/fedora new file mode 160000 index 0000000000..2822a03dde --- /dev/null +++ b/pkg/fedora @@ -0,0 +1 @@ +Subproject commit 2822a03dded26b9453bddbba7c6a152de8204aec diff --git a/pkg/opensuse b/pkg/opensuse new file mode 160000 index 0000000000..37aca188c2 --- /dev/null +++ b/pkg/opensuse @@ -0,0 +1 @@ +Subproject commit 37aca188c2ef606319217b30ff8b0c66df6c60f1