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.
This commit is contained in:
Natanael Copa 2009-01-20 10:33:11 +00:00
parent e543ba5d8b
commit 7f97d71874

32
abuild
View File

@ -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