scripts: size_compare: print a grand total

Usefull to check the impact of treewide changes:
Change 	Local	Remote 	Package
+281	6191	5910	ubus
-547	56166	56713	procd
-13294	91544	104838	ubi-utils
~~~~~~~	total change	-13560

Signed-off-by: Andre Heider <a.heider@gmail.com>
This commit is contained in:
Andre Heider 2023-01-31 15:58:08 +01:00 committed by Paul Spooren
parent 21242451c2
commit 19988b66d0

View File

@ -75,6 +75,7 @@ package_size () {
} }
compare_sizes () { compare_sizes () {
TOTAL_DIFF="0"
for PACKAGE in $PACKAGES; do for PACKAGE in $PACKAGES; do
if [ "$PACKAGE" = "libc" ]; then if [ "$PACKAGE" = "libc" ]; then
continue continue
@ -92,7 +93,8 @@ compare_sizes () {
SIZE_LOCAL=$(tar tzvf "$PACKAGE_FILE" ./data.tar.gz | awk '{ print $3 }') SIZE_LOCAL=$(tar tzvf "$PACKAGE_FILE" ./data.tar.gz | awk '{ print $3 }')
fi fi
SIZE_UPSTREAM=$(package_size "$TMP_INDEX" "$PACKAGE") SIZE_UPSTREAM=$(package_size "$TMP_INDEX" "$PACKAGE")
SIZE_DIFF="$((SIZE_LOCAL-SIZE_UPSTREAM))" SIZE_DIFF="$((SIZE_LOCAL - SIZE_UPSTREAM))"
TOTAL_DIFF="$((TOTAL_DIFF + SIZE_DIFF))"
if [ "$SIZE_DIFF" -gt 0 ]; then if [ "$SIZE_DIFF" -gt 0 ]; then
SIZE_DIFF="+$SIZE_DIFF" SIZE_DIFF="+$SIZE_DIFF"
fi fi
@ -102,6 +104,7 @@ compare_sizes () {
echo "$PACKAGE is missing upstream" echo "$PACKAGE is missing upstream"
fi fi
done done
echo "~~~~~~~ total change ${TOTAL_DIFF}"
} }
if [ "$1" = "-h" ]; then if [ "$1" = "-h" ]; then