Skip to content

Commit a4468e5

Browse files
committed
devtools: make uAPI check exclusive to other options
When doing a check of Linux uAPI headers, it is better to not fix them before. Also, it does not make sense to check just after doing an update, as the check would just repeat the same update process. That's why a check is now run alone without any update. The current version has to be retrieved in all cases, so it is moved at the beginning of any processing. If the check option (-c) is used with an import (-i) or an upgrade (-u), an error is raised. Signed-off-by: Thomas Monjalon <[email protected]> Reviewed-by: Maxime Coquelin <[email protected]>
1 parent 3e271c6 commit a4468e5

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

devtools/linux-uapi.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ base_url="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/pla
1010
base_path="kernel/linux/uapi/"
1111
version=""
1212
file=""
13-
check_headers=0
13+
check_headers=false
1414

1515
print_usage()
1616
{
@@ -90,8 +90,6 @@ fixup_includes()
9090

9191
update_all()
9292
{
93-
local current_version=$(< $base_path/version)
94-
9593
if [ -n "$version" ]; then
9694
if version_older_than "$version" "$current_version"; then
9795
echo "Headers already up to date ($current_version >= $version)"
@@ -156,7 +154,7 @@ while getopts i:u:ch opt ; do
156154
case $opt in
157155
i ) file=$OPTARG ;;
158156
u ) version=$OPTARG ;;
159-
c ) check_headers=1 ;;
157+
c ) check_headers=true ;;
160158
h ) print_usage ; exit 0 ;;
161159
? ) print_usage ; exit 1 ;;
162160
esac
@@ -167,13 +165,17 @@ if [ $# -ne 0 ]; then
167165
print_usage
168166
exit 1
169167
fi
168+
if $check_headers && [ -n "$file" -o -n "$version" ]; then
169+
echo "The option -c is incompatible with -i and -u"
170+
exit 1
171+
fi
170172

171173
cd $(dirname $0)/..
174+
current_version=$(cat $base_path/version)
172175

173-
update_all
174-
175-
if [ $check_headers -eq 0 ]; then
176-
exit 0
176+
if $check_headers; then
177+
version=$current_version
178+
check_all
179+
else
180+
update_all
177181
fi
178-
179-
check_all

0 commit comments

Comments
 (0)