abuild: exclude non-dangling symlinks from dependency resolution
This commit also fixes incorrect behavior in case where an absolute symlink points to a file installed on the build host but which is missing from the package.
This commit is contained in:
parent
d9eba16d35
commit
f37a174836
23
abuild.in
23
abuild.in
@ -886,13 +886,14 @@ prepare_trace_rpaths() {
|
|||||||
|
|
||||||
# search for broken symlinks so we later can pull in proper depends
|
# search for broken symlinks so we later can pull in proper depends
|
||||||
prepare_symlinks() {
|
prepare_symlinks() {
|
||||||
|
local target
|
||||||
local dir="${subpkgdir:-$pkgdir}"
|
local dir="${subpkgdir:-$pkgdir}"
|
||||||
options_has "!tracedeps" && return 0
|
options_has "!tracedeps" && return 0
|
||||||
cd "$dir" || return 1
|
cd "$dir" || return 1
|
||||||
find -type l | while read symlink; do
|
find -type l | while read symlink; do
|
||||||
if ! [ -e "$symlink" ]; then
|
target=$(readlink "$symlink")
|
||||||
echo "$symlink $(readlink $symlink)" \
|
if ! [ -e "$dir$(normalize_target_path "$target" "$symlink")" ]; then
|
||||||
>> "$controldir"/.symlinks
|
echo "$symlink $target" >> "$controldir"/.symlinks
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -1190,11 +1191,16 @@ scan_shared_objects() {
|
|||||||
done > "$controldir"/.needs-so
|
done > "$controldir"/.needs-so
|
||||||
}
|
}
|
||||||
|
|
||||||
# normalize a path string
|
# normalize a symlink target path (1st arg)
|
||||||
normalize_path() {
|
# Converts a relative path to absolute with respect to the symlink
|
||||||
|
# path (2nd arg).
|
||||||
|
normalize_target_path() {
|
||||||
|
local path=$1
|
||||||
|
[ "${path:0:1}" = / ] || path=$(dirname "$2")/$path
|
||||||
|
|
||||||
local oifs="$IFS" pathstr= i=
|
local oifs="$IFS" pathstr= i=
|
||||||
IFS='/'
|
IFS='/'
|
||||||
set -- $1
|
set -- $path
|
||||||
for i; do
|
for i; do
|
||||||
case "$i" in
|
case "$i" in
|
||||||
"."|"") continue;;
|
"."|"") continue;;
|
||||||
@ -1217,10 +1223,7 @@ scan_symlink_targets() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while read symlink target; do
|
while read symlink target; do
|
||||||
if [ "${target#/}" = "$target" ]; then
|
targetpath=$datadir$(normalize_target_path "$target" "$symlink")
|
||||||
target="${symlink%/*}/$target"
|
|
||||||
fi
|
|
||||||
targetpath="$datadir"/$(normalize_path "$target")
|
|
||||||
if [ -e "$targetpath" ] || [ -L "$targetpath" ]; then
|
if [ -e "$targetpath" ] || [ -L "$targetpath" ]; then
|
||||||
echo "$name=$pkgver-r$pkgrel" \
|
echo "$name=$pkgver-r$pkgrel" \
|
||||||
>> "$d"/.symlinks-needs
|
>> "$d"/.symlinks-needs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user