abuild: check is so: provides are provided by own subpackage

This commit is contained in:
Natanael Copa 2012-10-02 18:34:30 +00:00
parent 3bd2388915
commit df83f78d71

View File

@ -858,10 +858,14 @@ find_so_files() {
return 0
}
subpkg_provides() {
grep -q -w "^$1" "$pkgbasedir"/.control.*/.provides-so 2>/dev/null
}
trace_apk_deps() {
local name="$1"
local dir="$2"
local i= j= found= autodeps= deppkgs= missing= so_paths= self_provided=
local i= found= autodeps= deppkgs= missing=
msg "Tracing dependencies..."
# add pkgconfig if usr/lib/pkgconfig is found
if [ -d "$pkgbasedir"/$name/usr/lib/pkgconfig ] \
@ -877,42 +881,29 @@ trace_apk_deps() {
msg " added libgcc (due to libpthread)"
fi
[ -f "$dir"/.needs-so ] && for i in $(cat "$dir"/.needs-so); do
found=
# first check if its provide by same apkbuild
for j in "$dir"/../.control.*/.provides-so; do
grep -q -w "^$i" "$j" || continue
found=${j%/.provides-so}
found=${found##*/.control.}
break
done
if [ -n "$found" ]; then
if ! list_has "$found" $self_provided; then
self_provided="$self_provided $found"
fi
# first check if its provided by same apkbuild
grep -q -w "^$i" "$dir"/.provides-so 2>/dev/null && continue
if subpkg_provides "$i" || $APK info -q -e "so:$i"; then
autodeps="$autodeps so:$i"
else
if $APK info --quiet --installed "so:$i"; then
autodeps="$autodeps so:$i"
else
missing="$missing $i"
fi
missing="$missing $i"
fi
done
# find all packages that holds the so files
if [ -f "$dir"/.rpaths ]; then
so_files=$(find_so_files "$dir"/.rpaths $missing) || return 1
local so_files=$(find_so_files "$dir"/.rpaths $missing) \
|| return 1
deppkgs=$($APK info -q -W $so_files) || return 1
fi
for found in $self_provided $deppkgs; do
for found in $deppkgs; do
if grep -w "^depend = ${found}$" "$dir"/.PKGINFO >/dev/null ; then
warning "You can remove '$found' from depends"
continue
fi
if [ "$found" != "$name" ] && ! list_has "$found" $autodeps; then
autodeps="$autodeps $found"
msg " added $found"
fi
autodeps="$autodeps $found"
done
echo "# automatically detected:" >> "$dir"/.PKGINFO