abuild: normalize path when finding symlink targets
some paths like usr/lib/../../lib/libudev.so.0.13.0 will fail to resolve if usr/lib is does not exist, even if lib/libudev.so.0.13.0 does. To solve thise we normalize out the ../ in path string before we try to resolve it.
This commit is contained in:
parent
9d91994a74
commit
b4c8ef7dad
23
abuild.in
23
abuild.in
|
@ -1180,6 +1180,21 @@ scan_shared_objects() {
|
||||||
done > "$controldir"/.needs-so
|
done > "$controldir"/.needs-so
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# normalize a path string
|
||||||
|
normalize_path() {
|
||||||
|
local oifs="$IFS" pathstr= i=
|
||||||
|
IFS='/'
|
||||||
|
set -- $1
|
||||||
|
for i; do
|
||||||
|
case "$i" in
|
||||||
|
"."|"") continue;;
|
||||||
|
"..") pathstr="${pathstr%%/${pathstr##*/}}";;
|
||||||
|
*) pathstr="${pathstr}/$i";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
echo "$pathstr"
|
||||||
|
}
|
||||||
|
|
||||||
# find which package provides file that symlink points to
|
# find which package provides file that symlink points to
|
||||||
scan_symlink_targets() {
|
scan_symlink_targets() {
|
||||||
local name="$1" dir="$2" datadir="$3"
|
local name="$1" dir="$2" datadir="$3"
|
||||||
|
@ -1188,10 +1203,10 @@ scan_symlink_targets() {
|
||||||
for symfile in "$pkgbasedir"/.control.*/.symlinks; do
|
for symfile in "$pkgbasedir"/.control.*/.symlinks; do
|
||||||
[ -e "$symfile" ] || continue
|
[ -e "$symfile" ] || continue
|
||||||
while read symlink target; do
|
while read symlink target; do
|
||||||
case "$target" in
|
if [ "${target#/}" = "$target" ]; then
|
||||||
/*) targetpath="${datadir}/$target";;
|
target="${symlink%/*}/$target"
|
||||||
*) targetpath="${symlink%/*}/$target";;
|
fi
|
||||||
esac
|
targetpath="$datadir"/$(normalize_path "$target")
|
||||||
if [ -e "$targetpath" ] || [ -L "$targetpath" ]; then
|
if [ -e "$targetpath" ] || [ -L "$targetpath" ]; then
|
||||||
local d="${symfile%/.symlinks}"
|
local d="${symfile%/.symlinks}"
|
||||||
echo "$name=$pkgver-r$pkgrel" \
|
echo "$name=$pkgver-r$pkgrel" \
|
||||||
|
|
Loading…
Reference in New Issue