pkg-stats
10.2 KB
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
#!/usr/bin/env bash
# Copyright (C) 2009 by Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# This script generates an HTML file that contains a report about all
# Buildroot packages, their usage of the different package
# infrastructure and possible cleanup actions
#
# Run the script from the Buildroot toplevel directory:
#
# ./support/scripts/pkg-stats > /tmp/pkg.html
#
echo "<head>
<style type=\"text/css\">
table {
width: 100%;
}
td {
border: 1px solid black;
}
td.centered {
text-align: center;
}
td.wrong {
background: #ff9a69;
}
td.correct {
background: #d2ffc4;
}
td.nopatches {
background: #d2ffc4;
}
td.somepatches {
background: #ffd870;
}
td.lotsofpatches {
background: #ff9a69;
}
</style>
<title>Statistics of Buildroot packages</title>
</head>
<a href=\"#results\">Results</a><br/>
<table>
<tr>
<td>Id</td>
<td>Package</td>
<td class=\"centered\">Patch count</td>
<td class=\"centered\">Infrastructure</td>
<td class=\"centered\">License</td>
<td class=\"centered\">License files</td>
<td class=\"centered\">Hash file</td>
</tr>
"
autotools_packages=0
cmake_packages=0
kconfig_packages=0
luarocks_package=0
perl_packages=0
python_packages=0
rebar_packages=0
virtual_packages=0
generic_packages=0
manual_packages=0
packages_with_licence=0
packages_without_licence=0
packages_with_license_files=0
packages_without_license_files=0
packages_with_hash_file=0
packages_without_hash_file=0
total_patch_count=0
cnt=0
for i in $(find boot/ linux/ package/ -name '*.mk' | sort) ; do
if test \
$i = "boot/common.mk" -o \
$i = "linux/linux-ext-fbtft.mk" -o \
$i = "linux/linux-ext-xenomai.mk" -o \
$i = "linux/linux-ext-rtai.mk" -o \
$i = "package/freescale-imx/freescale-imx.mk" -o \
$i = "package/gcc/gcc.mk" -o \
$i = "package/gstreamer/gstreamer.mk" -o \
$i = "package/gstreamer1/gstreamer1.mk" -o \
$i = "package/gtk2-themes/gtk2-themes.mk" -o \
$i = "package/matchbox/matchbox.mk" -o \
$i = "package/opengl/opengl.mk" -o \
$i = "package/qt5/qt5.mk" -o \
$i = "package/x11r7/x11r7.mk" -o \
$i = "package/doc-asciidoc.mk" -o \
$i = "package/pkg-autotools.mk" -o \
$i = "package/pkg-cmake.mk" -o \
$i = "package/pkg-kconfig.mk" -o \
$i = "package/pkg-luarocks.mk" -o \
$i = "package/pkg-perl.mk" -o \
$i = "package/pkg-python.mk" -o \
$i = "package/pkg-rebar.mk" -o \
$i = "package/pkg-virtual.mk" -o \
$i = "package/pkg-download.mk" -o \
$i = "package/pkg-generic.mk" -o \
$i = "package/pkg-utils.mk" ; then
echo "skipping $i" 1>&2
continue
fi
cnt=$((cnt+1))
hashost=0
hastarget=0
infratype=""
# Determine package infrastructure
if grep -E "\(host-autotools-package\)" $i > /dev/null ; then
infratype="autotools"
hashost=1
fi
if grep -E "\(autotools-package\)" $i > /dev/null ; then
infratype="autotools"
hastarget=1
fi
if grep -E "\(kconfig-package\)" $i > /dev/null ; then
infratype="kconfig"
hastarget=1
fi
if grep -E "\(host-luarocks-package\)" $i > /dev/null ; then
infratype="luarocks"
hashost=1
fi
if grep -E "\(luarocks-package\)" $i > /dev/null ; then
infratype="luarocks"
hastarget=1
fi
if grep -E "\(host-perl-package\)" $i > /dev/null ; then
infratype="perl"
hashost=1
fi
if grep -E "\(perl-package\)" $i > /dev/null ; then
infratype="perl"
hastarget=1
fi
if grep -E "\(host-python-package\)" $i > /dev/null ; then
infratype="python"
hashost=1
fi
if grep -E "\(python-package\)" $i > /dev/null ; then
infratype="python"
hastarget=1
fi
if grep -E "\(host-rebar-package\)" $i > /dev/null ; then
infratype="rebar"
hashost=1
fi
if grep -E "\(rebar-package\)" $i > /dev/null ; then
infratype="rebar"
hastarget=1
fi
if grep -E "\(host-virtual-package\)" $i > /dev/null ; then
infratype="virtual"
hashost=1
fi
if grep -E "\(virtual-package\)" $i > /dev/null ; then
infratype="virtual"
hastarget=1
fi
if grep -E "\(host-generic-package\)" $i > /dev/null ; then
infratype="generic"
hashost=1
fi
if grep -E "\(generic-package\)" $i > /dev/null ; then
infratype="generic"
hastarget=1
fi
if grep -E "\(host-cmake-package\)" $i > /dev/null ; then
infratype="cmake"
hashost=1
fi
if grep -E "\(cmake-package\)" $i > /dev/null ; then
infratype="cmake"
hastarget=1
fi
pkg=$(basename $i)
dir=$(dirname $i)
pkg=${pkg%.mk}
pkgvariable=$(echo ${pkg} | tr "a-z-" "A-Z_")
# Count packages per infrastructure
if [ -z ${infratype} ] ; then
infratype="manual"
manual_packages=$(($manual_packages+1))
elif [ ${infratype} = "autotools" ]; then
autotools_packages=$(($autotools_packages+1))
elif [ ${infratype} = "cmake" ]; then
cmake_packages=$(($cmake_packages+1))
elif [ ${infratype} = "kconfig" ]; then
kconfig_packages=$(($kconfig_packages+1))
elif [ ${infratype} = "luarocks" ]; then
luarocks_packages=$(($luarocks_packages+1))
elif [ ${infratype} = "perl" ]; then
perl_packages=$(($perl_packages+1))
elif [ ${infratype} = "python" ]; then
python_packages=$(($python_packages+1))
elif [ ${infratype} = "rebar" ]; then
rebar_packages=$(($rebar_packages+1))
elif [ ${infratype} = "virtual" ]; then
virtual_packages=$(($virtual_packages+1))
elif [ ${infratype} = "generic" ]; then
generic_packages=$(($generic_packages+1))
fi
if grep -qE "^${pkgvariable}_LICENSE[ ]*=" $i ; then
packages_with_license=$(($packages_with_license+1))
license=1
else
packages_without_license=$(($packages_without_license+1))
license=0
fi
if grep -qE "^${pkgvariable}_LICENSE_FILES[ ]*=" $i ; then
packages_with_license_files=$(($packages_with_license_files+1))
license_files=1
else
packages_without_license_files=$(($packages_without_license_files+1))
license_files=0
fi
if test -f ${dir}/${pkg}.hash; then
packages_with_hash_file=$(($packages_with_hash_file+1))
hash_file=1
else
packages_without_hash_file=$(($packages_without_hash_file+1))
hash_file=0
fi
echo "<tr>"
echo "<td>$cnt</td>"
echo "<td>$i</td>"
package_dir=$(dirname $i)
patch_count=$(find ${package_dir} -name '*.patch' | wc -l)
total_patch_count=$(($total_patch_count+$patch_count))
if test $patch_count -lt 1 ; then
patch_count_class="nopatches"
elif test $patch_count -lt 5 ; then
patch_count_class="somepatches"
else
patch_count_class="lotsofpatches"
fi
echo "<td class=\"centered ${patch_count_class}\">"
echo "<b>$patch_count</b>"
echo "</td>"
if [ ${infratype} = "manual" ] ; then
echo "<td class=\"centered wrong\"><b>manual</b></td>"
else
echo "<td class=\"centered correct\">"
echo "<b>${infratype}</b><br/>"
if [ ${hashost} -eq 1 -a ${hastarget} -eq 1 ]; then
echo "target + host"
elif [ ${hashost} -eq 1 ]; then
echo "host"
else
echo "target"
fi
echo "</td>"
fi
if [ ${license} -eq 0 ] ; then
echo "<td class=\"centered wrong\">No</td>"
else
echo "<td class=\"centered correct\">Yes</td>"
fi
if [ ${license_files} -eq 0 ] ; then
echo "<td class=\"centered wrong\">No</td>"
else
echo "<td class=\"centered correct\">Yes</td>"
fi
if [ ${hash_file} -eq 0 ] ; then
echo "<td class=\"centered wrong\">No</td>"
else
echo "<td class=\"centered correct\">Yes</td>"
fi
echo "</tr>"
done
echo "</table>"
echo "<a id="results"></a>"
echo "<table>"
echo "<tr>"
echo "<td>Packages using the <i>generic</i> infrastructure</td>"
echo "<td>$generic_packages</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages using the <i>cmake</i> infrastructure</td>"
echo "<td>$cmake_packages</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages using the <i>autotools</i> infrastructure</td>"
echo "<td>$autotools_packages</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages using the <i>luarocks</i> infrastructure</td>"
echo "<td>$luarocks_packages</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages using the <i>kconfig</i> infrastructure</td>"
echo "<td>$kconfig_packages</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages using the <i>perl</i> infrastructure</td>"
echo "<td>$perl_packages</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages using the <i>python</i> infrastructure</td>"
echo "<td>$python_packages</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages using the <i>rebar</i> infrastructure</td>"
echo "<td>$rebar_packages</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages using the <i>virtual</i> infrastructure</td>"
echo "<td>$virtual_packages</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages not using any infrastructure</td>"
echo "<td>$manual_packages</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages having license information</td>"
echo "<td>$packages_with_license</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages not having licence information</td>"
echo "<td>$packages_without_license</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages having license files information</td>"
echo "<td>$packages_with_license_files</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages not having licence files information</td>"
echo "<td>$packages_without_license_files</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages having hash file</td>"
echo "<td>$packages_with_hash_file</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Packages not having hash file</td>"
echo "<td>$packages_without_hash_file</td>"
echo "</tr>"
echo "<tr>"
echo "<td>Number of patches in all packages</td>"
echo "<td>$total_patch_count</td>"
echo "</tr>"
echo "<tr>"
echo "<td>TOTAL</td>"
echo "<td>$cnt</td>"
echo "</tr>"
echo "</table>"
echo "<hr/>"
echo "<i>Updated on $(LANG=C date), Git commit $(git log master -n 1 --pretty=format:%H)</i>"
echo "</body>"
echo "</html>"