blob: 6d0f12e39f12b501fcd7386a10bfaa8b4767f790 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/sh
## SPDX-License-Identifier: CC0-1.0
##
## Copyright (C) 2025 Woj. Kosior <koszko@koszko.org>
set -e
DESCRIPTION_SED_SCRIPT='
s/TREE$/Vanilla dependency tree/;
s/TREE-MIN/Unnecessary direct dependencies removed/;
s/TREE-DUMMY/Unnecessary dependencies dummified/;
s/TREE-FLAT/Conflicts removed where possible/;
'
if [ "$1" = "--get-measure-types" ]; then
printf %s "VERS DEPS MULTIVER"
elif [ "$1" = "--get-tree-kinds" ]; then
printf %s "$DESCRIPTION_SED_SCRIPT" | awk -F '[/$]' '{print $2}'
elif [ "$1" = "--make-tree-kind-description" ]; then
sed "$DESCRIPTION_SED_SCRIPT"
elif [ "$1" = "--get-csv-columns" ]; then
shift
RESULTS_PATH="$1"
shift
COL_REFS=""
SEP=""
while [ -n "$1" ]; do
HEAD_PART="$(head -1 "$RESULTS_PATH" | grep -Eo "^(.+,)?$1(,|\$)")"
COL_NUM=$(($(printf %s "$HEAD_PART" | grep -oE ',.' | wc -l) + 1))
COL_REFS="$COL_REFS$SEP \$$COL_NUM"
shift
SEP=' ","'
done
awk -F , "{print$COL_REFS;}" < "$RESULTS_PATH"
else
exit 1
fi
|