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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/usr/bin/gawk -f
#
# Copyright (C) 2011 by Michael Olbrich <m.olbrich@pengutronix.de>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#
BEGIN {
FS = ":"
report_dir = ENVIRON["ptx_report_dir"]
}
$1 == "DEP" {
pkg=$2
sub($1":"$2":", "")
pkg_deps[pkg] = $0
}
$1 == "LICENSE" {
# add newline after each second license
gsub("[^,]*,[^,]*,", "&\\\\ ", $4);
gsub("_", "\\_", $4);
licenses[$2] = $4
raw_names[$2] = $3
gsub("_", "\\_", $3);
gsub("^host-", "", $3);
gsub("^cross-", "", $3);
names[$2] = $3
license_type[$2] = $5
}
function make_more_dot(pkg, file, level, deps, i) {
if (level > 3)
return
printf "\"%s\" [ shape=box style=\"rounded corners\" fixedsize=false texlbl=\"\\small\\begin{tabular}{c}{\\Large\\hyperref[%s]{%s}}\\\\%s\\end{tabular}\" ];\n", pkg, raw_names[pkg], gensub("_", "\\_", "g", names[pkg]), licenses[pkg] > file
if (!(pkg in pkg_deps))
return
split(pkg_deps[pkg], deps, ":")
for (i in deps) {
if (deps[i] == "")
continue
if (names[deps[i]] == "")
continue
if (pkg deps[i] in hit_deps)
continue
hit_deps[pkg deps[i]] = 1
printf "\"%s\" -> \"%s\"[dir=back];\n", pkg, deps[i] > file
make_more_dot(deps[i], file, level + 1)
}
}
function make_dot(pkg) {
file = report_dir"/"license_type[pkg]"/"raw_names[pkg]"/graph.dot"
delete hit_deps
printf "digraph \"%s\" {\n", pkg > file
printf "rankdir=LR;\n" > file
printf "ratio=compress;\n" > file
printf "nodesep=0.1;\n" > file
printf "ranksep=0.1;\n" > file
printf "node [ shape=point fixedsize=true width=0.1 ];\n", pkg > file
make_more_dot(pkg, file, 0)
printf "}\n" > file
close(file)
}
END {
for (pkg in licenses) {
make_dot(pkg)
}
}
|