2009-10-28 00:28:40 +01:00
|
|
|
#!/bin/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:
|
|
|
|
#
|
2011-10-06 14:37:27 +02:00
|
|
|
# ./support/scripts/pkg-stats > /tmp/pkg.html
|
2009-10-28 00:28:40 +01:00
|
|
|
#
|
|
|
|
|
|
|
|
echo "<head>
|
|
|
|
<style type=\"text/css\">
|
|
|
|
table {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
td {
|
|
|
|
border: 1px solid black;
|
|
|
|
}
|
|
|
|
td.centered {
|
|
|
|
text-align: center;
|
|
|
|
}
|
2010-07-26 15:15:14 +02:00
|
|
|
tr.wrong td {
|
|
|
|
background: #ff9a69;
|
|
|
|
}
|
|
|
|
tr.correct td {
|
|
|
|
background: #d2ffc4;
|
|
|
|
}
|
2009-10-28 00:28:40 +01:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<a href=\"#results\">Results</a><br/>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td rowspan=\"2\">Id</td>
|
|
|
|
<td rowspan=\"2\">Package</td>
|
2011-02-28 22:09:20 +01:00
|
|
|
<td>Patch count</td>
|
2009-10-28 00:28:40 +01:00
|
|
|
<td colspan=\"2\" class=\"centered\">AUTOTARGETS</td>
|
|
|
|
<td colspan=\"2\" class=\"centered\">GENTARGETS</td>
|
2011-02-28 21:54:58 +01:00
|
|
|
<td colspan=\"2\" class=\"centered\">CMAKETARGETS</td>
|
2009-10-28 00:28:40 +01:00
|
|
|
<td colspan=\"2\" class=\"centered\">manual</td>
|
|
|
|
<td rowspan=\"2\" class=\"centered\">Actions</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class=\"centered\">host</td>
|
|
|
|
<td class=\"centered\">target</td>
|
|
|
|
<td class=\"centered\">host</td>
|
|
|
|
<td class=\"centered\">target</td>
|
|
|
|
<td class=\"centered\">host</td>
|
|
|
|
<td class=\"centered\">target</td>
|
2011-02-28 21:54:58 +01:00
|
|
|
<td class=\"centered\">host</td>
|
|
|
|
<td class=\"centered\">target</td>
|
2009-10-28 00:28:40 +01:00
|
|
|
</tr>"
|
|
|
|
|
|
|
|
convert_to_generic_target=0
|
|
|
|
convert_to_generic_host=0
|
2011-10-05 22:34:59 +02:00
|
|
|
convert_to_target_autotools=0
|
|
|
|
convert_to_host_autotools=0
|
2011-02-28 22:09:20 +01:00
|
|
|
total_patch_count=0
|
2011-10-05 18:47:54 +02:00
|
|
|
cnt=0
|
2009-10-28 00:28:40 +01:00
|
|
|
for i in $(find package/ -name '*.mk') ; do
|
|
|
|
|
2011-02-28 21:54:58 +01:00
|
|
|
if test \
|
2009-10-28 00:28:40 +01:00
|
|
|
$i = "package/java/java.mk" -o \
|
|
|
|
$i = "package/games/games.mk" -o \
|
2011-10-06 01:57:26 +02:00
|
|
|
$i = "package/gtk2-themes/gtk2-themes.mk" -o \
|
2010-03-14 17:52:32 +01:00
|
|
|
$i = "package/multimedia/multimedia.mk" -o \
|
2009-10-28 00:28:40 +01:00
|
|
|
$i = "package/customize/customize.mk" -o \
|
2011-02-28 21:54:58 +01:00
|
|
|
$i = "package/matchbox/matchbox.mk" -o \
|
2009-10-28 00:28:40 +01:00
|
|
|
$i = "package/x11r7/x11r7.mk" ; then
|
|
|
|
echo "skipping $i" 1>&2
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
cnt=$((cnt+1))
|
|
|
|
|
|
|
|
is_auto_host=0
|
|
|
|
is_auto_target=0
|
2011-02-28 21:54:58 +01:00
|
|
|
is_cmake_host=0
|
|
|
|
is_cmake_target=0
|
2009-10-28 00:28:40 +01:00
|
|
|
is_pkg_target=0
|
|
|
|
is_pkg_host=0
|
|
|
|
is_manual_target=0
|
|
|
|
is_manual_host=0
|
|
|
|
|
2011-10-05 01:10:40 +02:00
|
|
|
if grep -E "\(call AUTOTARGETS,host\)" $i > /dev/null ; then
|
2009-10-28 00:28:40 +01:00
|
|
|
is_auto_host=1
|
2010-07-26 15:15:14 +02:00
|
|
|
fi
|
|
|
|
|
2011-10-05 01:10:40 +02:00
|
|
|
if grep -E "\(call AUTOTARGETS\)" $i > /dev/null ; then
|
2010-07-26 15:15:14 +02:00
|
|
|
is_auto_target=1
|
|
|
|
fi
|
|
|
|
|
2011-10-05 01:10:40 +02:00
|
|
|
if grep -E "\(call GENTARGETS,host\)" $i > /dev/null ; then
|
2010-07-26 15:15:14 +02:00
|
|
|
is_pkg_host=1
|
|
|
|
fi
|
|
|
|
|
2011-10-05 01:10:40 +02:00
|
|
|
if grep -E "\(call GENTARGETS\)" $i > /dev/null ; then
|
2010-07-26 15:15:14 +02:00
|
|
|
is_pkg_target=1
|
|
|
|
fi
|
|
|
|
|
2011-10-05 01:10:40 +02:00
|
|
|
if grep -E "\(call CMAKETARGETS,host\)" $i > /dev/null ; then
|
2011-02-28 21:54:58 +01:00
|
|
|
is_cmake_host=1
|
|
|
|
fi
|
|
|
|
|
2011-10-05 01:10:40 +02:00
|
|
|
if grep -E "\(call CMAKETARGETS\)" $i > /dev/null ; then
|
2011-02-28 21:54:58 +01:00
|
|
|
is_cmake_target=1
|
|
|
|
fi
|
|
|
|
|
2010-07-26 15:15:14 +02:00
|
|
|
pkg=$(basename $i)
|
|
|
|
pkg=${pkg%.mk}
|
|
|
|
|
|
|
|
if grep "^host-$pkg:" $i > /dev/null ; then
|
|
|
|
is_manual_host=1
|
|
|
|
fi
|
|
|
|
|
2011-02-28 21:54:58 +01:00
|
|
|
if test $is_pkg_target -eq 0 -a $is_auto_target -eq 0 -a $is_cmake_target -eq 0; then
|
2010-07-26 15:15:14 +02:00
|
|
|
is_manual_target=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
tasks=""
|
|
|
|
|
|
|
|
if [ $is_manual_target -eq 1 ] ; then
|
|
|
|
if grep "/configure" $i > /dev/null ; then
|
|
|
|
tasks=$tasks"<li>convert package to autotools ?</li>"
|
|
|
|
convert_to_target_autotools=$((convert_to_target_autotools+1))
|
|
|
|
else
|
|
|
|
tasks=$tasks"<li>convert to generic target</li>"
|
|
|
|
convert_to_generic_target=$((convert_to_generic_target+1))
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $is_manual_host -eq 1 ]; then
|
|
|
|
if grep "/configure" $i > /dev/null ; then
|
|
|
|
tasks=$tasks"<li>convert package to autotools ?</li>"
|
|
|
|
convert_to_host_autotools=$((convert_to_host_autotools+1))
|
|
|
|
else
|
|
|
|
tasks=$tasks"<li>convert to generic host</li>"
|
|
|
|
convert_to_generic_host=$((convert_to_generic_host+1))
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$tasks" ; then
|
|
|
|
echo "<tr class=\"wrong\">"
|
|
|
|
else
|
|
|
|
echo "<tr class=\"correct\">"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "<td>$cnt</td>"
|
|
|
|
echo "<td>$i</td>"
|
|
|
|
|
2011-02-28 22:09:20 +01:00
|
|
|
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_color="#00ff00"
|
|
|
|
elif test $patch_count -lt 5 ; then
|
|
|
|
patch_count_color="#ffc600"
|
|
|
|
else
|
|
|
|
patch_count_color="#ff0000"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "<td class=\"centered\" style=\"color: $patch_count_color; font-weight: bold;\">"
|
|
|
|
echo $patch_count
|
|
|
|
echo "</td>"
|
|
|
|
|
2010-07-26 15:15:14 +02:00
|
|
|
echo "<td class=\"centered\">"
|
|
|
|
if [ $is_auto_host -eq 1 ] ; then
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "<b>YES</b>"
|
|
|
|
else
|
|
|
|
echo "NO"
|
|
|
|
fi
|
2010-07-26 15:15:14 +02:00
|
|
|
echo "</td>"
|
2009-10-28 00:28:40 +01:00
|
|
|
|
|
|
|
echo "<td class=\"centered\">"
|
2010-07-26 15:15:14 +02:00
|
|
|
if [ $is_auto_target -eq 1 ] ; then
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "<b>YES</b>"
|
|
|
|
else
|
|
|
|
echo "NO"
|
|
|
|
fi
|
|
|
|
echo "</td>"
|
|
|
|
|
|
|
|
echo "<td class=\"centered\">"
|
2010-07-26 15:15:14 +02:00
|
|
|
if [ $is_pkg_host -eq 1 ] ; then
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "<b>YES</b>"
|
|
|
|
else
|
|
|
|
echo "NO"
|
|
|
|
fi
|
|
|
|
echo "</td>"
|
|
|
|
|
|
|
|
echo "<td class=\"centered\">"
|
2010-07-26 15:15:14 +02:00
|
|
|
if [ $is_pkg_target -eq 1 ] ; then
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "<b>YES</b>"
|
|
|
|
else
|
|
|
|
echo "NO"
|
2011-02-28 21:54:58 +01:00
|
|
|
fi
|
|
|
|
echo "</td>"
|
|
|
|
|
|
|
|
echo "<td class=\"centered\">"
|
|
|
|
if [ $is_cmake_host -eq 1 ] ; then
|
|
|
|
echo "<b>YES</b>"
|
|
|
|
else
|
|
|
|
echo "NO"
|
|
|
|
fi
|
|
|
|
echo "</td>"
|
|
|
|
|
|
|
|
echo "<td class=\"centered\">"
|
|
|
|
if [ $is_cmake_target -eq 1 ] ; then
|
|
|
|
echo "<b>YES</b>"
|
|
|
|
else
|
|
|
|
echo "NO"
|
2009-10-28 00:28:40 +01:00
|
|
|
fi
|
|
|
|
echo "</td>"
|
|
|
|
|
|
|
|
echo "<td class=\"centered\">"
|
2010-07-26 15:15:14 +02:00
|
|
|
if [ $is_manual_host -eq 1 ] ; then
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "<b>YES</b>"
|
|
|
|
else
|
|
|
|
echo "NO"
|
|
|
|
fi
|
|
|
|
echo "</td>"
|
|
|
|
|
|
|
|
echo "<td class=\"centered\">"
|
2010-07-26 15:15:14 +02:00
|
|
|
if [ $is_manual_target -eq 1 ] ; then
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "<b>YES</b>"
|
|
|
|
else
|
|
|
|
echo "NO"
|
|
|
|
fi
|
|
|
|
echo "</td>"
|
|
|
|
|
|
|
|
echo "<td>"
|
|
|
|
echo "<ul>"
|
2010-07-26 15:15:14 +02:00
|
|
|
echo $tasks
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "</ul>"
|
|
|
|
echo "</td>"
|
|
|
|
|
|
|
|
echo "</tr>"
|
|
|
|
|
|
|
|
done
|
|
|
|
echo "</table>"
|
|
|
|
|
|
|
|
echo "<table>"
|
|
|
|
echo "<tr>"
|
|
|
|
echo "<td>Packages to convert to generic target</td>"
|
|
|
|
echo "<td>$convert_to_generic_target</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
echo "<tr>"
|
|
|
|
echo "<td>Packages to convert to generic host</td>"
|
|
|
|
echo "<td>$convert_to_generic_host</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
echo "<tr>"
|
2010-07-26 15:15:14 +02:00
|
|
|
echo "<td>Packages to convert to target autotools</td>"
|
|
|
|
echo "<td>$convert_to_target_autotools</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
echo "<tr>"
|
|
|
|
echo "<td>Packages to convert to host autotools</td>"
|
|
|
|
echo "<td>$convert_to_host_autotools</td>"
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "</tr>"
|
|
|
|
echo "<tr>"
|
2011-02-28 22:09:20 +01:00
|
|
|
echo "<td>Number of patches in all packages</td>"
|
|
|
|
echo "<td>$total_patch_count</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
echo "<tr>"
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "<td>TOTAL</td>"
|
|
|
|
echo "<td>$cnt</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
echo "</table>"
|