diff --git a/abuild.in b/abuild.in index d0b61a3..6fffc2c 100755 --- a/abuild.in +++ b/abuild.in @@ -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