Commit 2219b258 authored by Natanael Copa's avatar Natanael Copa

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

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