]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Disable unique debug source names
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 15 Jul 2024 15:15:43 +0000 (17:15 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 16 Jul 2024 07:41:22 +0000 (09:41 +0200)
We use -fdebug-prefix-map= because debugedit doesn't work for us (for
a currently unknown reason since it's the most obtuse code I've ever
had the pleasure of reading). With all the unique macros enabled, the
destination directory we pass to -fdebug-prefix-map= includes the package
release. The release is either the timestamp of the current commit or
the current time if the working tree is dirty. This means it generally
changes every time we rerun the build script. However, meson only reads
compiler arguments the first time it is invoked or if --wipe is specified.
This means that on a rerun -fdebug-prefix-map= will be configured wrong
and the build will fail.

Let's prevent this from happening by disabling the unique debug source
names by overriding the --unique-debug-src-base option that is passed to
find-debuginfo.sh by rpm via the _find_debuginfo_opts macro.

mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.build.chroot
mkosi.images/build/mkosi.conf.d/opensuse/mkosi.build.chroot

index dc45e2599092cc2c00c151da30383257ca6fc18c..ce1e162ebfa6fbd27a21d7161f8af4ad761d4946 100755 (executable)
@@ -31,10 +31,6 @@ fi
 VERSION="$(cat meson.version)"
 RELEASE="$(date "+%Y%m%d%H%M%S" --date "@$TS")"
 
-DIST="$(rpm --eval %dist)"
-ARCH="$(rpm --eval %_arch)"
-SRCDEST="/usr/src/debug/systemd-$VERSION-${RELEASE}${DIST}.$ARCH"
-
 COMMON_MACRO_OVERRIDES=(
     --define "toolchain $( ((LLVM)) && echo clang || echo gcc)"
     --define "_fortify_level 0"
@@ -47,7 +43,7 @@ COMMON_MACRO_OVERRIDES=(
 # TODO: Drop -U_FORTIFY_SOURCE when we switch to CentOS Stream 10.
 MKOSI_CFLAGS="-O0 -Wp,-U_FORTIFY_SOURCE"
 if ((WITH_DEBUG)); then
-    MKOSI_CFLAGS="$MKOSI_CFLAGS -fdebug-prefix-map=../src=$SRCDEST"
+    MKOSI_CFLAGS="$MKOSI_CFLAGS -fdebug-prefix-map=../src=/usr/src/debug/systemd"
 fi
 if ((LLVM)); then
     # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed.
@@ -105,6 +101,7 @@ CXX_LD="$( ((LLVM)) && echo lld)" \
     --define "__brp_check_rpaths %{nil}" \
     --define "__elf_exclude_path ^/usr/lib/systemd/tests/unit-tests/.*$" \
     --define "__script_requires %{nil}" \
+    --define "_find_debuginfo_opts --unique-debug-src-base \"%{name}\"" \
     --define "_find_debuginfo_dwz_opts %{nil}" \
     --define "_fixperms true" \
     --undefine _package_note_flags \
index 82e81cc9d80073542549134ba432dc81c7a1ac0f..95d747cd9371b26a93d39af933ea2ff99f390abf 100755 (executable)
@@ -36,13 +36,9 @@ fi
 VERSION="$(cat meson.version)"
 RELEASE="$(date "+%Y%m%d%H%M%S" --date "@$TS")"
 
-DIST="$(rpm --eval %dist)"
-ARCH="$(rpm --eval %_arch)"
-SRCDEST="/usr/src/debug/systemd-$VERSION-${RELEASE}${DIST}.$ARCH"
-
 MKOSI_CFLAGS="-O0 -Wp,-U_FORTIFY_SOURCE"
 if ((WITH_DEBUG)); then
-    MKOSI_CFLAGS="$MKOSI_CFLAGS -fdebug-prefix-map=../src=$SRCDEST"
+    MKOSI_CFLAGS="$MKOSI_CFLAGS -fdebug-prefix-map=../src=/usr/src/debug/systemd"
 fi
 if ((LLVM)); then
     # TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed.
@@ -104,6 +100,7 @@ build() {
         --define "__elf_exclude_path ^/usr/lib/systemd/tests/unit-tests/.*$" \
         --define "__script_requires %{nil}" \
         --define "_find_debuginfo_dwz_opts %{nil}" \
+        --define "_find_debuginfo_opts --unique-debug-src-base \"%{name}\"" \
         --define "_fixperms true" \
         --noclean \
         "$@" \