From 140d6612545d9512824dc0914bdc97dcd627190e Mon Sep 17 00:00:00 2001 From: rand00 Date: Mon, 21 Mar 2022 13:51:23 +0100 Subject: [PATCH 1/2] packaging/visualizations.sh: Made compatible with Linux too --- packaging/visualizations.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/packaging/visualizations.sh b/packaging/visualizations.sh index 8f7c057..f57e3ec 100755 --- a/packaging/visualizations.sh +++ b/packaging/visualizations.sh @@ -78,8 +78,17 @@ FILENAME="${1}" CACHE_DIR="${CACHE}/${UUID}" BUILDER_VIZ="builder-viz" -TMPTREE=$(mktemp -t treevis) -TMPOPAM=$(mktemp -t opamvis) +mktemp_aux () { + if [ "$(uname)" = "Linux" ]; then + mktemp -t "$1.XXX" + elif [ "$(uname)" = "FreeBSD" ]; then + mktemp -t "$1" + else + mktemp -t "$1.XXX" #< todo what to choose here + fi +} +TMPTREE=$(mktemp_aux treeviz) +TMPOPAM=$(mktemp_aux opamviz) cleanup () { rm -rf "${TMPTREE}" "${TMPOPAM}" } @@ -94,7 +103,17 @@ else fi fi -SIZE="$(stat -f "%z" ${FILENAME})" +stat_aux () { + if [ "$(uname)" = "Linux" ]; then + stat -c "%s" "$1" + elif [ "$(uname)" = "FreeBSD" ]; then + stat -f "%z" "$1" + else + stat -c "%s" "$1" #< todo what to choose here + fi +} + +SIZE="$(stat_aux ${FILENAME})" if [ ! -z "${DEBUG}" ]; then if [ -e "${CACHE_DIR}.treemap.html" ]; then From 9a8f902d3ca78e4e99174d31716100300143d108 Mon Sep 17 00:00:00 2001 From: rand00 Date: Wed, 23 Mar 2022 20:54:35 +0100 Subject: [PATCH 2/2] packaging/visualizations.sh: Failing when unsupported platform --- packaging/visualizations.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/visualizations.sh b/packaging/visualizations.sh index f57e3ec..5e5d9a5 100755 --- a/packaging/visualizations.sh +++ b/packaging/visualizations.sh @@ -84,7 +84,7 @@ mktemp_aux () { elif [ "$(uname)" = "FreeBSD" ]; then mktemp -t "$1" else - mktemp -t "$1.XXX" #< todo what to choose here + echo 'Unsupported platform'; exit 1 fi } TMPTREE=$(mktemp_aux treeviz) @@ -109,7 +109,7 @@ stat_aux () { elif [ "$(uname)" = "FreeBSD" ]; then stat -f "%z" "$1" else - stat -c "%s" "$1" #< todo what to choose here + echo 'Unsupported platform'; exit 1 fi }