Commit 7f97d718 authored by Natanael Copa's avatar Natanael Copa

abuild:

try deal with dependencies for makedepends

Example.
foo-dev is a makedepends which depends on foo. We need to install foo before
we can install foo-dev.

The way we deal with thi here is hackish and should be replaced by adding
all built packages to an abuild repository or similar.
parent e543ba5d
......@@ -49,7 +49,7 @@ set_xterm_title() {
cleanup() {
set_xterm_title ""
if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then
sudo apk delete $uninstall_after
sudo apk del $uninstall_after
fi
}
......@@ -438,7 +438,7 @@ deptrace() {
( depparse_aports
if [ -z "$upgrade" ]; then
# list installed pkgs and prefix with 'i '
apk info | sed 's/-[0-9].*//; s/^/i /'
apk info -q | sort | sed 's/^/i /'
fi
) | awk -v pkgs="$BUILD_BASE $depends $makedepends" '
......@@ -521,6 +521,31 @@ listpkg() {
done
}
subpackages_has() {
local i
for i in $subpackages; do
[ "$1" = "${i%:*}" ] && return 0
done
return 1
}
# install package after build
post_add() {
local pkgf="$PKGDEST/$1-$pkgver-r$pkgrel.apk"
local deps i
if ! subpackages_has $1 && [ "$1" != "$pkgname" ]; then
die "$1 is not built by this APKBUILD"
fi
# recursively install dependencies that are provided by this APKBUILD
deps=$(apk index "$pkgf" 2>/dev/null | awk -F: '$1=="D" { print $2 }')
for i in $deps; do
if subpackages_has $i || [ "$i" = "$pkgname" ]; then
post_add $i || return 1
fi
done
sudo apk add -u "$pkgf" || die "Failed to install $1"
}
usage() {
echo "$(basename $0) $abuild_ver"
echo "usage: $0 [options] [-i PKG] [-p PKGDEST] [-s SRCDEST] [cmd] ..."
......@@ -601,8 +626,7 @@ while [ $# -gt 0 ]; do
done
for i in $install_after; do
sudo apk add -u $PKGDEST/$i-$pkgver-r$pkgrel.apk \
|| die "Failed to install $i"
post_add $i
done
cleanup
......
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