Merge branch 'main' into 20220325_viz_descriptions

This commit is contained in:
rand 2022-03-30 10:26:00 +00:00
commit 258ffbd979
3 changed files with 33 additions and 9 deletions

View file

@ -72,19 +72,22 @@ let print_treemap_html elf_path elf_size =
* |> Fmt.to_to_string (Tyxml.Svg.pp ()) *) * |> Fmt.to_to_string (Tyxml.Svg.pp ()) *)
let print_dependencies_html file = let print_dependencies_html file =
let open Opam_graph in let module G = Opam_graph in
let switch = read_file file in let switch = read_file file in
let data = OpamFile.SwitchExport.read_from_string switch in let data = OpamFile.SwitchExport.read_from_string switch in
let transitive = false in let graph = G.Ui.dependencies ~transitive:false data in
let graph = Ui.dependencies ~transitive data in let sharing_stats =
data
|> G.dependencies ~transitive:false
|> G.calc_sharing_stats in
let override_css = {| let override_css = {|
.deps-svg-wrap { .deps-svg-wrap {
background: rgb(60, 60, 87); background: rgb(60, 60, 87);
} }
|} |}
in in
let html = Render.Html.of_assoc ~override_css graph in let html = G.Render.Html.of_assoc ~override_css ~sharing_stats graph in
Format.printf "%a" Render.Html.pp html Format.printf "%a" G.Render.Html.pp html
module Cmd_aux = struct module Cmd_aux = struct

View file

@ -618,6 +618,7 @@ module Job_build = struct
~next ~next
let viz_style_deps = " let viz_style_deps = "
border: 0;
width: 45em; width: 45em;
height: 45.4em; height: 45.4em;
max-width: 100%; max-width: 100%;
@ -627,8 +628,9 @@ module Job_build = struct
" "
let viz_style_treemap = " let viz_style_treemap = "
border: 0;
width: 46em; width: 46em;
height: 48.4em; height: 49.4em;
max-width: 100%; max-width: 100%;
max-height: 52vw; max-height: 52vw;
min-width: 38em; min-width: 38em;

View file

@ -78,8 +78,17 @@ FILENAME="${1}"
CACHE_DIR="${CACHE}/${UUID}" CACHE_DIR="${CACHE}/${UUID}"
BUILDER_VIZ="builder-viz" BUILDER_VIZ="builder-viz"
TMPTREE=$(mktemp -t treevis) mktemp_aux () {
TMPOPAM=$(mktemp -t opamvis) if [ "$(uname)" = "Linux" ]; then
mktemp -t "$1.XXX"
elif [ "$(uname)" = "FreeBSD" ]; then
mktemp -t "$1"
else
echo 'Unsupported platform'; exit 1
fi
}
TMPTREE=$(mktemp_aux treeviz)
TMPOPAM=$(mktemp_aux opamviz)
cleanup () { cleanup () {
rm -rf "${TMPTREE}" "${TMPOPAM}" rm -rf "${TMPTREE}" "${TMPOPAM}"
} }
@ -94,7 +103,17 @@ else
fi fi
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
echo 'Unsupported platform'; exit 1
fi
}
SIZE="$(stat_aux ${FILENAME})"
if [ ! -z "${DEBUG}" ]; then if [ ! -z "${DEBUG}" ]; then
if [ -e "${CACHE_DIR}.treemap.html" ]; then if [ -e "${CACHE_DIR}.treemap.html" ]; then