Skip to content

Commit

Permalink
merge_config.sh: improve indentation
Browse files Browse the repository at this point in the history
It is true that we do not want to move the code too far to the
right, but something like below is not preferred:

    if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
    echo Value of $CFG is redefined by fragment $MERGE_FILE:
    echo Previous  value: $PREV_VAL
    echo New value:       $NEW_VAL
    echo
    elif [ "$WARNREDUN" = "true" ]; then
    echo Value of $CFG is redundant by fragment $MERGE_FILE:
    fi

To fix this, call "continue" if the "grep" command fails to find the
given CONFIG.

Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
Reviewed-by: Darren Hart <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
  • Loading branch information
masahir0y authored and michal42 committed Mar 24, 2015
1 parent 371cfd4 commit 3a975b8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions scripts/kconfig/merge_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,18 @@ for MERGE_FILE in $MERGE_LIST ; do
CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)

for CFG in $CFG_LIST ; do
grep -q -w $CFG $TMP_FILE
if [ $? -eq 0 ] ; then
PREV_VAL=$(grep -w $CFG $TMP_FILE)
NEW_VAL=$(grep -w $CFG $MERGE_FILE)
if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
grep -q -w $CFG $TMP_FILE || continue
PREV_VAL=$(grep -w $CFG $TMP_FILE)
NEW_VAL=$(grep -w $CFG $MERGE_FILE)
if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
echo Value of $CFG is redefined by fragment $MERGE_FILE:
echo Previous value: $PREV_VAL
echo New value: $NEW_VAL
echo
elif [ "$WARNREDUN" = "true" ]; then
elif [ "$WARNREDUN" = "true" ]; then
echo Value of $CFG is redundant by fragment $MERGE_FILE:
fi
sed -i "/$CFG[ =]/d" $TMP_FILE
fi
sed -i "/$CFG[ =]/d" $TMP_FILE
done
cat $MERGE_FILE >> $TMP_FILE
done
Expand Down

0 comments on commit 3a975b8

Please sign in to comment.