From d9f3f05b500ddd705b48e6d23a1817ef187954e1 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 26 Jul 2024 17:11:34 +0900 Subject: [PATCH] checkapk: fix size difference output when multiple info matches I rebuilt networkmanager locally and was greeted with this: >>> Size difference for networkmanager: 16 MiB -> 2772 KiB It turns out networkmanager-elogind provides networkmanager so apk info will list both, and the former is much bigger so it looked like the rebuilt package was much smaller when there was almost no difference (as expected) Fix by matching on exact package name for both lines; this is already what we were doing with the local package anyway and the apk fetch correctly picks the correct package in this case --- checkapk.in | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/checkapk.in b/checkapk.in index a600489..dab0dcb 100644 --- a/checkapk.in +++ b/checkapk.in @@ -98,16 +98,15 @@ 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 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: + # apk info could return multiple lines if multiple packages share a provide + # (e.g. dnsmasq); filter with the exact package name and 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 | \ + grep -F "$oldpkg" -A1 | \ tail -n1)" if [ "$oldsize" = "$newsize" ]; then