Signed-off-by: Daniel Schwierzeck <daniel.schwierz...@gmail.com> --- scripts/boardscfg2maintainers.sh | 259 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100755 scripts/boardscfg2maintainers.sh
diff --git a/scripts/boardscfg2maintainers.sh b/scripts/boardscfg2maintainers.sh new file mode 100755 index 0000000..27f7387 --- /dev/null +++ b/scripts/boardscfg2maintainers.sh @@ -0,0 +1,259 @@ +#!/bin/bash + +set -e + +test -e boards.cfg + +# architectures, which are maintained in a custodian tree +git_arch=( +aarch64 +arm +avr32 +blackfin +m68k +microblaze +mips +nds32 +nios +sh +sparc +x86 +) + +# CPUs, which are maintained in a custodian tree +git_cpu=( +74xx_7xx +mpc5xxx +mpc824x +mpc8260 +mpc82xx +mpc83xx +mpc85xx +mpc86xx +mpc8xx +ppc4xx +pxa +) + +# SOCs, which are maintained in a custodian tree +git_soc=( +at91 +exynos +imx +kirkwood +mx25 +mx27 +mx31 +mx35 +mx5 +mx6 +mxs +omap3 +omap4 +omap5 +s3c24x0 +samsung +spear +tegra114 +tegra124 +tegra20 +tegra30 +) + +# check whether the given arch has a custodian tree +has_arch_gittree() +{ + local arch=$1 + + for val in ${git_arch[@]}; do + [ "$val" = "$arch" ] && return 0 + done + + return 1 +} + +# check whether the given CPU has a custodian tree +has_cpu_gittree() +{ + local cpu=$1 + + for val in ${git_cpu[@]}; do + [ "$val" = "$cpu" ] && return 0 + done + + return 1 +} + +# check whether the given SOC has a custodian tree +has_soc_gittree() +{ + local soc=$1 + + for val in ${git_soc[@]}; do + [ "$val" = "$soc" ] && return 0 + done + + return 1 +} + +# translate given architecture to Git URL of custodian tree +get_arch_gittree() +{ + local arch=$1 + local arch_git + + case $arch in + aarch64) + arch_git=arm + ;; + m68k) + arch_git=coldfire + ;; + *) + arch_git=$arch + ;; + esac + + echo git://git.denx.de/u-boot-$arch_git.git +} + +# translate given CPU to Git URL of custodian tree +get_cpu_gittree() +{ + local cpu=$1 + local cpu_git + + case $cpu in + 74xx_7xx) + cpu_git=74xx-7xx + ;; + mpc824x|mpc8260) + cpu_git=mpc82xx + ;; + *) + cpu_git=$cpu + ;; + esac + + echo git://git.denx.de/u-boot-$cpu_git.git +} + +# translate given SOC to Git URL of custodian tree +get_soc_gittree() +{ + local soc=$1 + local soc_git + + case $soc in + at91) + soc_git=atmel + ;; + exynos|s3c24x0) + soc_git=samsung + ;; + kirkwood) + soc_git=marvell + ;; + mx25|mx27|mx31|mx35|mx5|mx6|mxs) + soc_git=imx + ;; + omap3|omap4|omap5) + soc_git=ti + ;; + spear) + soc_git=stm + ;; + tegra114|tegra124|tegra20|tegra30) + soc_git=tegra + ;; + *) + soc_git=$soc + ;; + esac + + echo git://git.denx.de/u-boot-$soc_git.git +} + +echo -n > MAINTAINERS.boards +echo -n > boards.cfg.tmp + +# pre-process, minimize and sort boards.cfg +while read -r status arch cpu soc vendor board target options maintainers; do + case $status in + Active) + status="Maintained" + ;; + Orphan) + ;; + *) + continue + ;; + esac + + options_target=$(echo $options | awk 'BEGIN {FS=":"}; { print $1 }') + + if [ "$options_target" != "-" ]; then + board=$options_target + elif [ "$target" != "-" ]; then + board=$target + else + board=$board + fi + + if has_soc_gittree $soc; then + gittree=$(get_soc_gittree $soc) + elif has_cpu_gittree $cpu; then + gittree=$(get_cpu_gittree $cpu) + elif has_arch_gittree $arch; then + gittree=$(get_arch_gittree $arch) + else + gittree="-" + fi + + echo "$status $board $vendor $gittree $maintainers" >> boards.cfg.tmp +done < boards.cfg + +sort -u boards.cfg.tmp > boards.cfg.sorted + +# create MAINTAINERS.boards from pre-processed boards.cfg +while read -r status board vendor gittree maintainers; do + if [ "$vendor" = "-" ]; then + echo "BOARD $board" >> MAINTAINERS.boards + else + echo "BOARD $board $vendor" >> MAINTAINERS.boards + fi + + if [ "$maintainers" != "-" ]; then + echo $maintainers | \ + awk 'BEGIN {FS=":"}; { for (i = 1; i <= NF; i++) printf("M:\t%s\n", $i) }' \ + >> MAINTAINERS.boards + fi + + if [ "$gittree" != "-" ]; then + echo -e "T:\tgit $gittree" >> MAINTAINERS.boards + fi + + echo -e "S:\t$status" >> MAINTAINERS.boards + + if [ "$vendor" = "-" ]; then + echo -e "F:\tboard/$board/" >> MAINTAINERS.boards + else + echo -e "F:\tboard/$vendor/$board/" >> MAINTAINERS.boards + + if [ -e board/$vendor/common/Makefile ]; then + echo -e "F:\tboard/$vendor/common/" >> MAINTAINERS.boards + fi + fi + + config_h=include/configs/${board}.h + echo -e "F:\t$config_h" >> MAINTAINERS.boards + + if [ ! -e $config_h ]; then + echo "$config_h is missing" + exit 1 + fi + + echo >> MAINTAINERS.boards +done < boards.cfg.sorted + +rm -f boards.cfg.sorted boards.cfg.tmp -- 1.9.2 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot