summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-04-04 11:18:29 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-04-04 11:18:29 +0000
commit8f6f8763cf9e050967f78df354a6894c0bde87da (patch)
tree90ae5b10780aa3d44c30fade16b2619b0a2e3c4a
parent62a87c97fb32277b99343fe27e5f1de0f895d3c0 (diff)
downloadabuild-8f6f8763cf9e050967f78df354a6894c0bde87da.tar.gz
abuild-8f6f8763cf9e050967f78df354a6894c0bde87da.tar.bz2
abuild-8f6f8763cf9e050967f78df354a6894c0bde87da.tar.xz
abuild-8f6f8763cf9e050967f78df354a6894c0bde87da.zip
abuild: fix check if abuildindex is up 2 date
-rwxr-xr-xabuild.in29
1 files changed, 22 insertions, 7 deletions
diff --git a/abuild.in b/abuild.in
index 178fe42..f78329d 100755
--- a/abuild.in
+++ b/abuild.in
@@ -1007,17 +1007,32 @@ apk_up2date() {
}
abuildindex_up2date() {
- local i j apk
+ local i
getpkgver || return 1
for i in $pkgname $subpackages; do
- apk="${i%:*}-$pkgver-r$pkgrel.apk"
- for j in "$abuildrepo"/*/$apk; do
- [ -r "$j" ] || continue # ignore missing files
- local idx="${j%/*}"/APKINDEX.tar.gz
- if ! [ "$idx" -nt "$j" ]; then
- return 1
+ local found= dir=
+ local apk="${i%:*}-$pkgver-r$pkgrel.apk"
+
+ # look for file in all arch dirs
+ for dir in "$abuildrepo"/*; do
+ [ -d "$dir" ] || continue
+ local file="$dir"/$apk
+ local idx="$dir"/APKINDEX.tar.gz
+
+ # check if index is missing
+ [ -f "$idx" ] || return 1
+
+ # check if file is there but is newer than index
+ if [ -f "$file" ]; then
+ found=1
+ if [ "$file" -nt "$idx" ]; then
+ return 1
+ fi
fi
done
+
+ # we are not up2date if file was not found in any arch dir
+ [ -z "$found" ] && return 1
done
return 0
}