From 762b23e86a8bd45879335af96006573a99884a71 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 22 Jul 2024 10:22:48 +0200 Subject: [PATCH 1/4] mkosi: Switch back to PKG_SUBDIR instead of symlinks Previously I thought it would make sense to allow running the build scripts from within the VM/container to rebuild the packages. Instead we ended up making it possible to rerun mkosi outside of the container/VM to rebuild the packages, so let's switch back to $PKG_SUBDIR to tell the build scripts where to look for the packaging sources. --- .../mkosi.conf.d/arch/mkosi.build.chroot | 23 +++++++--------- .../build/mkosi.conf.d/arch/mkosi.conf | 1 + .../build/mkosi.conf.d/arch/mkosi.prepare | 9 +++---- .../centos-fedora/mkosi.build.chroot | 11 +++----- .../mkosi.conf.d/centos-fedora/mkosi.prepare | 17 +++++------- .../build/mkosi.conf.d/centos/mkosi.conf | 1 + .../debian-ubuntu/mkosi.build.chroot | 9 +++---- .../mkosi.conf.d/debian-ubuntu/mkosi.conf | 1 + .../mkosi.conf.d/debian-ubuntu/mkosi.prepare | 9 +++---- .../build/mkosi.conf.d/fedora/mkosi.conf | 1 + .../mkosi.conf.d/opensuse/mkosi.build.chroot | 18 +++++-------- .../build/mkosi.conf.d/opensuse/mkosi.conf | 1 + .../build/mkosi.conf.d/opensuse/mkosi.prepare | 18 +++++-------- mkosi.images/build/mkosi.sync | 26 +++++++++---------- pkg/ubuntu | 1 - 15 files changed, 61 insertions(+), 85 deletions(-) delete mode 120000 pkg/ubuntu diff --git a/mkosi.images/build/mkosi.conf.d/arch/mkosi.build.chroot b/mkosi.images/build/mkosi.conf.d/arch/mkosi.build.chroot index dcdb7584da..3ffde85f35 100755 --- a/mkosi.images/build/mkosi.conf.d/arch/mkosi.build.chroot +++ b/mkosi.images/build/mkosi.conf.d/arch/mkosi.build.chroot @@ -2,11 +2,8 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -e -# shellcheck source=/dev/null -. /usr/lib/os-release - -if [[ ! -f "pkg/$ID/PKGBUILD" ]]; then - echo "PKGBUILD not found at pkg/$ID/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 @@ -14,11 +11,11 @@ fi # expected locations. Because we run with --noextract we are responsible for making sure the source files # appear in src/. This means not only the systemd source directory, but also the patches and configuration # files that are shipped in the packaging repository. To achieve this, instead of symlinking the systemd -# sources and build directory directly into "pkg/$ID/src", we symlink them into "pkg/$ID" and then symlink -# "pkg/$ID" to "pkg/$ID/src". -ln --symbolic "$SRCDIR" "pkg/$ID/systemd" -ln --symbolic "$BUILDDIR" "pkg/$ID/build" -ln --symbolic . "pkg/$ID/src" +# sources and build directory directly into "pkg/$PKG_SUBDIR/src", we symlink them into "pkg/$PKG_SUBDIR" and +# then symlink "pkg/$PKG_SUBDIR" to "pkg/$PKG_SUBDIR/src". +ln --symbolic "$SRCDIR" "pkg/$PKG_SUBDIR/systemd" +ln --symbolic "$BUILDDIR" "pkg/$PKG_SUBDIR/build" +ln --symbolic . "pkg/$PKG_SUBDIR/src" MKOSI_CFLAGS="-O0 -Wp,-U_FORTIFY_SOURCE" if ((LLVM)); then @@ -70,13 +67,13 @@ else TS="${SOURCE_DATE_EPOCH:-$(date +%s)}" fi -sed --in-place "pkg/$ID/PKGBUILD" \ +sed --in-place "pkg/$PKG_SUBDIR/PKGBUILD" \ --expression "s/^_tag=.*/_tag=$(cat meson.version)/" \ --expression "s/^pkgrel=.*/pkgrel=$(date "+%Y%m%d%H%M%S" --date "@$TS")/" # We get around makepkg's root check by setting EUID to something else. # shellcheck disable=SC2046 -env --chdir="pkg/$ID" \ +env --chdir="pkg/$PKG_SUBDIR" \ EUID=123 \ makepkg \ --noextract \ @@ -84,7 +81,7 @@ env --chdir="pkg/$ID" \ --force \ _systemd_UPSTREAM=1 \ _systemd_QUIET=$( ((MESON_VERBOSE)); echo $? ) \ - BUILDDIR="$PWD/pkg/$ID" \ + BUILDDIR="$PWD/pkg/$PKG_SUBDIR" \ PKGDEST="$OUTPUTDIR" \ PKGEXT=".pkg.tar" \ MESON_EXTRA_CONFIGURE_OPTIONS="$MKOSI_MESON_OPTIONS $MESON_OPTIONS" diff --git a/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf b/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf index 610c76585e..5502f53d6d 100644 --- a/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf @@ -8,6 +8,7 @@ Environment= GIT_URL=https://gitlab.archlinux.org/archlinux/packaging/packages/systemd.git GIT_BRANCH=main GIT_COMMIT=d74b24c7c6077740c35a876445febe6d26bf013c + PKG_SUBDIR=arch 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 e880449b72..d9e3221d31 100755 --- a/mkosi.images/build/mkosi.conf.d/arch/mkosi.prepare +++ b/mkosi.images/build/mkosi.conf.d/arch/mkosi.prepare @@ -6,16 +6,13 @@ if [[ "$1" == "build" ]]; then exit 0 fi -# shellcheck source=/dev/null -. "$BUILDROOT/usr/lib/os-release" - -if [[ ! -f "pkg/$ID/PKGBUILD" ]]; then - echo "PKGBUILD not found at pkg/$ID/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 # shellcheck source=/dev/null -_systemd_UPSTREAM=1 . "pkg/$ID/PKGBUILD" +_systemd_UPSTREAM=1 . "pkg/$PKG_SUBDIR/PKGBUILD" # shellcheck disable=SC2154 mkosi-install "${makedepends[@]}" diff --git a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.build.chroot b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.build.chroot index ce1e162ebf..466699c4fd 100755 --- a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.build.chroot +++ b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.build.chroot @@ -4,11 +4,8 @@ set -e . mkosi.functions -# shellcheck source=/dev/null -. /usr/lib/os-release - -if [[ ! -f "pkg/$ID/systemd.spec" ]]; then - echo "spec not found at pkg/$ID/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 @@ -78,7 +75,7 @@ CXX_LD="$( ((LLVM)) && echo lld)" \ $( ((WITH_TESTS)) || echo "--nocheck") \ $( ((WITH_DOCS)) || echo "--without=docs") \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$ID" \ + --define "_sourcedir pkg/$PKG_SUBDIR" \ --define "_rpmdir $OUTPUTDIR" \ ${BUILDDIR:+"--define=_vpath_builddir $BUILDDIR"} \ --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ @@ -106,7 +103,7 @@ CXX_LD="$( ((LLVM)) && echo lld)" \ --define "_fixperms true" \ --undefine _package_note_flags \ --noclean \ - "pkg/$ID/systemd.spec" + "pkg/$PKG_SUBDIR/systemd.spec" ( shopt -s nullglob 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 fe3c14eede..6028dc355b 100755 --- a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.prepare +++ b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.prepare @@ -6,11 +6,8 @@ if [[ "$1" == "build" ]]; then exit 0 fi -# shellcheck source=/dev/null -. "$BUILDROOT/usr/lib/os-release" - -if [[ ! -f "pkg/$ID/systemd.spec" ]]; then - echo "spec not found at pkg/$ID/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 @@ -20,8 +17,8 @@ mkosi-chroot \ --query \ --buildrequires \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$ID" \ - "pkg/$ID/systemd.spec" | + --define "_sourcedir pkg/$PKG_SUBDIR" \ + "pkg/$PKG_SUBDIR/systemd.spec" | grep --invert-match --regexp systemd --regexp /bin/sh --regexp "rpmlib(" --regexp udev --regexp grubby --regexp sdubby | sort --unique | tee /tmp/buildrequires | @@ -30,7 +27,7 @@ mkosi-chroot \ # 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/$ID/systemd.spec" +sed '/Source0/d' --in-place "pkg/$PKG_SUBDIR/systemd.spec" until mkosi-chroot \ rpmbuild \ @@ -38,9 +35,9 @@ until mkosi-chroot \ --build-in-place \ --with upstream \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$ID" \ + --define "_sourcedir pkg/$PKG_SUBDIR" \ --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ - "pkg/$ID/systemd.spec" + "pkg/$PKG_SUBDIR/systemd.spec" do EXIT_STATUS=$? if [[ $EXIT_STATUS -ne 11 ]]; then diff --git a/mkosi.images/build/mkosi.conf.d/centos/mkosi.conf b/mkosi.images/build/mkosi.conf.d/centos/mkosi.conf index cbb7ed2d29..140aae804b 100644 --- a/mkosi.images/build/mkosi.conf.d/centos/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/centos/mkosi.conf @@ -12,3 +12,4 @@ Environment= GIT_URL=https://git.centos.org/rpms/systemd.git GIT_BRANCH=c10s-sig-hyperscale GIT_COMMIT=46480aaa9e0ea63a85b6ca676554ce2aae10ce36 + PKG_SUBDIR=centos diff --git a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.build.chroot b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.build.chroot index fc9c796ad2..2d50afbbb4 100755 --- a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.build.chroot +++ b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.build.chroot @@ -2,16 +2,13 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -e -# shellcheck source=/dev/null -. /usr/lib/os-release - -if [[ ! -d "pkg/$ID/debian" ]]; then - echo "deb rules not found at pkg/$ID/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/$ID/debian" "$SRCDIR"/debian +mount --mkdir --bind "$SRCDIR/pkg/$PKG_SUBDIR/debian" "$SRCDIR"/debian # We remove the patches so they don't get applied. rm -rf "$SRCDIR"/debian/patches/* 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 68bb32adf2..830137b13f 100644 --- a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf @@ -10,6 +10,7 @@ Environment= GIT_SUBDIR=debian GIT_BRANCH=debian/master GIT_COMMIT=2d10c12bd55efac8d7b1414601087f98674e2195 + PKG_SUBDIR=debian 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 d9021fd65b..cec81ec1d5 100755 --- a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.prepare +++ b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.prepare @@ -6,13 +6,10 @@ if [[ "$1" == "build" ]]; then exit 0 fi -# shellcheck source=/dev/null -. "$BUILDROOT/usr/lib/os-release" - -if [[ ! -d "pkg/$ID/debian" ]]; then - echo "deb rules not found at pkg/$ID/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/$ID" +cd "pkg/$PKG_SUBDIR" DEB_BUILD_PROFILES="pkg.systemd.upstream" apt-get build-dep . diff --git a/mkosi.images/build/mkosi.conf.d/fedora/mkosi.conf b/mkosi.images/build/mkosi.conf.d/fedora/mkosi.conf index 74a951ed2a..0e1a1cd7ef 100644 --- a/mkosi.images/build/mkosi.conf.d/fedora/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/fedora/mkosi.conf @@ -8,6 +8,7 @@ Environment= GIT_URL=https://src.fedoraproject.org/rpms/systemd.git GIT_BRANCH=rawhide GIT_COMMIT=a3524fc837f5e7b68f86b3e0a9d470a94a04c4c8 + PKG_SUBDIR=fedora Packages= erofs-utils diff --git a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.build.chroot b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.build.chroot index 95d747cd93..a1fb83cdd9 100755 --- a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.build.chroot +++ b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.build.chroot @@ -4,12 +4,8 @@ set -e . mkosi.functions -# shellcheck source=/dev/null -. /usr/lib/os-release -ID="${ID%-*}" - -if [[ ! -f "pkg/$ID/systemd.spec" ]]; then - echo "spec not found at pkg/$ID/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 +18,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/$ID" -name "files.*" -exec sed --in-place 's/\.gz$//' {} \; +find "pkg/$PKG_SUBDIR" -name "files.*" -exec sed --in-place 's/\.gz$//' {} \; if [[ "$(rpm --eval "%{lua:print(rpm.vercmp('$(rpm --version | cut -d ' ' -f3)', '4.20'))}")" == "-1" ]]; then # Fix the %install override so debuginfo packages are generated. @@ -62,7 +58,7 @@ if ((WIPE)) && [[ -d "$BUILDDIR/meson-private" ]]; then fi # TODO: Drop when the spec is fixed (either the patch is adapted or not applied when building for upstream). -sed --in-place '/0009-pid1-handle-console-specificities-weirdness-for-s390.patch/d' "pkg/$ID/systemd.spec" +sed --in-place '/0009-pid1-handle-console-specificities-weirdness-for-s390.patch/d' "pkg/$PKG_SUBDIR/systemd.spec" build() { IFS= @@ -81,7 +77,7 @@ build() { --with upstream \ $( ((WITH_TESTS)) || echo "--nocheck") \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$ID" \ + --define "_sourcedir pkg/$PKG_SUBDIR" \ --define "_rpmdir $OUTPUTDIR" \ ${BUILDDIR:+"--define=_vpath_builddir $BUILDDIR"} \ --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ @@ -104,7 +100,7 @@ build() { --define "_fixperms true" \ --noclean \ "$@" \ - "pkg/$ID/systemd.spec" + "pkg/$PKG_SUBDIR/systemd.spec" EXIT_STATUS=$? @@ -123,7 +119,7 @@ if ! build; then # warnings. rm systemd.lang - grep -v ".debug" /tmp/unpackaged-files >>"pkg/$ID/files.systemd" + grep -v ".debug" /tmp/unpackaged-files >>"pkg/$PKG_SUBDIR/files.systemd" build --noprep --nocheck fi diff --git a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf index 770a78bc2a..1d55a919f0 100644 --- a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf @@ -8,6 +8,7 @@ Environment= GIT_URL=https://code.opensuse.org/package/systemd GIT_BRANCH=master GIT_COMMIT=6812406e52a474568744c267e7bade1496bb26a5 + PKG_SUBDIR=opensuse Packages= gcc-c++ diff --git a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare index 3c398593b5..24f07fd459 100755 --- a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare +++ b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare @@ -6,17 +6,13 @@ if [[ "$1" == "build" ]]; then exit 0 fi -# shellcheck source=/dev/null -. "$BUILDROOT/usr/lib/os-release" -ID="${ID%-*}" - -if [[ ! -f "pkg/$ID/systemd.spec" ]]; then - echo "spec not found at pkg/$ID/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 # TODO: Drop when the spec is fixed (either the patch is adapted or not applied when building for upstream). -sed --in-place '/0009-pid1-handle-console-specificities-weirdness-for-s390.patch/d' "pkg/$ID/systemd.spec" +sed --in-place '/0009-pid1-handle-console-specificities-weirdness-for-s390.patch/d' "pkg/$PKG_SUBDIR/systemd.spec" mkosi-chroot \ rpmspec \ @@ -24,8 +20,8 @@ mkosi-chroot \ --query \ --buildrequires \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$ID" \ - "pkg/$ID/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 | @@ -37,9 +33,9 @@ until mkosi-chroot \ --build-in-place \ --with upstream \ --define "_topdir /var/tmp" \ - --define "_sourcedir pkg/$ID" \ + --define "_sourcedir pkg/$PKG_SUBDIR" \ --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ - "pkg/$ID/systemd.spec" + "pkg/$PKG_SUBDIR/systemd.spec" do EXIT_STATUS=$? if [[ $EXIT_STATUS -ne 11 ]]; then diff --git a/mkosi.images/build/mkosi.sync b/mkosi.images/build/mkosi.sync index a545d49867..febe893c41 100755 --- a/mkosi.images/build/mkosi.sync +++ b/mkosi.images/build/mkosi.sync @@ -7,20 +7,18 @@ if ((${NO_SYNC:-0})) || ((${NO_BUILD:-0})); then exit 0 fi -PKG_SUBDIR="$(realpath --canonicalize-missing "pkg/$DISTRIBUTION" --relative-to "$PWD")" - -if [[ -d "$PKG_SUBDIR/.git" ]]; then - if [[ "$(git -C "$PKG_SUBDIR" rev-parse HEAD)" == "$GIT_COMMIT" ]]; then +if [[ -d "pkg/$PKG_SUBDIR/.git" ]]; then + if [[ "$(git -C "pkg/$PKG_SUBDIR" rev-parse HEAD)" == "$GIT_COMMIT" ]]; then exit 0 fi - if ! git -C "$PKG_SUBDIR" show-ref --quiet "origin/$GIT_BRANCH"; then - git -C "$PKG_SUBDIR" remote set-url origin "$GIT_URL" - git -C "$PKG_SUBDIR" fetch origin "$GIT_BRANCH" + if ! git -C "pkg/$PKG_SUBDIR" show-ref --quiet "origin/$GIT_BRANCH"; then + git -C "pkg/$PKG_SUBDIR" remote set-url origin "$GIT_URL" + git -C "pkg/$PKG_SUBDIR" fetch origin "$GIT_BRANCH" fi # If work is being done on the packaging rules in a separate branch, don't touch the checkout. - if ! git -C "$PKG_SUBDIR" merge-base --is-ancestor HEAD "origin/$GIT_BRANCH"; then + if ! git -C "pkg/$PKG_SUBDIR" merge-base --is-ancestor HEAD "origin/$GIT_BRANCH"; then EXIT_STATUS=$? if [[ $EXIT_STATUS -eq 1 ]]; then exit 0 @@ -30,7 +28,7 @@ if [[ -d "$PKG_SUBDIR/.git" ]]; then fi fi -if [[ ! -e "$PKG_SUBDIR" ]] || [[ -z "$(ls --almost-all "$PKG_SUBDIR")" ]]; then +if [[ ! -e "pkg/$PKG_SUBDIR" ]] || [[ -z "$(ls --almost-all "pkg/$PKG_SUBDIR")" ]]; then # The repository on Salsa has the full upstream sources, so it's a waste of # space to redownload and duplicate everything, so do a sparse checkout as # we only need the packaging directory anyway. @@ -40,14 +38,14 @@ if [[ ! -e "$PKG_SUBDIR" ]] || [[ -z "$(ls --almost-all "$PKG_SUBDIR")" ]]; then sparse=() fi - git clone "$GIT_URL" --branch "$GIT_BRANCH" "${sparse[@]}" "$PKG_SUBDIR" + git clone "$GIT_URL" --branch "$GIT_BRANCH" "${sparse[@]}" "pkg/$PKG_SUBDIR" if [[ -n "${GIT_SUBDIR:-}" ]]; then # --no-cone is needed to check out only one top-level directory - git -C "$PKG_SUBDIR" sparse-checkout set --no-cone "${GIT_SUBDIR:-}" + git -C "pkg/$PKG_SUBDIR" sparse-checkout set --no-cone "${GIT_SUBDIR:-}" fi else - git -C "$PKG_SUBDIR" remote set-url origin "$GIT_URL" - git -C "$PKG_SUBDIR" fetch origin "$GIT_BRANCH" + git -C "pkg/$PKG_SUBDIR" remote set-url origin "$GIT_URL" + git -C "pkg/$PKG_SUBDIR" fetch origin "$GIT_BRANCH" fi -git -C "$PKG_SUBDIR" -c advice.detachedHead=false checkout "$GIT_COMMIT" +git -C "pkg/$PKG_SUBDIR" -c advice.detachedHead=false checkout "$GIT_COMMIT" diff --git a/pkg/ubuntu b/pkg/ubuntu deleted file mode 120000 index b2f7fd3e91..0000000000 --- a/pkg/ubuntu +++ /dev/null @@ -1 +0,0 @@ -debian \ No newline at end of file From ebbae3d6328725767e23afef8692596e03f9d3d1 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 22 Jul 2024 10:25:46 +0200 Subject: [PATCH 2/4] mkosi: Use the Fedora Rawhide spec for CentOS These are now practically identical, with the only differences between the two having no effect on the rpm builds we do with mkosi, so let's cut out the middle man and just use the Fedora Rawhide spec for CentOS as well. --- mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf | 6 ++++++ mkosi.images/build/mkosi.conf.d/centos/mkosi.conf | 6 ------ mkosi.images/build/mkosi.conf.d/fedora/mkosi.conf | 6 ------ 3 files changed, 6 insertions(+), 12 deletions(-) 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 158b78bd35..682c2f43c7 100644 --- a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf @@ -5,6 +5,12 @@ Distribution=|centos Distribution=|fedora [Content] +Environment= + GIT_URL=https://src.fedoraproject.org/rpms/systemd.git + GIT_BRANCH=rawhide + GIT_COMMIT=a3524fc837f5e7b68f86b3e0a9d470a94a04c4c8 + PKG_SUBDIR=fedora + Packages= compiler-rt git-core diff --git a/mkosi.images/build/mkosi.conf.d/centos/mkosi.conf b/mkosi.images/build/mkosi.conf.d/centos/mkosi.conf index 140aae804b..f3d19e3174 100644 --- a/mkosi.images/build/mkosi.conf.d/centos/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/centos/mkosi.conf @@ -7,9 +7,3 @@ Distribution=centos Packages= rsync # TODO: Drop when CentOS Stream 9 CI is removed. squashfs-tools - -Environment= - GIT_URL=https://git.centos.org/rpms/systemd.git - GIT_BRANCH=c10s-sig-hyperscale - GIT_COMMIT=46480aaa9e0ea63a85b6ca676554ce2aae10ce36 - PKG_SUBDIR=centos diff --git a/mkosi.images/build/mkosi.conf.d/fedora/mkosi.conf b/mkosi.images/build/mkosi.conf.d/fedora/mkosi.conf index 0e1a1cd7ef..0e02dcb642 100644 --- a/mkosi.images/build/mkosi.conf.d/fedora/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/fedora/mkosi.conf @@ -4,12 +4,6 @@ Distribution=fedora [Content] -Environment= - GIT_URL=https://src.fedoraproject.org/rpms/systemd.git - GIT_BRANCH=rawhide - GIT_COMMIT=a3524fc837f5e7b68f86b3e0a9d470a94a04c4c8 - PKG_SUBDIR=fedora - Packages= erofs-utils rpmautospec From 1d8f16df903a5567e2359bac3b8ca0caf937d333 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 22 Jul 2024 10:28:50 +0200 Subject: [PATCH 3/4] mkosi: update fedora commit reference * 00babccdea Simplify BFQ scheduler enablement * ef8ddb130b Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild * 5b4a5461d6 Fix changelog * a8c5c736f6 Only apply shorter shutdown timer changes on Fedora * f4e284cd7a Merge #150 `Deal with systemd-timesyncd backport in EPEL` |\ | * 9378a0733a Deal with systemd-timesyncd backport in EPEL * | 12d1f05029 Don't claim /sbin/installkernel if building for CentOS Stream 9 |/ * 79828f2753 spec: use "positive" conditions in conditionals * c5d3af1638 Add build dependency on rsync on CentOS Stream 9 * 8d080fb5cb Backport udma buffer access patch * 6084453807 Add support for building from a specific branch * cb9d631ca0 Update PR patch metadata * 3889da947e In standalone subpackages, suggest coreutils-single * b7800e3e66 Drop versions from Conflicts for standalone packages --- mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 682c2f43c7..f3afd55a75 100644 --- a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf @@ -8,7 +8,7 @@ Distribution=|fedora Environment= GIT_URL=https://src.fedoraproject.org/rpms/systemd.git GIT_BRANCH=rawhide - GIT_COMMIT=a3524fc837f5e7b68f86b3e0a9d470a94a04c4c8 + GIT_COMMIT=00babccdea1576d96edfdb7ab12958564cc4f1b6 PKG_SUBDIR=fedora Packages= From 4ecd6c3552aff72a40924560d7dfe2557b6e7c8e Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 22 Jul 2024 10:28:57 +0200 Subject: [PATCH 4/4] mkosi: update arch commit reference * 1d577a6268 refresh the keys * 12383ba712 make libarchive a regular optional dependency... * f51d5e04bf ignore rc releases in nvchecker * 0b096a2baa add nvchecker * 5f0ced863c upgpkg: 256.2-1: new upstream release --- mkosi.images/build/mkosi.conf.d/arch/mkosi.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf b/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf index 5502f53d6d..c071468963 100644 --- a/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf @@ -7,7 +7,7 @@ Distribution=arch Environment= GIT_URL=https://gitlab.archlinux.org/archlinux/packaging/packages/systemd.git GIT_BRANCH=main - GIT_COMMIT=d74b24c7c6077740c35a876445febe6d26bf013c + GIT_COMMIT=1d577a62688419ee4af01b847e55845cd9780301 PKG_SUBDIR=arch Packages=