abuild: use apk index -d to update the abuildrepo index

This commit is contained in:
Natanael Copa 2009-05-14 14:41:12 +00:00
parent c8b2c27eec
commit 2219b258cf

View File

@ -17,7 +17,7 @@ pkgbasedir=${pkgbasedir:-"$startdir/pkg"}
pkgrel=0
repo=${startdir%/*}
repo=${repo##*/}
tmprepo=/var/cache/abuild/tmprepo
abuildrepo=/var/cache/abuild/apks
# defaults
SRCDEST=${SRCDEST:-$startdir}
@ -26,7 +26,7 @@ BUILD_BASE="binutils gcc make patch uclibc-dev"
SUDO=${SUDO:-"sudo"}
default_cmds="sanitycheck builddeps clean fetch unpack rootpkg"
default_cmds="sanitycheck builddeps clean fetch unpack rootpkg abuildrepo"
# read config
ABUILD_CONF=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
@ -232,9 +232,12 @@ cleanpkg() {
local i
msg "Cleaning built packages..."
for i in $pkgname $subpackages; do
local p="$i-$pkgver-r$pkgrel"
rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz"
local p="${i%:*}-$pkgver-r$pkgrel"
rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz" \
"$abuildrepo"/$p.apk
done
# remove given packages from index
}
# clean all packages except current
@ -385,26 +388,47 @@ create_apks() {
local name=$(pkginfo_val pkgname $file)
local ver=$(pkginfo_val pkgver $file)
local apk=$name-$ver.apk
msg "Creating $apk..."
(
cd "$dir"
set *
[ "$1" = '*' ] && set --
cd "$dir" && tar -zcf "$PKGDEST"/$apk $(cat .metafiles) $@
tar -zcf "$PKGDEST"/$apk $(cat .metafiles) $@
)
done
}
update_tmprepo() {
update_abuildrepo_index() {
local index="$abuildrepo"/APK_INDEX.gz
local opt=
(
for i in "$@"; do
pkg=${i##*/}
todelete="$todelete ${pkg%-[0-9]*.apk}"
done
if [ -f "$index" ]; then
echo "apk index -q -d \"$index\" $todelete || exit 1" >&2
apk index -q -d "$index" $todelete || exit 1
fi
apk index -q "$@" || exit 1
) > "$abuildrepo"/APK_INDEX.new || return 1
gzip "$abuildrepo"/APK_INDEX.new && mv "$abuildrepo/APK_INDEX.new.gz" "$index"
}
abuildrepo() {
if ! up2date; then
sanitycheck && builddeps && clean && fetch && unpack && rootpkg || return 1
fi
local apk
set --
for apk in $(listpkg); do
ln -sf "$PKGDEST"/$apk "$tmprepo"/$apk
ln -sf "$PKGDEST"/$apk "$abuildrepo"/$apk
set -- "$@" "$abuildrepo"/$apk
done
# update the tmprepo cache here
msg "Updating the cached build repository index..."
apk index "$tmprepo"/*.apk | gzip > "$tmprepo"/APK_INDEX.gz
# update the abuildrepo cache here
msg "Updating the cached abuild repository index..."
update_abuildrepo_index "$@"
}
# predefined splitfunc doc