Commit e1dff715 authored by Natanael Copa's avatar Natanael Copa

abuild: initial support for versioned dependencies

parent ec8fd835
......@@ -648,12 +648,12 @@ depparse_aports() {
. $i
dir=${i%/APKBUILD}
deps=
# filter out conflicts from deps
# filter out conflicts from deps and version info
for j in $depends $makedepends; do
case "$j" in
!*) continue;;
esac
deps="$deps $j"
deps="$deps ${j%[<>=]*}"
done
for j in $pkgname $subpackages; do
echo "o ${j%%:*} $dir"
......@@ -672,7 +672,7 @@ depparse_aports() {
deptrace() {
local deps="$@"
[ -z "$deps" ] && deps="$BUILD_BASE $depends $makedepends"
[ -z "$deps" ] && die "should not happen"
( depparse_aports
if [ -z "$upgrade" ]; then
# list installed pkgs and prefix with 'i '
......@@ -704,15 +704,15 @@ deptrace() {
# build and install dependencies
builddeps() {
local deps alldeps pkg i dir ver missing installed_deps
local deps= alldeps= pkg= i= dir= ver= missing= installed_deps=
local filtered_deps=
[ -n "$nodeps" ] && return 0
msg "Analyzing dependencies..."
deps="$BUILD_BASE $makedepends"
# add depends unless it is a subpackage
for i in $depends; do
subpackages_has $i || deps="$deps $i"
subpackages_has ${i%[<>=]*} || deps="$deps $i"
done
installed_deps=$(apk info -e $deps)
......@@ -721,7 +721,7 @@ builddeps() {
if [ "${i#\!}" != "$i" ]; then
list_has ${i#\!} $installed_deps \
&& die "Conflicting package ${i#\!} is installed."
elif ! list_has $i $installed_deps; then
elif ! deplist_has $i $installed_deps; then
if [ -z "$install_deps" ] && [ -z "$recursive" ]; then
die "Missing dependency $i. Use -r to autoinstall or -R to build"
fi
......@@ -743,7 +743,7 @@ builddeps() {
# find dependencies that are installed but missing in repo.
for i in $deps; do
local m=$(apk search --repo "$apkcache" $i)
local m=$(apk search --repo "$apkcache" ${i%[<>=]*})
if [ -z "$m" ]; then
missing="$missing $i"
fi
......@@ -826,16 +826,29 @@ list_has() {
return 1
}
# same as list_has but we filter version info
deplist_has() {
local needle="$1"
local i
shift
for i in $@; do
i=${i%[<>=]*}
[ "$needle" = "$i" ] && return 0
[ "$needle" = "!$i" ] && return 1
done
return 1
}
options_has() {
list_has "$1" $options
}
depends_has() {
list_has "$1" $depends
deplist_has "$1" $depends
}
makedepends_has() {
list_has "$1" $makedepends
deplist_has "$1" $makedepends
}
md5sums_has() {
......
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