1#!/bin/sh
2#
3# Copyright (C) 2009 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18# This script is used to find case-insensitive duplicate file names
19# from the git repository. This is used to remove them when generating
20# a new sysroot.
21
22# location of the root ndk directory. we assume this script is under build/tools
23NDK_ROOT_DIR=`dirname $0`/../..
24NDK_ROOT_DIR=`cd $NDK_ROOT_DIR && pwd`
25
26ORG_FILES=`(cd $NDK_ROOT_DIR && git ls-files) | sort -f`
27NEW_FILES=
28
29PREVFILE=
30PREVUPFILE=XXXXXX
31for FILE in $ORG_FILES; do
32    # don't use [:lower:] and [:upper:] since they can produce
33    # strange results based on the current locale.
34    UPFILE=`echo $FILE | tr [a-z] [A-Z]`
35    if [ "$UPFILE" != "$PREVUPFILE" ] ; then
36      NEW_FILES="$NEW_FILES $FILE"
37    else
38      echo "$PREVFILE"
39      echo "$FILE"
40    fi
41    PREVFILE=$FILE
42    PREVUPFILE=$UPFILE
43done
44