mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-01-03 05:02:18 +00:00
checkapk: use grep instead of awk for size checking
the previous implementation had a bug that + chars needed escaping (which was fixed), and now has another discovered but that pkgnames could start with a number, so the /^pkg/ match matches the pkgname again and a size comparison gives you: >>> Size difference for 7zip: 7zip-22.01-r5 installed size: -> 7zip-23.01-r0 installed size: using grep -F avoids any magic character expansion and works correctly in all cases.
This commit is contained in:
parent
446b68359f
commit
21faeb7f47
15
checkapk.in
15
checkapk.in
@ -79,11 +79,16 @@ for i in $pkgname $subpackages; do
|
||||
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)
|
||||
# version of the package where built previously. However, for a repo only one of pkgname=pkgver-rpkgrel can exist.
|
||||
# Filter out this specific pkgver with grep, as it can have only one match, then take the second line:
|
||||
# 7zip-23.01-r0 installed size:
|
||||
# 1668 KiB
|
||||
newsize="$(apk info --repositories-file /dev/null --repository "$REPODEST"/$repo --size $_pkgname | \
|
||||
grep -F "$pkg" -A1 | \
|
||||
tail -n1)"
|
||||
oldsize="$(apk info --repositories-file "$tmpdir"/repositories --size "$_pkgname" | \
|
||||
grep -F "$_pkgname" -A1 | \
|
||||
tail -n1)"
|
||||
|
||||
if [ "$oldsize" = "$newsize" ]; then
|
||||
msg "No size differences for $_pkgname."
|
||||
|
Loading…
Reference in New Issue
Block a user