#!/bin/bash # Copyright (C) 2009 by Thomas Petazzoni # # 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: # # ./scripts/pkg-stats > /tmp/pkg.html # echo " Results
" convert_to_generic_target=0 convert_to_generic_host=0 convert_to_target_autotools=0 convert_to_host_autotools=0 total_patch_count=0 cnt=0 for i in $(find package/ -name '*.mk') ; do if test \ $i = "package/java/java.mk" -o \ $i = "package/games/games.mk" -o \ $i = "package/multimedia/multimedia.mk" -o \ $i = "package/customize/customize.mk" -o \ $i = "package/matchbox/matchbox.mk" -o \ $i = "package/x11r7/x11r7.mk" ; then echo "skipping $i" 1>&2 continue fi cnt=$((cnt+1)) is_auto_host=0 is_auto_target=0 is_cmake_host=0 is_cmake_target=0 is_pkg_target=0 is_pkg_host=0 is_manual_target=0 is_manual_host=0 if grep -E "\(call AUTOTARGETS,host\)" $i > /dev/null ; then is_auto_host=1 fi if grep -E "\(call AUTOTARGETS\)" $i > /dev/null ; then is_auto_target=1 fi if grep -E "\(call GENTARGETS,host\)" $i > /dev/null ; then is_pkg_host=1 fi if grep -E "\(call GENTARGETS\)" $i > /dev/null ; then is_pkg_target=1 fi if grep -E "\(call CMAKETARGETS,host\)" $i > /dev/null ; then is_cmake_host=1 fi if grep -E "\(call CMAKETARGETS\)" $i > /dev/null ; then is_cmake_target=1 fi pkg=$(basename $i) pkg=${pkg%.mk} if grep "^host-$pkg:" $i > /dev/null ; then is_manual_host=1 fi if test $is_pkg_target -eq 0 -a $is_auto_target -eq 0 -a $is_cmake_target -eq 0; then is_manual_target=1 fi tasks="" if [ $is_manual_target -eq 1 ] ; then if grep "/configure" $i > /dev/null ; then tasks=$tasks"
  • convert package to autotools ?
  • " convert_to_target_autotools=$((convert_to_target_autotools+1)) else tasks=$tasks"
  • convert to generic target
  • " 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"
  • convert package to autotools ?
  • " convert_to_host_autotools=$((convert_to_host_autotools+1)) else tasks=$tasks"
  • convert to generic host
  • " convert_to_generic_host=$((convert_to_generic_host+1)) fi fi if test -n "$tasks" ; then echo "" else echo "" fi echo "" echo "" 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 "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" done echo "
    Id Package Patch count AUTOTARGETS GENTARGETS CMAKETARGETS manual Actions
    host target host target host target host target
    $cnt$i" echo $patch_count echo "" if [ $is_auto_host -eq 1 ] ; then echo "YES" else echo "NO" fi echo "" if [ $is_auto_target -eq 1 ] ; then echo "YES" else echo "NO" fi echo "" if [ $is_pkg_host -eq 1 ] ; then echo "YES" else echo "NO" fi echo "" if [ $is_pkg_target -eq 1 ] ; then echo "YES" else echo "NO" fi echo "" if [ $is_cmake_host -eq 1 ] ; then echo "YES" else echo "NO" fi echo "" if [ $is_cmake_target -eq 1 ] ; then echo "YES" else echo "NO" fi echo "" if [ $is_manual_host -eq 1 ] ; then echo "YES" else echo "NO" fi echo "" if [ $is_manual_target -eq 1 ] ; then echo "YES" else echo "NO" fi echo "" echo "
      " echo $tasks echo "
    " echo "
    " echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "" echo "
    Packages to convert to generic target$convert_to_generic_target
    Packages to convert to generic host$convert_to_generic_host
    Packages to convert to target autotools$convert_to_target_autotools
    Packages to convert to host autotools$convert_to_host_autotools
    Number of patches in all packages$total_patch_count
    TOTAL$cnt
    "