abuild: automatically detect symlink targets in other subpackages
Automatically pull in dependencies for symlink targets provided by other subpackages. This is mainly for pulling in target of .so symlinks.
This commit is contained in:
parent
5e268f8d70
commit
c70dbf8495
45
abuild.in
45
abuild.in
|
@ -886,6 +886,19 @@ prepare_trace_rpaths() {
|
|||
fi
|
||||
}
|
||||
|
||||
# search for broken symlinks so we later can pull in proper depends
|
||||
prepare_symlinks() {
|
||||
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
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# check if dir has arch specific binaries
|
||||
dir_has_arch_binaries() {
|
||||
local dir="$1"
|
||||
|
@ -920,7 +933,8 @@ archcheck() {
|
|||
prepare_package() {
|
||||
msg "Preparing ${subpkgname:+sub}package ${subpkgname:-$pkgname}..."
|
||||
stripbin
|
||||
prepare_metafiles && prepare_trace_rpaths || return 1
|
||||
prepare_metafiles && prepare_trace_rpaths && prepare_symlinks \
|
||||
|| return 1
|
||||
archcheck
|
||||
}
|
||||
|
||||
|
@ -1004,6 +1018,12 @@ trace_apk_deps() {
|
|||
autodeps="$autodeps $found"
|
||||
done
|
||||
|
||||
# symlink targets
|
||||
for i in $(sort -u "$dir"/.symlinks-needs 2>/dev/null); do
|
||||
msg " added $i (symlink target)"
|
||||
autodeps="$autodeps $i"
|
||||
done
|
||||
|
||||
echo "# automatically detected:" >> "$dir"/.PKGINFO
|
||||
if [ -f "$dir"/.provides-so ]; then
|
||||
sed 's/^\(.*\) \([0-9].*\)/provides = so:\1=\2/' "$dir"/.provides-so \
|
||||
|
@ -1042,6 +1062,10 @@ scan_shared_objects() {
|
|||
local name="$1" controldir="$2" datadir="$3"
|
||||
local opt= i=
|
||||
|
||||
if [ "$arch" != "noarch" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# allow spaces in paths
|
||||
IFS=:
|
||||
set -- $(find_scanelf_paths "$datadir")
|
||||
|
@ -1112,6 +1136,22 @@ scan_shared_objects() {
|
|||
done > "$controldir"/.needs-so
|
||||
}
|
||||
|
||||
# find which package provides file that symlink points to
|
||||
scan_symlink_targets() {
|
||||
local name="$1" dir="$2" datadir="$3"
|
||||
local symfile
|
||||
cd "$datadir"
|
||||
for symfile in "$pkgbasedir"/.control.*/.symlinks; do
|
||||
[ -e "$symfile" ] || continue
|
||||
while read symlink target; do
|
||||
if [ -e "${symlink%/*}"/"$target" ]; then
|
||||
local d="${symfile%/.symlinks}"
|
||||
echo "$name" >> "$d"/.symlinks-needs
|
||||
fi
|
||||
done < "$symfile"
|
||||
done
|
||||
}
|
||||
|
||||
# read size in bytes from stdin and show as human readable
|
||||
human_size() {
|
||||
awk '{ split("B KB MB GB TB PB", type)
|
||||
|
@ -1124,13 +1164,14 @@ create_apks() {
|
|||
local file= dir= name= ver= apk= datadir= size=
|
||||
getpkgver || return 1
|
||||
mkdir -p "$PKGDEST"
|
||||
if [ "$arch" != "noarch" ] && ! options_has "!tracedeps"; then
|
||||
if ! options_has "!tracedeps"; then
|
||||
for file in "$pkgbasedir"/.control.*/.PKGINFO; do
|
||||
dir="${file%/.PKGINFO}"
|
||||
name="$(pkginfo_val pkgname $file)"
|
||||
datadir="$pkgbasedir"/$name
|
||||
subpkgname=$name
|
||||
scan_shared_objects "$name" "$dir" "$datadir"
|
||||
scan_symlink_targets "$name" "$dir" "$datadir"
|
||||
done
|
||||
fi
|
||||
for file in "$pkgbasedir"/.control.*/.PKGINFO; do
|
||||
|
|
Loading…
Reference in New Issue