Commit 5e268f8d authored by Natanael Copa's avatar Natanael Copa

abuild: cleanup. use better function names

no change in code logic
parent 582b4778
...@@ -868,7 +868,7 @@ EOF ...@@ -868,7 +868,7 @@ EOF
echo $metafiles | tr ' ' '\n' > "$controldir"/.metafiles echo $metafiles | tr ' ' '\n' > "$controldir"/.metafiles
} }
prepare_tracedeps() { prepare_trace_rpaths() {
local dir=${subpkgdir:-$pkgdir} local dir=${subpkgdir:-$pkgdir}
local etype= soname= file= sover= local etype= soname= file= sover=
[ "$arch" = "noarch" ] && return 0 [ "$arch" = "noarch" ] && return 0
...@@ -920,7 +920,7 @@ archcheck() { ...@@ -920,7 +920,7 @@ archcheck() {
prepare_package() { prepare_package() {
msg "Preparing ${subpkgname:+sub}package ${subpkgname:-$pkgname}..." msg "Preparing ${subpkgname:+sub}package ${subpkgname:-$pkgname}..."
stripbin stripbin
prepare_metafiles && prepare_tracedeps || return 1 prepare_metafiles && prepare_trace_rpaths || return 1
archcheck archcheck
} }
...@@ -953,7 +953,7 @@ find_so_files() { ...@@ -953,7 +953,7 @@ find_so_files() {
return 0 return 0
} }
subpkg_provides() { subpkg_provides_so() {
grep -q -w "^$1" "$pkgbasedir"/.control.*/.provides-so 2>/dev/null grep -q -w "^$1" "$pkgbasedir"/.control.*/.provides-so 2>/dev/null
} }
...@@ -970,16 +970,18 @@ trace_apk_deps() { ...@@ -970,16 +970,18 @@ trace_apk_deps() {
fi fi
# special case for libpthread: we need depend on libgcc # special case for libpthread: we need depend on libgcc
if [ -f "$dir"/.needs-so ] && grep -q -w '^libpthread.so.*' "$dir"/.needs-so \ if [ "$CLIBC" = "uclibc" ] && [ -f "$dir"/.needs-so ] \
&& grep -q -w '^libpthread.so.*' "$dir"/.needs-so \
&& ! grep -q -w "^depend = libgcc" "$dir"/.PKGINFO; then && ! grep -q -w "^depend = libgcc" "$dir"/.PKGINFO; then
autodeps="$autodeps libgcc" autodeps="$autodeps libgcc"
msg " added libgcc (due to libpthread)" msg " added libgcc (due to libpthread)"
fi fi
[ -f "$dir"/.needs-so ] && for i in $(cat "$dir"/.needs-so); do [ -f "$dir"/.needs-so ] && for i in $(cat "$dir"/.needs-so); do
# first check if its provided by same apkbuild # first check if its provided by same apkbuild
grep -q -w "^$i" "$dir"/.provides-so 2>/dev/null && continue grep -q -w "^$i" "$dir"/.provides-so 2>/dev/null && continue
if subpkg_provides "$i" || cross_compiling \ if subpkg_provides_so "$i" || cross_compiling \
|| $APK info --quiet --installed "so:$i"; then || $APK info --quiet --installed "so:$i"; then
autodeps="$autodeps so:$i" autodeps="$autodeps so:$i"
else else
...@@ -1473,11 +1475,12 @@ abuildindex() { ...@@ -1473,11 +1475,12 @@ abuildindex() {
# 1) origin of package # 1) origin of package
# 2) all dependencies # 2) all dependencies
# the output is i in a format easy parseable for awk # the output is i in a format easy parseable for awk
depparse_aports() { parse_aports_makedepends() {
# lets run this in a subshell since we source all APKBUILD here # lets run this in a subshell since we source all APKBUILD here
( (
aportsdir=$(realpath ${APKBUILD%/APKBUILD}/..) aportsdir=$(realpath ${APKBUILD%/APKBUILD}/..)
for i in $aportsdir/*/APKBUILD; do for i in $aportsdir/*/APKBUILD; do
# no forks in this loop or it will be painfully slow!
pkgname= pkgname=
subpackages= subpackages=
depends= depends=
...@@ -1507,14 +1510,14 @@ depparse_aports() { ...@@ -1507,14 +1510,14 @@ depparse_aports() {
) )
} }
deptrace() { trace_makedepends() {
local deps= i= local deps= i=
# strip versions from deps # strip versions from deps
for i in "$@"; do for i in "$@"; do
deps="$deps ${i%%[<>=]*}" deps="$deps ${i%%[<>=]*}"
done done
[ -z "$deps" ] && return 0 [ -z "$deps" ] && return 0
( depparse_aports ( parse_aports_makedepends
if [ -z "$upgrade" ]; then if [ -z "$upgrade" ]; then
# list installed pkgs and prefix with 'i ' # list installed pkgs and prefix with 'i '
$APK info --quiet | sort | sed 's/^/i /' $APK info --quiet | sort | sed 's/^/i /'
...@@ -1627,7 +1630,7 @@ builddeps() { ...@@ -1627,7 +1630,7 @@ builddeps() {
fi fi
done done
for i in $(deptrace $missing); do for i in $(trace_makedepends $missing); do
# i = pkg:dir # i = pkg:dir
local dir=${i#*:} local dir=${i#*:}
local pkg=${i%:*} local pkg=${i%:*}
......
Markdown is supported
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