From 34a8bf91605a003c7de539f77802a7503c192134 Mon Sep 17 00:00:00 2001 From: rand00 Date: Thu, 17 Mar 2022 16:31:07 +0100 Subject: [PATCH 1/6] Builder-viz: Passing transitive deps stats for coloring of nodes in opam-graph --- bin/visualizations/builder_viz.ml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/visualizations/builder_viz.ml b/bin/visualizations/builder_viz.ml index fcb11e3..ea30406 100644 --- a/bin/visualizations/builder_viz.ml +++ b/bin/visualizations/builder_viz.ml @@ -72,19 +72,23 @@ let print_treemap_html elf_path elf_size = * |> Fmt.to_to_string (Tyxml.Svg.pp ()) *) let print_dependencies_html file = - let open Opam_graph in + let module G = Opam_graph in let switch = read_file file in let data = OpamFile.SwitchExport.read_from_string switch in let transitive = false in - let graph = Ui.dependencies ~transitive data in + let graph = G.Ui.dependencies ~transitive data in + let sharing_stats = + data + |> G.dependencies ~transitive:true + |> G.calc_sharing_stats in let override_css = {| .deps-svg-wrap { background: rgb(60, 60, 87); } |} in - let html = Render.Html.of_assoc ~override_css graph in - Format.printf "%a" Render.Html.pp html + let html = G.Render.Html.of_assoc ~override_css ~sharing_stats graph in + Format.printf "%a" G.Render.Html.pp html module Cmd_aux = struct From 462859f4fbd52097fe0b3c9b6385674eedd1f2c9 Mon Sep 17 00:00:00 2001 From: rand00 Date: Fri, 18 Mar 2022 13:16:26 +0100 Subject: [PATCH 2/6] Builder-viz: Changed sharing-stats to be based on direct deps instead of transitive --- bin/visualizations/builder_viz.ml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/visualizations/builder_viz.ml b/bin/visualizations/builder_viz.ml index ea30406..5219bd3 100644 --- a/bin/visualizations/builder_viz.ml +++ b/bin/visualizations/builder_viz.ml @@ -75,11 +75,10 @@ let print_dependencies_html file = let module G = Opam_graph in let switch = read_file file in let data = OpamFile.SwitchExport.read_from_string switch in - let transitive = false in - let graph = G.Ui.dependencies ~transitive data in + let graph = G.Ui.dependencies ~transitive:false data in let sharing_stats = data - |> G.dependencies ~transitive:true + |> G.dependencies ~transitive:false |> G.calc_sharing_stats in let override_css = {| .deps-svg-wrap { From 140d6612545d9512824dc0914bdc97dcd627190e Mon Sep 17 00:00:00 2001 From: rand00 Date: Mon, 21 Mar 2022 13:51:23 +0100 Subject: [PATCH 3/6] 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 d90cbea35c5b1b9fc16e21a19a212541ef315e7f Mon Sep 17 00:00:00 2001 From: rand00 Date: Wed, 23 Mar 2022 20:38:22 +0100 Subject: [PATCH 4/6] Views: Removed visual border from viz iframes + size fix --- lib/views.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/views.ml b/lib/views.ml index 4810936..dd04ad4 100644 --- a/lib/views.ml +++ b/lib/views.ml @@ -618,6 +618,7 @@ module Job_build = struct ~next let viz_style_deps = " + border: 0; width: 45em; height: 45.4em; max-width: 100%; @@ -627,8 +628,9 @@ module Job_build = struct " let viz_style_treemap = " + border: 0; width: 46em; - height: 48.4em; + height: 49.4em; max-width: 100%; max-height: 52vw; min-width: 38em; From 46f661ddd68f3cd4a2dea8a19dfd7b1ddfddf422 Mon Sep 17 00:00:00 2001 From: rand00 Date: Wed, 23 Mar 2022 20:46:41 +0100 Subject: [PATCH 5/6] packaging/visualizations.sh: Changed todo-comments --- packaging/visualizations.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/visualizations.sh b/packaging/visualizations.sh index f57e3ec..59daca4 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 + mktemp -t "$1.XXX" #< Defaulting to same as Linux 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 + stat -c "%s" "$1" #< Defaulting to same as Linux fi } From 9a8f902d3ca78e4e99174d31716100300143d108 Mon Sep 17 00:00:00 2001 From: rand00 Date: Wed, 23 Mar 2022 20:54:35 +0100 Subject: [PATCH 6/6] 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 }