abuild: up2date handle apkcache properly

abuild will not consider package up2date unless apk cache is up2date
This commit is contained in:
Natanael Copa 2009-06-03 21:29:58 +00:00
parent 2c907ddc34
commit 44247711a4
1 changed files with 26 additions and 8 deletions

View File

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