buildrepo: use new apk index and sign repo

This commit is contained in:
Natanael Copa 2009-07-24 17:11:56 +00:00
parent 640b086ec8
commit d7d7e55e91
1 changed files with 13 additions and 30 deletions

View File

@ -37,13 +37,9 @@ all_exist() {
}
build() {
local repo="$1" i indexupdate needbuild
local repo="$1" i needbuild
cd "$aportsdir/$repo" || return 1
mkdir -p "$repodir/$repo"
if ! [ -f "$repodir/$repo"/APK_INDEX.gz ]; then
indexupdate="APK_INDEX.gz"
fi
# first we try copy everything possible and find out which we need
# to rebuild. By doing this we might save us for rebuilding
@ -55,8 +51,6 @@ build() {
continue
fi
indexupdate="$indexupdate $i"
# try link or copy the files if they are in the ports dir
pkgs=$(abuild listpkg)
if all_exist $pkgs; then
@ -87,35 +81,24 @@ build() {
purge=$(ls *.apk 2>/dev/null | grep -v -w -f $tmp)
if [ -n "$purge" ]; then
rm -f $purge
indexupdate="$indexupdate $purge"
fi
rm -f "$tmp"
fi
# check if we have any .apk newer than our index
# generate the repository index
echo ">>> Generating Index for $repo..."
cd "$repodir/$repo"
if [ -z "$indexupdate" ]; then
for i in *.apk; do
if [ $i -nt APK_INDEX.gz ]; then
indexupdate=1
break;
fi
done
fi
# generate the repository index if needed
if [ -z "$indexupdate" ]; then
echo ">>> Index for $repo is up-to-date"
else
echo ">>> Generating Index for $repo..."
if which apk >/dev/null; then
local deps
for i in $deprepo; do
deps="--repo $repodir/$i"
done
apk $deps index *.apk | gzip -9 > APK_INDEX.gz
fi
local deps
for i in $deprepo; do
deps="--repo $repodir/$i"
done
oldindex=
if [ -f APKINDEX.tar.gz ]; then
oldindex="--index APKINDEX.tar.gz"
fi
tmpindex=$(mktemp).tar.gz
apk index $oldindex -o $tmpindex *.apk
abuild-sign $tmpindex && mv $tmpindex APKINDEX.tar.gz
}
while getopts "a:d:hl:pr:" opt; do