Commit 44247711 authored by Natanael Copa's avatar Natanael Copa

abuild: up2date handle apkcache properly

abuild will not consider package up2date unless apk cache is up2date
parent 2c907ddc
...@@ -467,10 +467,11 @@ update_apkcache_index() { ...@@ -467,10 +467,11 @@ update_apkcache_index() {
} }
apkcache() { apkcache() {
if ! up2date; then if ! apk_up2date || [ -n "$force" ]; then
sanitycheck && builddeps && clean && fetch && unpack && rootpkg || return 1 sanitycheck && builddeps && clean && fetch && unpack && rootpkg || return 1
fi fi
local apk local apk
mkdir -p "$apkcache" || return 1
set -- set --
for apk in $(listpkg); do for apk in $(listpkg); do
ln -sf "$PKGDEST"/$apk "$apkcache"/$apk ln -sf "$PKGDEST"/$apk "$apkcache"/$apk
...@@ -572,7 +573,7 @@ srcpkg() { ...@@ -572,7 +573,7 @@ srcpkg() {
} }
# check if package is up to date # check if package is up to date
up2date() { apk_up2date() {
local pkg="$PKGDEST/$pkgname-$pkgver-r$pkgrel.apk" local pkg="$PKGDEST/$pkgname-$pkgver-r$pkgrel.apk"
local i s local i s
cd "$startdir" cd "$startdir"
...@@ -595,6 +596,19 @@ up2date() { ...@@ -595,6 +596,19 @@ up2date() {
return 0 return 0
} }
cache_up2date() {
local i apk
for i in $pkgname $subpackages; do
apk="${i%:*}-$pkgver-r$pkgrel.apk"
[ "$apkcache"/APK_INDEX.gz -nt "$apkcache"/$apk ] || return 1
done
return 0
}
up2date() {
apk_up2date && cache_up2date
}
# source all APKBUILDs and output: # source all APKBUILDs and output:
# 1) origin of package # 1) origin of package
# 2) all dependencies # 2) all dependencies
...@@ -854,7 +868,15 @@ installdeps() { ...@@ -854,7 +868,15 @@ installdeps() {
uninstalldeps (){ uninstalldeps (){
sudo apk del .makedepends-$pkgname sudo apk del .makedepends-$pkgname
} }
all() {
if up2date && [ -z "$force" ]; then
msg "Package is up to date"
else
apkcache
fi
}
usage() { usage() {
echo "$(basename $0) $abuild_ver" echo "$(basename $0) $abuild_ver"
echo "usage: ${0##*/} [options] [-i PKG] [-P REPODEST] [-p PKGDEST]" echo "usage: ${0##*/} [options] [-i PKG] [-P REPODEST] [-p PKGDEST]"
...@@ -947,11 +969,7 @@ if [ -z "$1" ] && [ -n "$newname" ]; then ...@@ -947,11 +969,7 @@ if [ -z "$1" ] && [ -n "$newname" ]; then
fi fi
if [ -z "$1" ]; then if [ -z "$1" ]; then
if up2date && [ -z "$force" ]; then set all
msg "Package is up to date"
else
set $default_cmds
fi
fi fi
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
......
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