3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 1) #!/bin/sh
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 2) # SPDX-License-Identifier: GPL-2.0
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 3)
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 4) set -e
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 5)
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 6) if [ $# != 1 ]; then
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 7) echo "Usage: $0 <modules.order>" >& 2
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 8) exit 1
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 9) fi
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 10)
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 11) exit_code=0
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 12)
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 13) # Check uniqueness of module names
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 14) check_same_name_modules()
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 15) {
1a998be620a10 (Masahiro Yamada 2021-03-31 22:38:05 +0900 16) for m in $(sed 's:.*/::' "$1" | sort | uniq -d)
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 17) do
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 18) echo "error: the following would cause module name conflict:" >&2
1a998be620a10 (Masahiro Yamada 2021-03-31 22:38:05 +0900 19) sed -n "/\/$m/s:^: :p" "$1" >&2
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 20) exit_code=1
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 21) done
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 22) }
3a48a91901c51 (Masahiro Yamada 2019-05-18 01:07:15 +0900 23)
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 24) check_same_name_modules "$1"
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 25)
8451791d1ff0f (Masahiro Yamada 2020-05-11 13:21:49 +0900 26) exit $exit_code