debugflags: Ensure we have unique source paths

Message ID 20220527164452.1130558-1-foxboron@archlinux.org
State New, archived
Headers show
Series debugflags: Ensure we have unique source paths | expand

Commit Message

Morten Linderud May 27, 2022, 4:44 p.m. UTC
From: Morten Linderud <morten@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@linderud.pw>
---
 scripts/libmakepkg/buildenv/debugflags.sh.in | 6 +++---
 scripts/libmakepkg/tidy/strip.sh.in          | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Allan McRae June 25, 2022, 12:44 a.m. UTC | #1
On 28/5/22 02:44, Morten Linderud wrote:
> From: Morten Linderud <morten@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@linderud.pw>

Ack

Patch

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'
 }