summaryrefslogtreecommitdiff
path: root/abuild.in
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-11-04 19:43:17 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2015-11-30 07:26:56 +0000
commitf37a1748366d08d9062f847a27f218e184ef737f (patch)
treebaf10416a5a50c1d9350d455d86dead1a50bead3 /abuild.in
parentd9eba16d355e6c8600d112c9f50cb2537ad2813d (diff)
downloadabuild-f37a1748366d08d9062f847a27f218e184ef737f.tar.gz
abuild-f37a1748366d08d9062f847a27f218e184ef737f.tar.bz2
abuild-f37a1748366d08d9062f847a27f218e184ef737f.tar.xz
abuild-f37a1748366d08d9062f847a27f218e184ef737f.zip
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.
Diffstat (limited to 'abuild.in')
-rw-r--r--abuild.in23
1 files changed, 13 insertions, 10 deletions
diff --git a/abuild.in b/abuild.in
index 38d6efd..a81ac49 100644
--- a/abuild.in
+++ b/abuild.in
@@ -886,13 +886,14 @@ prepare_trace_rpaths() {
# search for broken symlinks so we later can pull in proper depends
prepare_symlinks() {
+ local target
local dir="${subpkgdir:-$pkgdir}"
options_has "!tracedeps" && return 0
cd "$dir" || return 1
find -type l | while read symlink; do
- if ! [ -e "$symlink" ]; then
- echo "$symlink $(readlink $symlink)" \
- >> "$controldir"/.symlinks
+ target=$(readlink "$symlink")
+ if ! [ -e "$dir$(normalize_target_path "$target" "$symlink")" ]; then
+ echo "$symlink $target" >> "$controldir"/.symlinks
fi
done
}
@@ -1190,11 +1191,16 @@ scan_shared_objects() {
done > "$controldir"/.needs-so
}
-# normalize a path string
-normalize_path() {
+# normalize a symlink target path (1st arg)
+# 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=
IFS='/'
- set -- $1
+ set -- $path
for i; do
case "$i" in
"."|"") continue;;
@@ -1217,10 +1223,7 @@ scan_symlink_targets() {
fi
while read symlink target; do
- if [ "${target#/}" = "$target" ]; then
- target="${symlink%/*}/$target"
- fi
- targetpath="$datadir"/$(normalize_path "$target")
+ targetpath=$datadir$(normalize_target_path "$target" "$symlink")
if [ -e "$targetpath" ] || [ -L "$targetpath" ]; then
echo "$name=$pkgver-r$pkgrel" \
>> "$d"/.symlinks-needs