Merge and reformat boards.cfg and MAINTAINERS

Put all informations about targets, including state (active or
orphan) and maintainers, in boards.cfg; remove MAINTAINERS;
adjust the build system accordingly.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
This commit is contained in:
Albert ARIBAUD 2013-09-11 15:52:51 +02:00 committed by Tom Rini
parent 7bcee5f7ee
commit 27af930e9a
8 changed files with 1350 additions and 2631 deletions

File diff suppressed because it is too large Load Diff

51
MAKEALL
View File

@ -106,9 +106,9 @@ while true ; do
-s|--soc)
# echo "Option SoC: argument \`$2'"
if [ "$opt_s" ] ; then
opt_s="${opt_s%)} || \$6 == \"$2\" || \$6 ~ /$2/)"
opt_s="${opt_s%)} || \$4 == \"$2\" || \$4 ~ /$2/)"
else
opt_s="(\$6 == \"$2\" || \$6 ~ /$2/)"
opt_s="(\$4 == \"$2\" || \$4 ~ /$2/)"
fi
SELECTED='y'
shift 2 ;;
@ -160,7 +160,7 @@ FILTER="\$1 !~ /^#/"
[ "$opt_v" ] && FILTER="${FILTER} && $opt_v"
if [ "$SELECTED" ] ; then
SELECTED=$(awk '('"$FILTER"') { print $1 }' boards.cfg)
SELECTED=$(awk '('"$FILTER"') { print $7 }' boards.cfg)
# Make sure some boards from boards.cfg are actually found
if [ -z "$SELECTED" ] ; then
@ -232,12 +232,12 @@ boards_by_field()
-v field="$1" \
-v select="$2" \
-F "$FS" \
'($1 !~ /^#/ && $field == select) { print $1 }' \
'($1 !~ /^#/ && $field == select) { print $7 }' \
boards.cfg
}
boards_by_arch() { boards_by_field 2 "$@" ; }
boards_by_cpu() { boards_by_field 3 "$@" "[: \t]+" ; }
boards_by_soc() { boards_by_field 6 "$@" ; }
boards_by_soc() { boards_by_field 4 "$@" ; }
#########################################################################
## MPC5xx Systems
@ -519,56 +519,53 @@ get_target_location() {
local vendor=""
# Automatic mode
local line=`egrep -i "^[[:space:]]*${target}[[:space:]]" boards.cfg`
local line=`awk -F '\ +' '\$7 == "'"$target"'" { print \$0 }' boards.cfg`
if [ -z "${line}" ] ; then echo "" ; return ; fi
set ${line}
# add default board name if needed
[ $# = 3 ] && set ${line} ${1}
CONFIG_NAME="${7%_config}"
CONFIG_NAME="${1%_config}"
[ "${BOARD_NAME}" ] || BOARD_NAME="${7%_config}"
[ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}"
if [ "$4" = "-" ] ; then
board=${BOARD_NAME}
else
board="$4"
if [ $# -gt 5 ]; then
if [ "$6" = "-" ] ; then
board=${BOARD_NAME}
else
board="$6"
fi
fi
[ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
[ $# -gt 6 ] && [ "$7" != "-" ] && {
tmp="${7%:*}"
[ $# -gt 6 ] && [ "$8" != "-" ] && {
tmp="${8%:*}"
if [ "$tmp" ] ; then
CONFIG_NAME="$tmp"
fi
}
# Assign board directory to BOARDIR variable
if [ -z "${vendor}" ] ; then
if [ "${vendor}" == "-" ] ; then
BOARDDIR=${board}
else
BOARDDIR=${vendor}/${board}
fi
echo "${CONFIG_NAME}:${BOARDDIR}"
echo "${CONFIG_NAME}:${BOARDDIR}:${BOARD_NAME}"
}
get_target_maintainers() {
local name=`echo $1 | cut -d : -f 1`
local name=`echo $1 | cut -d : -f 3`
if ! grep -qsi "[[:blank:]]${name}[[:blank:]]" MAINTAINERS ; then
local line=`awk -F '\ +' '\$7 == "'"$target"'" { print \$0 }' boards.cfg`
if [ -z "${line}" ]; then
echo ""
return ;
fi
local line=`tac MAINTAINERS | grep -ni "[[:blank:]]${name}[[:blank:]]" | cut -d : -f 1`
local mail=`tac MAINTAINERS | tail -n +${line} | \
sed -n ":start /.*@.*/ { b mail } ; n ; b start ; :mail /.*@.*/ { p ; n ; b mail } ; q" | \
sed "s/^.*<//;s/>.*$//"`
echo "$mail"
local mails=`echo ${line} | cut -d ' ' -f 9- | sed -e 's/[^<]*<//' -e 's/>.*</ /' -e 's/>[^>]*$//'`
[ "$mails" == "-" ] && mails=""
echo "$mails"
}
get_target_arch() {

View File

@ -838,7 +838,7 @@ unconfig:
sinclude $(obj).boards.depend
$(obj).boards.depend: boards.cfg
@awk '(NF && $$1 !~ /^#/) { print $$1 ": " $$1 "_config; $$(MAKE)" }' $< > $@
@awk '(NF && $$1 !~ /^#/) { print $$7 ": " $$7 "_config; $$(MAKE) -d" }' $< > $@
#
# Functions to generate common board directory names

6
README
View File

@ -35,7 +35,7 @@ Makefile have been tested to some extent and can be considered
"working". In fact, many of them are used in production systems.
In case of problems see the CHANGELOG and CREDITS files to find out
who contributed the specific port. The MAINTAINERS file lists board
who contributed the specific port. The boards.cfg file lists board
maintainers.
Note: There is no CHANGELOG file in the actual U-Boot source tree;
@ -5833,8 +5833,8 @@ it:
* For major contributions, your entry to the CREDITS file
* When you add support for a new board, don't forget to add this
board to the MAINTAINERS file, too.
* When you add support for a new board, don't forget to add a
maintainer e-mail address to the boards.cfg file, too.
* If your patch adds new configuration options, don't forget to
document these in the README file.

2345
boards.cfg

File diff suppressed because it is too large Load Diff

View File

@ -23,10 +23,11 @@ options=""
if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then
# Automatic mode
line=`egrep -i "^[[:space:]]*${2}[[:space:]]" boards.cfg` || {
line=`awk '($0 !~ /^#/ && $7 ~ /^'"$2"'$/) { print $1, $2, $3, $4, $5, $6, $7, $8 }' boards.cfg`
if [ -z "$line" ] ; then
echo "make: *** No rule to make target \`$2_config'. Stop." >&2
exit 1
}
fi
set ${line}
# add default board name if needed
@ -37,44 +38,44 @@ while [ $# -gt 0 ] ; do
case "$1" in
--) shift ; break ;;
-a) shift ; APPEND=yes ;;
-n) shift ; BOARD_NAME="${1%_config}" ; shift ;;
-n) shift ; BOARD_NAME="${7%_config}" ; shift ;;
-t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;;
*) break ;;
esac
done
[ $# -lt 4 ] && exit 1
[ $# -gt 7 ] && exit 1
[ $# -lt 7 ] && exit 1
[ $# -gt 8 ] && exit 1
# Strip all options and/or _config suffixes
CONFIG_NAME="${1%_config}"
CONFIG_NAME="${7%_config}"
[ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}"
[ "${BOARD_NAME}" ] || BOARD_NAME="${7%_config}"
arch="$2"
cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $1}'`
spl_cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $2}'`
if [ "$4" = "-" ] ; then
if [ "$6" = "-" ] ; then
board=${BOARD_NAME}
else
board="$4"
board="$6"
fi
[ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
[ $# -gt 5 ] && [ "$6" != "-" ] && soc="$6"
[ $# -gt 6 ] && [ "$7" != "-" ] && {
[ "$5" != "-" ] && vendor="$5"
[ "$4" != "-" ] && soc="$4"
[ $# -gt 7 ] && [ "$8" != "-" ] && {
# check if we have a board config name in the options field
# the options field mave have a board config name and a list
# of options, both separated by a colon (':'); the options are
# separated by commas (',').
#
# Check for board name
tmp="${7%:*}"
tmp="${8%:*}"
if [ "$tmp" ] ; then
CONFIG_NAME="$tmp"
fi
# Check if we only have a colon...
if [ "${tmp}" != "$7" ] ; then
options=${7#*:}
if [ "${tmp}" != "$8" ] ; then
options=${8#*:}
TARGETS="`echo ${options} | sed 's:,: :g'` ${TARGETS}"
fi
}

View File

@ -63,7 +63,7 @@ class Boards:
for upto in range(len(fields)):
if fields[upto] == '-':
fields[upto] = ''
while len(fields) < 7:
while len(fields) < 9:
fields.append('')
board = Board(*fields)

132
tools/reformat.py Executable file
View File

@ -0,0 +1,132 @@
#! /usr/bin/python
########################################################################
#
# reorder and reformat a file in columns
#
# this utility takes lines from its standard input and reproduces them,
# partially reordered and reformatted, on its standard output.
#
# It has the same effect as a 'sort | column -t', with the exception
# that empty lines, as well as lines which start with a '#' sign, are
# not affected, i.e. they keep their position and formatting, and act
# as separators, i.e. the parts before and after them are each sorted
# separately (but overall field widths are computed across the whole
# input).
#
# Options:
# -i:
# --ignore-case:
# Do not consider case when sorting.
# -d:
# --default:
# What to chage empty fields to.
# -s <N>:
# --split=<N>:
# Treat only the first N whitespace sequences as separators.
# line content after the Nth separator will count as only one
# field even if it contains whitespace.
# Example : '-s 2' causes input 'a b c d e' to be split into
# three fields, 'a', 'b', and 'c d e'.
#
# boards.cfg requires -ids 6.
#
########################################################################
import sys, getopt, locale
# ensure we sort using the C locale.
locale.setlocale(locale.LC_ALL, 'C')
# check options
maxsplit = 0
ignore_case = 0
default_field =''
try:
opts, args = getopt.getopt(sys.argv[1:], "id:s:",
["ignore-case","default","split="])
except getopt.GetoptError as err:
print str(err) # will print something like "option -a not recognized"
sys.exit(2)
for o, a in opts:
if o in ("-s", "--split"):
maxsplit = eval(a)
elif o in ("-i", "--ignore-case"):
ignore_case = 1
elif o in ("-d", "--default"):
default_field = a
else:
assert False, "unhandled option"
# collect all lines from standard input and, for the ones which must be
# reformatted and sorted, count their fields and compute each field's
# maximum size
input_lines = []
field_width = []
for line in sys.stdin:
# remove final end of line
input_line = line.strip('\n')
if (len(input_line)>0) and (input_line[0] != '#'):
# sortable line: split into fields
fields = input_line.split(None,maxsplit)
# if there are new fields, top up field_widths
for f in range(len(field_width), len(fields)):
field_width.append(0)
# compute the maximum witdh of each field
for f in range(len(fields)):
field_width[f] = max(field_width[f],len(fields[f]))
# collect the line for next stage
input_lines.append(input_line)
# run through collected input lines, collect the ones which must be
# reformatted and sorted, and whenever a non-reformattable, non-sortable
# line is met, sort the collected lines before it and append them to the
# output lines, then add the non-sortable line too.
output_lines = []
sortable_lines = []
for input_line in input_lines:
if (len(input_line)>0) and (input_line[0] != '#'):
# this line should be reformatted and sorted
input_fields = input_line.split(None,maxsplit)
output_fields = [];
# reformat each field to this field's column width
for f in range(len(input_fields)):
output_field = input_fields[f];
output_fields.append(output_field.ljust(field_width[f]))
# any missing field is set to default if it exists
if default_field != '':
for f in range(len(input_fields),len(field_width)):
output_fields.append(default_field.ljust(field_width[f]))
# join fields using two spaces, like column -t would
output_line = ' '.join(output_fields);
# collect line for later
sortable_lines.append(output_line)
else:
# this line is non-sortable
# sort collected sortable lines
if ignore_case!=0:
sortable_lines.sort(key=lambda x: str.lower(locale.strxfrm(x)))
else:
sortable_lines.sort(key=lambda x: locale.strxfrm(x))
# append sortable lines to the final output
output_lines.extend(sortable_lines)
sortable_lines = []
# append non-sortable line to the final output
output_lines.append(input_line)
# maybe we had sortable lines pending, so append them to the final output
if ignore_case!=0:
sortable_lines.sort(key=lambda x: str.lower(locale.strxfrm(x)))
else:
sortable_lines.sort(key=lambda x: locale.strxfrm(x))
output_lines.extend(sortable_lines)
# run through output lines and print them, except rightmost whitespace
for output_line in output_lines:
print output_line.rstrip()