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;
|
|
|
|
}
|
2012-07-31 21:32:25 +02:00
|
|
|
td.wrong {
|
2010-07-26 15:15:14 +02:00
|
|
|
background: #ff9a69;
|
|
|
|
}
|
2012-07-31 21:32:25 +02:00
|
|
|
td.correct {
|
2010-07-26 15:15:14 +02:00
|
|
|
background: #d2ffc4;
|
|
|
|
}
|
2012-07-31 21:32:25 +02:00
|
|
|
td.nopatches {
|
|
|
|
background: #d2ffc4;
|
|
|
|
}
|
|
|
|
|
|
|
|
td.somepatches {
|
|
|
|
background: #ffd870;
|
|
|
|
}
|
|
|
|
|
|
|
|
td.lotsofpatches {
|
|
|
|
background: #ff9a69;
|
|
|
|
}
|
2009-10-28 00:28:40 +01:00
|
|
|
</style>
|
2012-07-31 21:32:25 +02:00
|
|
|
<title>Statistics of Buildroot packages</title>
|
2009-10-28 00:28:40 +01:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<a href=\"#results\">Results</a><br/>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<tr>
|
2012-07-31 21:32:25 +02:00
|
|
|
<td>Id</td>
|
|
|
|
<td>Package</td>
|
|
|
|
<td class=\"centered\">Patch count</td>
|
|
|
|
<td class=\"centered\">Infrastructure</td>
|
|
|
|
<td class=\"centered\">License</td>
|
2012-08-05 11:50:10 +02:00
|
|
|
<td class=\"centered\">License files</td>
|
2009-10-28 00:28:40 +01:00
|
|
|
</tr>
|
2012-07-31 21:32:25 +02:00
|
|
|
"
|
|
|
|
|
|
|
|
autotools_packages=0
|
|
|
|
cmake_packages=0
|
|
|
|
generic_packages=0
|
|
|
|
manual_packages=0
|
|
|
|
packages_with_licence=0
|
|
|
|
packages_without_licence=0
|
2012-08-05 11:50:10 +02:00
|
|
|
packages_with_license_files=0
|
|
|
|
packages_without_license_files=0
|
2011-02-28 22:09:20 +01:00
|
|
|
total_patch_count=0
|
2011-10-05 18:47:54 +02:00
|
|
|
cnt=0
|
2012-07-31 21:32:25 +02:00
|
|
|
|
|
|
|
for i in $(find boot/ linux/ package/ -name '*.mk' | sort) ; do
|
2009-10-28 00:28:40 +01:00
|
|
|
|
2011-02-28 21:54:58 +01:00
|
|
|
if test \
|
2012-07-31 21:32:25 +02:00
|
|
|
$i = "boot/common.mk" -o \
|
|
|
|
$i = "linux/linux-ext-xenomai.mk" -o \
|
|
|
|
$i = "linux/linux-ext-rtai.mk" -o \
|
2012-02-11 17:41:09 +01:00
|
|
|
$i = "package/efl/efl.mk" -o \
|
2013-09-11 11:12:18 +02:00
|
|
|
$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 \
|
2011-10-06 01:57:26 +02:00
|
|
|
$i = "package/gtk2-themes/gtk2-themes.mk" -o \
|
2013-09-11 11:12:18 +02:00
|
|
|
$i = "package/matchbox/matchbox.mk" -o \
|
|
|
|
$i = "package/opengl/opengl.mk" -o \
|
|
|
|
$i = "package/qt5/qt5.mk" -o \
|
|
|
|
$i = "package/x11r7/x11r7.mk" -o \
|
2012-07-31 21:32:25 +02:00
|
|
|
$i = "package/pkg-autotools.mk" -o \
|
|
|
|
$i = "package/pkg-cmake.mk" -o \
|
2013-09-11 11:12:18 +02:00
|
|
|
$i = "package/pkg-download.mk" -o \
|
2012-07-31 21:32:25 +02:00
|
|
|
$i = "package/pkg-generic.mk" -o \
|
2013-09-11 11:12:18 +02:00
|
|
|
$i = "package/pkg-utils.mk" ; then
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "skipping $i" 1>&2
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
cnt=$((cnt+1))
|
|
|
|
|
2012-07-31 21:32:25 +02:00
|
|
|
hashost=0
|
|
|
|
hastarget=0
|
2012-07-31 21:38:16 +02:00
|
|
|
infratype=""
|
2009-10-28 00:28:40 +01:00
|
|
|
|
2012-07-31 21:32:25 +02:00
|
|
|
# Determine package infrastructure
|
2012-07-03 00:05:46 +02:00
|
|
|
if grep -E "\(host-autotools-package\)" $i > /dev/null ; then
|
2012-07-31 21:32:25 +02:00
|
|
|
infratype="autotools"
|
|
|
|
hashost=1
|
2010-07-26 15:15:14 +02:00
|
|
|
fi
|
|
|
|
|
2012-07-03 00:07:08 +02:00
|
|
|
if grep -E "\(autotools-package\)" $i > /dev/null ; then
|
2012-07-31 21:32:25 +02:00
|
|
|
infratype="autotools"
|
|
|
|
hastarget=1
|
2010-07-26 15:15:14 +02:00
|
|
|
fi
|
|
|
|
|
2012-07-03 00:05:46 +02:00
|
|
|
if grep -E "\(host-generic-package\)" $i > /dev/null ; then
|
2012-07-31 21:32:25 +02:00
|
|
|
infratype="generic"
|
|
|
|
hashost=1
|
2010-07-26 15:15:14 +02:00
|
|
|
fi
|
|
|
|
|
2012-07-03 00:07:08 +02:00
|
|
|
if grep -E "\(generic-package\)" $i > /dev/null ; then
|
2012-07-31 21:32:25 +02:00
|
|
|
infratype="generic"
|
|
|
|
hastarget=1
|
2010-07-26 15:15:14 +02:00
|
|
|
fi
|
|
|
|
|
2012-07-03 00:05:46 +02:00
|
|
|
if grep -E "\(host-cmake-package\)" $i > /dev/null ; then
|
2012-07-31 21:32:25 +02:00
|
|
|
infratype="cmake"
|
|
|
|
hashost=1
|
2011-02-28 21:54:58 +01:00
|
|
|
fi
|
|
|
|
|
2012-07-03 00:07:08 +02:00
|
|
|
if grep -E "\(cmake-package\)" $i > /dev/null ; then
|
2012-07-31 21:32:25 +02:00
|
|
|
infratype="cmake"
|
|
|
|
hastarget=1
|
2011-02-28 21:54:58 +01:00
|
|
|
fi
|
|
|
|
|
2010-07-26 15:15:14 +02:00
|
|
|
pkg=$(basename $i)
|
|
|
|
pkg=${pkg%.mk}
|
2012-07-31 21:32:25 +02:00
|
|
|
pkgvariable=$(echo ${pkg} | tr "a-z-" "A-Z_")
|
2010-07-26 15:15:14 +02:00
|
|
|
|
|
|
|
|
2012-07-31 21:32:25 +02:00
|
|
|
# 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} = "generic" ]; then
|
|
|
|
generic_packages=$(($generic_packages+1))
|
2010-07-26 15:15:14 +02:00
|
|
|
fi
|
|
|
|
|
2012-08-05 11:44:52 +02:00
|
|
|
if grep -qE "^${pkgvariable}_LICENSE[ ]*=" $i ; then
|
2012-07-31 21:32:25 +02:00
|
|
|
packages_with_license=$(($packages_with_license+1))
|
|
|
|
license=1
|
2010-07-26 15:15:14 +02:00
|
|
|
else
|
2012-07-31 21:32:25 +02:00
|
|
|
packages_without_license=$(($packages_without_license+1))
|
|
|
|
license=0
|
2010-07-26 15:15:14 +02:00
|
|
|
fi
|
|
|
|
|
2012-08-05 11:50:10 +02:00
|
|
|
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
|
|
|
|
|
2012-07-31 21:32:25 +02:00
|
|
|
echo "<tr>"
|
|
|
|
|
2010-07-26 15:15:14 +02:00
|
|
|
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
|
2012-07-31 21:32:25 +02:00
|
|
|
patch_count_class="nopatches"
|
2011-02-28 22:09:20 +01:00
|
|
|
elif test $patch_count -lt 5 ; then
|
2012-07-31 21:32:25 +02:00
|
|
|
patch_count_class="somepatches"
|
2009-10-28 00:28:40 +01:00
|
|
|
else
|
2012-07-31 21:32:25 +02:00
|
|
|
patch_count_class="lotsofpatches"
|
2009-10-28 00:28:40 +01:00
|
|
|
fi
|
|
|
|
|
2012-07-31 21:32:25 +02:00
|
|
|
echo "<td class=\"centered ${patch_count_class}\">"
|
|
|
|
echo "<b>$patch_count</b>"
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "</td>"
|
|
|
|
|
2012-07-31 21:32:25 +02:00
|
|
|
if [ ${infratype} = "manual" ] ; then
|
|
|
|
echo "<td class=\"centered wrong\"><b>manual</b></td>"
|
2009-10-28 00:28:40 +01:00
|
|
|
else
|
2012-07-31 21:32:25 +02:00
|
|
|
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>"
|
2009-10-28 00:28:40 +01:00
|
|
|
fi
|
|
|
|
|
2012-07-31 21:32:25 +02:00
|
|
|
if [ ${license} -eq 0 ] ; then
|
|
|
|
echo "<td class=\"centered wrong\">No</td>"
|
2009-10-28 00:28:40 +01:00
|
|
|
else
|
2012-07-31 21:32:25 +02:00
|
|
|
echo "<td class=\"centered correct\">Yes</td>"
|
2009-10-28 00:28:40 +01:00
|
|
|
fi
|
|
|
|
|
2012-08-05 11:50:10 +02:00
|
|
|
if [ ${license_files} -eq 0 ] ; then
|
|
|
|
echo "<td class=\"centered wrong\">No</td>"
|
|
|
|
else
|
|
|
|
echo "<td class=\"centered correct\">Yes</td>"
|
|
|
|
fi
|
|
|
|
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "</tr>"
|
|
|
|
|
|
|
|
done
|
|
|
|
echo "</table>"
|
|
|
|
|
2012-11-04 08:37:37 +01:00
|
|
|
echo "<a id="results"></a>"
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "<table>"
|
|
|
|
echo "<tr>"
|
2012-07-31 21:32:25 +02:00
|
|
|
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>"
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "</tr>"
|
|
|
|
echo "<tr>"
|
2012-07-31 21:32:25 +02:00
|
|
|
echo "<td>Packages using the <i>autotools</i> infrastructure</td>"
|
|
|
|
echo "<td>$autotools_packages</td>"
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "</tr>"
|
|
|
|
echo "<tr>"
|
2012-07-31 21:32:25 +02:00
|
|
|
echo "<td>Packages not using any infrastructure</td>"
|
|
|
|
echo "<td>$manual_packages</td>"
|
2010-07-26 15:15:14 +02:00
|
|
|
echo "</tr>"
|
|
|
|
echo "<tr>"
|
2012-07-31 21:32:25 +02:00
|
|
|
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>"
|
2009-10-28 00:28:40 +01:00
|
|
|
echo "</tr>"
|
|
|
|
echo "<tr>"
|
2012-08-05 11:50:10 +02:00
|
|
|
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>"
|
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>"
|
2012-07-31 21:32:25 +02:00
|
|
|
|
|
|
|
echo "<hr/>"
|
|
|
|
echo "<i>Updated on $(LANG=C date), Git commit $(git log master -n 1 --pretty=format:%H)</i>"
|
|
|
|
echo "</body>"
|
|
|
|
echo "</html>"
|