Commit f795040b authored by Natanael Copa's avatar Natanael Copa

abuild: support for overriding apk binary

so we can do: APK=apk.static abuild ....
parent f4e9b5d3
......@@ -20,6 +20,7 @@ abuild_path=$(readlink -f $0)
BUILD_BASE="build-base"
SUDO=${SUDO:-"sudo"}
FAKEROOT=${FAKEROOT:-"fakeroot"}
APK=${APK:-apk}
# read config
ABUILD_CONF=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
......@@ -69,7 +70,7 @@ set_xterm_title() {
cleanup() {
set_xterm_title ""
if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then
$SUDO apk del $uninstall_after
$SUDO $APK del $uninstall_after
fi
}
......@@ -87,7 +88,7 @@ sanitycheck() {
[ -z "${pkgname##* *}" ] && die "pkgname contains spaces"
[ -z "$pkgver" ] && die "Missing pkgver in APKBUILD"
if [ "$pkgver" != "volatile" ] && [ -z "$nodeps" ]; then
apk version --check -q "$pkgver" ||\
$APK version --check -q "$pkgver" ||\
die "$pkgver is not a valid version"
fi
[ -z "$pkgrel" ] && warning "Missing pkgrel in APKBUILD. Using pkgrel=0"
......@@ -476,7 +477,7 @@ trace_apk_deps() {
done
# check apk db if not provided by a subpackage
if [ -z "$found" ]; then
found=$(apk info -q -W /lib/$i /usr/lib/$i)
found=$($APK info -q -W /lib/$i /usr/lib/$i)
fi
if [ -z "$found" ]; then
error "Could not find dependency for $i"
......@@ -562,7 +563,7 @@ apkcache() {
if [ -f APKINDEX.tar.gz ]; then
oldindex="--index APKINDEX.tar.gz"
fi
apk index $oldindex --output APKINDEX.tar.gz.unsigned \
$APK index $oldindex --output APKINDEX.tar.gz.unsigned \
--description "$repo $(cd $startdir && git describe)" \
*.apk || exit 1
msg "Signing the index..."
......@@ -768,7 +769,7 @@ deptrace() {
( depparse_aports
if [ -z "$upgrade" ]; then
# list installed pkgs and prefix with 'i '
apk info -q | sort | sed 's/^/i /'
$APK info -q | sort | sed 's/^/i /'
fi
) | awk -v pkgs="$deps" '
......@@ -807,7 +808,7 @@ builddeps() {
subpackages_has ${i%[<>=]*} || deps="$deps $i"
done
installed_deps=$(apk info -e $deps)
installed_deps=$($APK info -e $deps)
# find which deps are missing
for i in $deps; do
if [ "${i#\!}" != "$i" ]; then
......@@ -828,10 +829,10 @@ builddeps() {
if [ -n "$install_deps" ] && [ -z "$recursive" ]; then
# make a --simluate run first to detect missing deps
# apk-tools --virtual is no goot at reporting those.
$SUDO apk add --repository "$apkcache" \
$SUDO $APK add --repository "$apkcache" \
--wait 30 \
--simulate --quiet $deps || return 1
$SUDO apk add --repository "$apkcache" \
$SUDO $APK add --repository "$apkcache" \
--wait 30 \
--virtual .makedepends-$pkgname $deps \
&& return 0
......@@ -841,7 +842,7 @@ builddeps() {
# find dependencies that are installed but missing in repo.
for i in $deps; do
local m=$(apk search --repository "$apkcache" ${i%[<>=]*})
local m=$($APK search --repository "$apkcache" ${i%[<>=]*})
if [ -z "$m" ]; then
missing="$missing $i"
fi
......@@ -856,7 +857,7 @@ builddeps() {
cd "$dir" && $0 -k -r apkcache || return 1
fi
done
$SUDO apk add -u --repository "$apkcache" \
$SUDO $APK add -u --repository "$apkcache" \
--wait 30 \
--virtual .makedepends-$pkgname $deps
}
......@@ -963,24 +964,24 @@ post_add() {
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 }')
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 --wait 30 -u "$pkgf" || die "Failed to install $1"
$SUDO $APK add --wait 30 -u "$pkgf" || die "Failed to install $1"
}
installdeps() {
local deps i
sudo apk add --wait 30 --repository "$apkcache" \
sudo $APK add --wait 30 --repository "$apkcache" \
--virtual .makedepends-$pkgname \
$makedepends
}
uninstalldeps (){
sudo apk del .makedepends-$pkgname
sudo $APK del .makedepends-$pkgname
}
all() {
......
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