mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-01-18 13:30:43 +00:00
buildrepo: improve index regeneration handling
This will hopefully fix the checksum errors
This commit is contained in:
parent
b936522cfd
commit
956b404597
59
buildrepo
59
buildrepo
@ -28,17 +28,6 @@ listpackages() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# purge obsolete packages
|
|
||||||
purge() {
|
|
||||||
[ -z "$dopurge" ] && return 0
|
|
||||||
local tmp=$(mktemp /tmp/$program-XXXXXX)
|
|
||||||
cd "$repodir/$1" || return 1
|
|
||||||
trap 'rm -f "$tmp"; exit 1' INT
|
|
||||||
( listpackages "$1") >$tmp
|
|
||||||
ls *.apk 2>/dev/null | grep -v -w -f $tmp | xargs rm 2>/dev/null
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
local repo="$1" i indexupdate needbuild
|
local repo="$1" i indexupdate needbuild
|
||||||
|
|
||||||
@ -69,11 +58,6 @@ build() {
|
|||||||
indexupdate="$indexupdate $i"
|
indexupdate="$indexupdate $i"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$indexupdate" ] && [ -z "$needbuild" ]; then
|
|
||||||
echo ">>> Repository $repo is up-to-date."
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# build the postponed packages if any
|
# build the postponed packages if any
|
||||||
if [ -n "$needbuild" ]; then
|
if [ -n "$needbuild" ]; then
|
||||||
for i in $needbuild; do
|
for i in $needbuild; do
|
||||||
@ -83,18 +67,43 @@ build() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# kill old packages in repo
|
# kill old packages in repo
|
||||||
purge "$repo"
|
if [ -n "$dopurge" ]; then
|
||||||
|
local tmp=$(mktemp /tmp/$program-XXXXXX)
|
||||||
|
local purgefiles
|
||||||
|
cd "$repodir/$1" || return 1
|
||||||
|
trap 'rm -f "$tmp"; exit 1' INT
|
||||||
|
( listpackages "$1") >$tmp
|
||||||
|
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
|
||||||
|
|
||||||
# generate the repository index
|
# check if we have any .apk newer than our index
|
||||||
cd "$repodir/$repo"
|
cd "$repodir/$repo"
|
||||||
echo ">>> Generating Index for $repo..."
|
if [ -z "$indexupdate" ]; then
|
||||||
md5sum *.apk | gzip -9 > INDEX.md5.gz
|
for i in *.apk; do
|
||||||
if which apk >/dev/null; then
|
if [ $i -nt APK_INDEX.gz ]; then
|
||||||
local deps
|
indexupdate=1
|
||||||
for i in $deprepo; do
|
break;
|
||||||
deps="--repo $repodir/$i"
|
fi
|
||||||
done
|
done
|
||||||
apk $deps index *.apk | gzip -9 > APK_INDEX.gz
|
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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user