aboutsummaryrefslogtreecommitdiff
path: root/helper.sh
diff options
context:
space:
mode:
authorW. Kosior <koszko@koszko.org>2025-09-19 12:47:44 +0200
committerW. Kosior <koszko@koszko.org>2025-09-19 13:09:45 +0200
commit7000b1f2bb2fca5b7707c9b1a9f58f43100212d3 (patch)
treecc5531b93b8e76c39e3c58d52574f68e86c3f05e /helper.sh
downloadAGH-msc-thesis-magister.tar.gz
AGH-msc-thesis-magister.zip
Initial commit.HEADmagister
Diffstat (limited to 'helper.sh')
-rwxr-xr-xhelper.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/helper.sh b/helper.sh
new file mode 100755
index 0000000..6d0f12e
--- /dev/null
+++ b/helper.sh
@@ -0,0 +1,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