diff options
Diffstat (limited to 'compute-unflattened-multiver-counts.sh')
-rwxr-xr-x | compute-unflattened-multiver-counts.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/compute-unflattened-multiver-counts.sh b/compute-unflattened-multiver-counts.sh new file mode 100755 index 0000000..03b253a --- /dev/null +++ b/compute-unflattened-multiver-counts.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +## SPDX-License-Identifier: CC0-1.0 +## +## Copyright (C) 2025 Woj. Kosior <koszko@koszko.org> + +set -e + +TREE_SIZES_PATH="$1" + +if [ "$2" = "--omit-packages-with-breaking-changes" ]; then + BAD_ROW_REG=',1$' +else + BAD_ROW_REG=',$' # never matched +fi + +printf 'MULTIVER-COUNT,' +printf 'ALL-PACKAGES,IN-DEBIAN-PACKAGES,' +printf 'ALL-PACKAGES-NO-BC,IN-DEBIAN-PACKAGES-NO-BC\n' + +./helper.sh --get-csv-columns "$TREE_SIZES_PATH" \ + IN-DEBIAN TREE-FLAT-MULTIVER BREAKING-CHANGES | + grep -vE "$BAD_ROW_REG" | awk -F , ' + /^[0-9]/ { + counts[$2]++; + if ($1 > 0) { + debian_counts[$2]++; + } + } + END { + for (key in counts) { + printf "%d,%d,%d\n", key, counts[key], debian_counts[key]; + } + } + ' |