This repository has been archived by the owner on Sep 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
reports.sh
executable file
·174 lines (156 loc) · 5.17 KB
/
reports.sh
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/bin/sh
source ./config.sh
arches=$(cat arches.txt)
base="$topdir/modules"
echo ""
echo "Visualizing dependencies between modules..."
mkdir -p "$topdir/img"
> "$topdir/img/module-deps.dot"
echo "digraph G {" >> "$topdir/img/module-deps.dot"
echo " node [fontname=monospace];" >> "$topdir/img/module-deps.dot"
for module in $(ls "$topdir/modules"); do
for dep in $(cat "$topdir/modules/$module/modular-deps.txt"); do
echo " \"$module\" -> \"$dep\" [color=\"#009900\"];" >> "$topdir/img/module-deps.dot"
done
for dep in $(cat "$topdir/modules/$module/modular-build-deps.txt"); do
echo " \"$module\" -> \"$dep\" [color=\"#aa0000\"];" >> "$topdir/img/module-deps.dot"
done
done
echo "}" >> "$topdir/img/module-deps.dot"
dot -Tpng "$topdir/img/module-deps.dot" > "$topdir/img/module-deps.png"
echo ""
echo "Generating combined arch lists..."
files="
runtime-binary-packages-short.txt
runtime-source-packages-short.txt
buildtime-binary-packages-short.txt
buildtime-source-packages-short.txt
runtime-source-packages-full.txt
toplevel-binary-packages.txt"
for file in $files; do
for module in $(ls "$topdir/modules"); do
mkdir -p $base/$module/all
for arch in $arches; do
cat $base/$module/$arch/$file
done \
| sort -u \
> $base/$module/all/$file
done
done
echo ""
echo "Generating reports in README for each module..."
for module in $(ls "$topdir/modules"); do
{
cat << EOF
# $module
This is a dependency report for the $module module.
An initial [modulemd file]($module.yaml) has been generated. It is experimental and probably unusable at this point.
## Dependencies
These are modules identified as dependencies.
### Runtime
This list might not be complete. There might be other packages in the *Binary RPM packages (all arches combined)* section that needs to be split to different modules.
EOF
for dep in $(cat "$topdir/modules/$module/modular-deps.txt"); do
echo "* [$dep](../$dep)"
done
cat << EOF
### Build
This list might not be complete.
Please see the **missing RPM build dependencies ([source](all/buildtime-source-packages-short.txt) or [binary](all/buildtime-binary-packages-short.txt)) lists** for more information.
EOF
for dep in $(cat "$topdir/modules/$module/modular-build-deps.txt"); do
echo "* [$dep](../$dep)"
done
cat << EOF
## Binary RPM packages
These are RPM dependencies of the [$module top-level package set]($module.csv). They should be either:
* split into other modules and be used as modular dependencies
* included in this $module module
### Packages
EOF
printf "| |"
for arch in $(cat arches.txt); do
printf "$arch |"
done
printf "\n"
printf "%s" "|---|"
for arch in $(cat arches.txt); do
printf "%s" "---|"
done
printf "\n"
for pkg in $(cat "$topdir/modules/$module/all/runtime-binary-packages-short.txt"); do
printf "| \`$pkg\` |"
for arch in $(cat arches.txt); do
cat "$topdir/modules/$module/$arch/runtime-binary-packages-short.txt" | grep "^$pkg$" > /dev/null
if [ $? -eq 0 ]; then
printf " X |"
else
printf " - |"
fi
done
printf "\n"
done
} > "$topdir/modules/$module/README.md"
done
echo ""
echo "Generating modulemd files..."
modulemd_modules=$(ls "$topdir/modules" \
| sed \
-e "s/^bootstrap$//g" \
-e "s/^platform$//g")
for module in $modulemd_modules; do
{
cat << EOF
document: modulemd
version: 1
data:
summary: $module module
description: This $module module has been generated.
license:
module:
- MIT
dependencies:
buildrequires:
EOF
for dep in $(cat "$topdir/modules/$module/modular-build-deps.txt"); do
echo " $dep: $buildrequires_ref"
done
cat << EOF
requires:
EOF
for dep in $(cat "$topdir/modules/$module/modular-deps.txt"); do
echo " $dep: $requires_ref"
done
cat << EOF
references:
community: https://docs.pagure.org/modularity/
documentation: https://github.com/modularity-modules/$module
tracker: https://github.com/modularity-modules/$module
api:
rpms:
EOF
for pkg in $(cat "$topdir/modules/$module/all/toplevel-binary-packages.txt"); do
echo " - $pkg"
done
cat << EOF
profiles:
default:
description: A generated profile based on top-lvl package list.
rpms:
EOF
for pkg in $(cat "$topdir/modules/$module/all/toplevel-binary-packages.txt"); do
echo " - $pkg"
done
cat << EOF
components:
rpms:
EOF
for pkg in $(cat "$topdir/modules/$module/all/runtime-source-packages-short.txt"); do
cat << EOF
$pkg:
rationale: Generated.
ref: $components_ref
EOF
done
} > "$topdir/modules/$module/$module.yaml"
done