[PATCH] Fix moving source files into debug packages

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Fix moving source files into debug packages

Allan McRae
Commit 8bec63bf92d8dd028aa88dbd5109c314cdb9ebea attempted to switch to
using -fdebug-prefix-map to set file locations in debug packages.  It
make a few mistakes...

1) Adding debug C{,XX}FLAGS only worked if DBGSRCDIR was defined in
makepkg.conf.  Fix this fall back to the default value

2) Using -fdebug-prefix-map altered a lot of assumptions about file
locations when copying source files into debug packages. This resulted
in lots of messages of failed cp in packaging output.

Signed-off-by: Allan McRae <[hidden email]>
---
 scripts/libmakepkg/tidy/strip.sh.in | 6 +++---
 scripts/makepkg.sh.in               | 6 ++----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
index 8a1d6096..4aa00051 100644
--- a/scripts/libmakepkg/tidy/strip.sh.in
+++ b/scripts/libmakepkg/tidy/strip.sh.in
@@ -58,9 +58,9 @@ strip_file() {
  # copy source files to debug directory
  local f t
  while read -r t; do
- f=${t/$dbgsrc/"$srcdir"}
- mkdir -p "${t%/*}"
- cp -- "$f" "$t"
+ f=${t/${DBGSRCDIR:-/usr/src/debug}/"$srcdir"}
+ mkdir -p "${dbgdir}${t%/*}"
+ cp -- "$f" "${dbgdir}$t"
  done < <(source_files "$binary")
 
  # copy debug symbols to debug directory
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 8251e71b..a74e7b39 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -379,10 +379,8 @@ prepare_buildenv() {
  fi
 
  if check_option "debug" "y"; then
- if [[ -v DBGSRCDIR ]]; then
- DEBUG_CFLAGS+=" -fdebug-prefix-map=$srcdir=$DBGSRCDIR"
- DEBUG_CXXFLAGS+=" -fdebug-prefix-map=$srcdir=$DBGSRCDIR"
- fi
+ DEBUG_CFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
+ DEBUG_CXXFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
  CFLAGS+=" $DEBUG_CFLAGS"
  CXXFLAGS+=" $DEBUG_CXXFLAGS"
  fi
--
2.15.1
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix moving source files into debug packages

Allan McRae
On 09/01/18 13:10, Allan McRae wrote:

> Commit 8bec63bf92d8dd028aa88dbd5109c314cdb9ebea attempted to switch to
> using -fdebug-prefix-map to set file locations in debug packages.  It
> make a few mistakes...
>
> 1) Adding debug C{,XX}FLAGS only worked if DBGSRCDIR was defined in
> makepkg.conf.  Fix this fall back to the default value
>
> 2) Using -fdebug-prefix-map altered a lot of assumptions about file
> locations when copying source files into debug packages. This resulted
> in lots of messages of failed cp in packaging output.
>

Crap... the second fix is not quite right either!