debuginfo: Create empty src/debug directories for paths with `..'

Create empty directories under `/usr/src/debug` tree for source paths
containing `..` (for example `../../src` in elfutils). This should fix
debuginfo sources for autotools builds in subdir.

Fixes: https://bugzilla.altlinux.org/39175
This commit is contained in:
Виталий Чикунов 2020-11-12 22:02:42 +03:00
parent bb0b76e759
commit 309af2d59e

View File

@ -96,10 +96,15 @@ fi
mkdir -p .debuginfo/src/"${f%/*}"
awk 'BEGIN{RS="\0";ORS="\n"}{print}' .tmp/src.$$ |LC_ALL=C sort -u |
while read -r src; do
[ -f "$RPM_BUILD_DIR"/"$src" ] || continue
if [ ! -f ./usr/src/debug/"$src" ]; then
install -pD -m644 "$RPM_BUILD_DIR"/"$src" ./usr/src/debug/"$src".$$
mv -f ./usr/src/debug/"$src".$$ ./usr/src/debug/"$src"
if [ -f "$RPM_BUILD_DIR"/"$src" ]; then
if [ ! -f ./usr/src/debug/"$src" ]; then
install -pD -m644 "$RPM_BUILD_DIR"/"$src" ./usr/src/debug/"$src".$$
mv -f ./usr/src/debug/"$src".$$ ./usr/src/debug/"$src"
fi
elif [ -d "$RPM_BUILD_DIR"/"$src" ]; then
mkdir -p ./usr/src/debug/"$src"
else
continue
fi
printf '%s\n' /usr/src/debug/"$src"
done >.debuginfo/src/"$f"