checkapk: calculate size difference of packages

This commit is contained in:
Sören Tempel 2020-04-09 13:26:55 +02:00 committed by Natanael Copa
parent 13993e014a
commit b3c1b65f75

View File

@ -72,6 +72,18 @@ for i in $pkgname $subpackages; do
die "the built package ($_pkgname) is already in the repo"
fi
# For our local repo (newsize) apk info might return multiple packages, e.g. if different
# version of the package where build previously. Filter out this specific pkgver using awk.
newsize=$(apk info --repositories-file /dev/null --repository "$REPODEST"/$repo --size $_pkgname | \
awk "/^$pkg/ { found = 1 } /^[0-9]+/ { if (found) { print \$0; exit } }")
oldsize=$(apk info --repositories-file $tmpdir/repositories --size $_pkgname | awk '/^[0-9]+/ { print $0 }' | head -1)
if [ "$oldsize" = "$newsize" ]; then
msg "No size differences for $_pkgname."
else
msg "Size difference for $_pkgname: $oldsize -> $newsize"
fi
apk fetch --quiet --repositories-file $tmpdir/repositories --stdout $_pkgname \
| tar -zt | grep -v '^\.SIGN\.' | sort > filelist-$_pkgname-old \
|| die "failed to download old pkg, maybe run 'apk update'?"