# 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
# 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
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 \
--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"
GIT_URL=https://gitlab.archlinux.org/archlinux/packaging/packages/systemd.git
GIT_BRANCH=main
GIT_COMMIT=d74b24c7c6077740c35a876445febe6d26bf013c
+ PKG_SUBDIR=arch
Packages=
base
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[@]}"
. 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
$( ((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" \
--define "_fixperms true" \
--undefine _package_note_flags \
--noclean \
- "pkg/$ID/systemd.spec"
+ "pkg/$PKG_SUBDIR/systemd.spec"
(
shopt -s nullglob
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
--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 |
# 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 \
--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
GIT_URL=https://git.centos.org/rpms/systemd.git
GIT_BRANCH=c10s-sig-hyperscale
GIT_COMMIT=46480aaa9e0ea63a85b6ca676554ce2aae10ce36
+ PKG_SUBDIR=centos
# 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/*
GIT_SUBDIR=debian
GIT_BRANCH=debian/master
GIT_COMMIT=2d10c12bd55efac8d7b1414601087f98674e2195
+ PKG_SUBDIR=debian
Packages=
apt
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 .
GIT_URL=https://src.fedoraproject.org/rpms/systemd.git
GIT_BRANCH=rawhide
GIT_COMMIT=a3524fc837f5e7b68f86b3e0a9d470a94a04c4c8
+ PKG_SUBDIR=fedora
Packages=
erofs-utils
. 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
# 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.
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=
--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" \
--define "_fixperms true" \
--noclean \
"$@" \
- "pkg/$ID/systemd.spec"
+ "pkg/$PKG_SUBDIR/systemd.spec"
EXIT_STATUS=$?
# 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
GIT_URL=https://code.opensuse.org/package/systemd
GIT_BRANCH=master
GIT_COMMIT=6812406e52a474568744c267e7bade1496bb26a5
+ PKG_SUBDIR=opensuse
Packages=
gcc-c++
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 \
--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 |
--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
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
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.
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"
+++ /dev/null
-debian
\ No newline at end of file