Commit d93c7e36 authored by Natanael Copa's avatar Natanael Copa
Browse files

main/abuild: fixes for dependency tracing

parent 57dc4c12
......@@ -3,7 +3,7 @@ pkgdesc="Script to build Alpine Packages"
pkgname=abuild
pkgver=2.12.1_git20121002
_ver=${pkgver%_git*}
pkgrel=0
pkgrel=1
url=http://git.alpinelinux.org/cgit/abuild/
depends="fakeroot file sudo pax-utils openssl apk-tools>=2.0.7-r1 uclibc-utils
abuildhelper curl"
......@@ -52,4 +52,4 @@ cpan() {
}
md5sums="92348750a3354c3ec7b811716543b8e5 abuild-2.12.1.tar.bz2
d8f030d1e05ce84ac21fbab2d910e8d4 abuild-git.patch"
ec1d71201cad30c5c1a41dca2557d03b abuild-git.patch"
diff --git a/abuild.in b/abuild.in
index 2780d2e..5c6c3dd 100755
index 2780d2e..0bf9d47 100755
--- a/abuild.in
+++ b/abuild.in
@@ -404,6 +404,9 @@ default_unpack() {
......@@ -46,39 +46,69 @@ index 2780d2e..5c6c3dd 100755
}
# check if dir has arch specific binaries
@@ -862,7 +862,7 @@ trace_apk_deps() {
@@ -858,11 +858,15 @@ 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= j= found= autodeps= deppkgs= missing= so_paths= self_provided=
- msg "Tracing dependencies for $name..."
+ local i= found= autodeps= deppkgs= missing=
+ msg "Tracing dependencies..."
# add pkgconfig if usr/lib/pkgconfig is found
if [ -d "$pkgbasedir"/$name/usr/lib/pkgconfig ] \
&& ! grep -q '^depend = pkgconfig' "$dir"/.PKGINFO; then
@@ -880,7 +880,7 @@ trace_apk_deps() {
found=
# first check if its provide by same apkbuild
for j in "$dir"/../.control.*/.provides-so; do
@@ -877,18 +881,11 @@ 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 -w "$i" "$j" >/dev/null || continue
+ grep -q -w "^$i" "$j" || continue
found=${j%/.provides-so}
found=${found##*/.control.}
break
@@ -890,7 +890,11 @@ trace_apk_deps() {
self_provided="$self_provided $found"
fi
- 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
- missing="$missing $i"
+ if $APK info --quiet --installed "so:$i"; then
+ autodeps="$autodeps so:$i"
+ else
+ missing="$missing $i"
+ fi
missing="$missing $i"
fi
done
@@ -896,41 +893,131 @@ trace_apk_deps() {
# 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
@@ -911,26 +915,113 @@ trace_apk_deps() {
- 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
- [ -z "$autodeps" ] && return 0
......@@ -92,6 +122,8 @@ index 2780d2e..5c6c3dd 100755
- echo "depend = $i" >> "$dir"/.PKGINFO
+ echo "depend = $i"
+ done | sort -u >> "$dir"/.PKGINFO
+ # display all depends
+ sed -n '/^depend =/s/depend = /\t/p' "$dir"/.PKGINFO >&2
+}
+
+find_scanelf_paths() {
......@@ -149,7 +181,10 @@ index 2780d2e..5c6c3dd 100755
+ # filter out sonames with version when file does not
+ # have version
+ case "$soname" in
+ *.so.[0-9]*) continue;;
+ *.so.[0-9]*)
+ if options_has "sover-namecheck"; then
+ continue
+ fi
+ esac
+ ;;
+ esac
......@@ -200,7 +235,7 @@ index 2780d2e..5c6c3dd 100755
(
cd "$datadir"
# data.tar.gz
@@ -941,6 +1032,7 @@ create_apks() {
@@ -941,6 +1028,7 @@ create_apks() {
fi
tar -c "$@" | abuild-tar --hash | gzip -9 >"$dir"/data.tar.gz
......@@ -208,7 +243,7 @@ index 2780d2e..5c6c3dd 100755
# append the hash for data.tar.gz
local sha256=$(sha256sum "$dir"/data.tar.gz | cut -f1 -d' ')
echo "datahash = $sha256" >> "$dir"/.PKGINFO
@@ -951,10 +1043,12 @@ create_apks() {
@@ -951,10 +1039,12 @@ create_apks() {
| gzip -9 > control.tar.gz
abuild-sign -q control.tar.gz || exit 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment