blob: e06327722263e1632577608c5c70831e76582cc9 [file] [log] [blame]
Masahiro Yamada3a48a912019-05-18 01:07:15 +09001#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3
4set -e
5
Masahiro Yamada84517912020-05-11 13:21:49 +09006if [ $# != 1 ]; then
7 echo "Usage: $0 <modules.order>" >& 2
8 exit 1
9fi
10
11exit_code=0
12
Masahiro Yamada3a48a912019-05-18 01:07:15 +090013# Check uniqueness of module names
14check_same_name_modules()
15{
Masahiro Yamada1a998be2021-03-31 22:38:05 +090016 for m in $(sed 's:.*/::' "$1" | sort | uniq -d)
Masahiro Yamada3a48a912019-05-18 01:07:15 +090017 do
Masahiro Yamada84517912020-05-11 13:21:49 +090018 echo "error: the following would cause module name conflict:" >&2
Masahiro Yamada1a998be2021-03-31 22:38:05 +090019 sed -n "/\/$m/s:^: :p" "$1" >&2
Masahiro Yamada84517912020-05-11 13:21:49 +090020 exit_code=1
Masahiro Yamada3a48a912019-05-18 01:07:15 +090021 done
22}
23
Masahiro Yamada84517912020-05-11 13:21:49 +090024check_same_name_modules "$1"
25
26exit $exit_code