Skip to content

Commit

Permalink
Merge and reformat boards.cfg and MAINTAINERS
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
albert-aribaud-u-boot authored and trini committed Sep 12, 2013
1 parent 7bcee5f commit 27af930
Show file tree
Hide file tree
Showing 8 changed files with 1,350 additions and 2,631 deletions.
1,412 changes: 0 additions & 1,412 deletions MAINTAINERS

This file was deleted.

51 changes: 24 additions & 27 deletions MAKEALL
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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="${1%_config}"
CONFIG_NAME="${7%_config}"

[ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}"
[ "${BOARD_NAME}" ] || BOARD_NAME="${7%_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() {
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
2,345 changes: 1,173 additions & 1,172 deletions boards.cfg

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions mkconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion tools/buildman/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def ReadBoards(self, fname):
for upto in range(len(fields)):
if fields[upto] == '-':
fields[upto] = ''
while len(fields) < 7:
while len(fields) < 9:
fields.append('')

board = Board(*fields)
Expand Down
132 changes: 132 additions & 0 deletions tools/reformat.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 27af930

Please sign in to comment.