diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-05-14 14:41:12 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-05-14 14:41:12 +0000 |
commit | 2219b258cfe9e0ff7165dccfa98c697ab9cb628b (patch) | |
tree | 1e8c4d34ba0319336c142ebb220ceec281e0ea55 /abuild.in | |
parent | c8b2c27eec71cb76af24ca40cada2a15e497f415 (diff) | |
download | abuild-2219b258cfe9e0ff7165dccfa98c697ab9cb628b.tar.gz abuild-2219b258cfe9e0ff7165dccfa98c697ab9cb628b.tar.bz2 abuild-2219b258cfe9e0ff7165dccfa98c697ab9cb628b.tar.xz abuild-2219b258cfe9e0ff7165dccfa98c697ab9cb628b.zip |
abuild: use apk index -d to update the abuildrepo index
Diffstat (limited to 'abuild.in')
-rwxr-xr-x | abuild.in | 44 |
1 files changed, 34 insertions, 10 deletions
@@ -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 |