[PATCH] debugflags: Ensure we have unique source paths

Morten Linderud foxboron at archlinux.org
Fri May 27 16:44:52 UTC 2022


From: Morten Linderud <morten at linderud.pw>

In some cases packages are built outside of a directory which contains
pkgname-pkgver, this results in source listing in debug packages having
a conflicting path like `/usr/src/debug/build/` which is not ideal.

This patch ensures we always include the pkgbase to ensure the paths are
unique.

Signed-off-by: Morten Linderud <morten at linderud.pw>
---
 scripts/libmakepkg/buildenv/debugflags.sh.in | 6 +++---
 scripts/libmakepkg/tidy/strip.sh.in          | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/libmakepkg/buildenv/debugflags.sh.in b/scripts/libmakepkg/buildenv/debugflags.sh.in
index 1cb58613..2bdb8b0b 100644
--- a/scripts/libmakepkg/buildenv/debugflags.sh.in
+++ b/scripts/libmakepkg/buildenv/debugflags.sh.in
@@ -30,9 +30,9 @@ buildenv_functions+=('buildenv_debugflags')
 
 buildenv_debugflags() {
 	if check_option "debug" "y" && ! check_option "buildflags" "n"; then
-		DEBUG_CFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
-		DEBUG_CXXFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
-		DEBUG_RUSTFLAGS+=" --remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
+		DEBUG_CFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
+		DEBUG_CXXFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
+		DEBUG_RUSTFLAGS+=" --remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
 		CFLAGS+=" $DEBUG_CFLAGS"
 		CXXFLAGS+=" $DEBUG_CXXFLAGS"
 		RUSTFLAGS+=" $DEBUG_RUSTFLAGS"
diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
index 688bcf1b..25bc649e 100644
--- a/scripts/libmakepkg/tidy/strip.sh.in
+++ b/scripts/libmakepkg/tidy/strip.sh.in
@@ -47,7 +47,7 @@ source_files() {
 
 	LANG=C debugedit --no-recompute-build-id \
 		--base-dir "${srcdir}" \
-		--dest-dir "${dbgsrcdir}" \
+		--dest-dir "${dbgsrcdir}/${pkgbase}" \
 		--list-file /dev/stdout "$1" \
 		| sort -zu | tr '\0' '\n'
 }
-- 
2.36.1



More information about the pacman-dev mailing list