Commit c6b0de32 authored by Timo Teräs's avatar Timo Teräs Committed by Natanael Copa

abuild: add makedepends_build and makedepends_host for crosscompile

parent 9f81a144
...@@ -117,8 +117,9 @@ cleanup() { ...@@ -117,8 +117,9 @@ cleanup() {
deps) deps)
if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then
msg "Uninstalling dependencies..." msg "Uninstalling dependencies..."
$SUDO_APK del --quiet $apk_opt_wait \ $SUDO_APK del --quiet $apk_opt_wait $uninstall_after
$uninstall_after [ "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT" ] && \
$SUDO_APK del --root "$CBUILDROOT" --quiet $apk_opt_wait $uninstall_after
fi fi
;; ;;
esac esac
...@@ -1521,24 +1522,45 @@ deptrace() { ...@@ -1521,24 +1522,45 @@ deptrace() {
# build and install dependencies # build and install dependencies
builddeps() { builddeps() {
local deps= alldeps= pkg= i= dir= ver= missing= installed_deps= local pkg= i= missing= conflicts=
local filtered_deps= conflicts= local hostdeps= builddeps= installed_hostdeps= installed_builddeps=
[ -n "$nodeps" ] && return 0 [ -n "$nodeps" ] && return 0
msg "Analyzing dependencies..." msg "Analyzing dependencies..."
# add depends unless it is a subpackage or package itself # add depends unless it is a subpackage or package itself
for i in $BUILD_BASE $depends $makedepends; do if [ "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT" ] && [ -n "$makedepends_build" -o -n "$makedepends_host" ]; then
[ "$pkgname" = "${i%%[<>=]*}" ] && continue for i in $BUILD_BASE $makedepends_build; do
subpackages_has ${i%%[<>=]*} || deps="$deps $i" [ "$pkgname" = "${i%%[<>=]*}" ] && continue
done subpackages_has ${i%%[<>=]*} || builddeps="$builddeps $i"
done
for i in $depends $makedepends_host; do
[ "$pkgname" = "${i%%[<>=]*}" ] && continue
subpackages_has ${i%%[<>=]*} || hostdeps="$hostdeps $i"
done
else
for i in $BUILD_BASE $depends $makedepends; do
[ "$pkgname" = "${i%%[<>=]*}" ] && continue
subpackages_has ${i%%[<>=]*} || builddeps="$builddeps $i"
done
fi
installed_builddeps=$($APK info --installed $builddeps)
[ -n "$hostdeps" ] && installed_hostdeps=$($APK info --root "$CBUILDROOT" --installed $hostdeps)
installed_deps=$($APK info --installed $deps)
# find which deps are missing # find which deps are missing
for i in $deps; do for i in $builddeps; do
if [ "${i#\!}" != "$i" ]; then if [ "${i#\!}" != "$i" ]; then
$APK info --quiet --installed "${i#\!}" \ $APK info --quiet --installed "${i#\!}" \
&& conflicts="$conflicts ${i#\!}" && conflicts="$conflicts ${i#\!}"
elif ! deplist_has $i $installed_deps || [ -n "$upgrade" ]; then elif ! deplist_has $i $installed_builddeps || [ -n "$upgrade" ]; then
missing="$missing $i"
fi
done
for i in $hostdeps; do
if [ "${i#\!}" != "$i" ]; then
$APK info --quiet --installed --root "$CBUILDROOT" "${i#\!}" \
&& conflicts="$conflicts ${i#\!}"
elif ! deplist_has $i $installed_hostdeps || [ -n "$upgrade" ]; then
missing="$missing $i" missing="$missing $i"
fi fi
done done
...@@ -1556,18 +1578,28 @@ builddeps() { ...@@ -1556,18 +1578,28 @@ builddeps() {
fi fi
uninstall_after=".makedepends-$pkgname $uninstall_after" uninstall_after=".makedepends-$pkgname $uninstall_after"
if [ -n "$install_deps" ] && [ -z "$recursive" ] && [ -n "$deps" ]; then if [ -n "$install_deps" ] && [ -z "$recursive" ]; then
# make a --simluate run first to detect missing deps # make a --simulate run first to detect missing deps
# apk-tools --virtual is no goot at reporting those. # apk-tools --virtual is no goot at reporting those.
$SUDO_APK add --repository "$abuildrepo" \ msg "Installing packages on builder: $builddeps"
$apk_opt_wait \ $SUDO_APK add --repository "$abuildrepo" $apk_opt_wait \
--simulate --quiet $deps || return 1 --simulate --quiet $builddeps || return 1
$SUDO_APK add --repository "$abuildrepo" \ $SUDO_APK add --repository "$abuildrepo" $apk_opt_wait \
$apk_opt_wait \ --virtual .makedepends-$pkgname $builddeps || return 1
--virtual .makedepends-$pkgname $deps \ if [ -n "$hostdeps" ]; then
&& return 0 msg "Installing packages on target host: $hostdeps"
$SUDO_APK add --root "$CBUILDROOT" --repository "$abuildrepo" $apk_opt_wait \
--simulate --quiet $hostdeps || return 1
$SUDO_APK add --root "$CBUILDROOT" --repository "$abuildrepo" $apk_opt_wait \
--virtual .makedepends-$pkgname $hostdeps || return 1
fi
return 0
fi fi
if [ -n "$CBUILDROOT" ]; then
error "Recursive rebuilding is not supported when cross compiling."
return 1
fi
[ -z "$recursive" ] && return 1 [ -z "$recursive" ] && return 1
# find dependencies that are installed but missing in repo. # find dependencies that are installed but missing in repo.
...@@ -1739,6 +1771,8 @@ deps() { ...@@ -1739,6 +1771,8 @@ deps() {
undeps (){ undeps (){
$SUDO_APK del $apk_opt_wait .makedepends-$pkgname $SUDO_APK del $apk_opt_wait .makedepends-$pkgname
[ "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT" ] &&
$SUDO_APK del --root "$CBUILDROOT" $apk_opt_wait .makedepends-$pkgname
} }
# compat # compat
......
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