xref: /dpdk/devtools/update-abi.sh (revision a8d0d473a0a89b3c50813e3e144e9a5377429f24)
1#!/bin/sh -e
2# SPDX-License-Identifier: BSD-3-Clause
3# Copyright(c) 2019 Intel Corporation
4
5abi_version=$1
6abi_version_file="./ABI_VERSION"
7update_path="lib drivers"
8
9# check ABI version format string
10check_abi_version() {
11      echo $1 | grep -q -e "^[[:digit:]]\{1,2\}\.[[:digit:]]\{1,2\}$"
12}
13
14if [ -z "$1" ]; then
15      # output to stderr
16      >&2 echo "Please provide ABI version"
17      exit 1
18fi
19
20# check version string format
21if ! check_abi_version $abi_version ; then
22      # output to stderr
23      >&2 echo "ABI version must be formatted as MAJOR.MINOR version"
24      exit 1
25fi
26
27if [ -n "$2" ]; then
28      abi_version_file=$2
29fi
30
31if [ -n "$3" ]; then
32      # drop $1 and $2
33      shift 2
34      # assign all other arguments as update paths
35      update_path=$@
36fi
37
38echo "New ABI version:" $abi_version
39echo "ABI_VERSION path:" $abi_version_file
40echo "Path to update:" $update_path
41
42echo $abi_version > $abi_version_file
43
44find $update_path -name version.map -exec \
45      devtools/update_version_map_abi.py {} \
46      $abi_version \; -print
47