From 7f97d718741303734576184aed690746a48895b6 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 20 Jan 2009 10:33:11 +0000 Subject: 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. --- abuild | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'abuild') diff --git a/abuild b/abuild index d905aec..e7a6650 100755 --- a/abuild +++ b/abuild @@ -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 -- cgit v1.2.3-70-g09d2