diff mbox series

[v4,03/10] buildtools: add ABI update shell script

Message ID 745d35b8e3911e778e43e7d4845176d170fa473c.1571322634.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Headers show
Series Implement the new ABI policy and add helper scripts | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Anatoly Burakov Oct. 17, 2019, 2:31 p.m. UTC
In order to facilitate mass updating of version files, add a shell
script that recurses into lib/ and drivers/ directories and calls
the ABI version update script.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---

Notes:
    v3:
    - Switch to sh rather than bash, and remove bash-isms
    - Address review comments
    
    v2:
    - Add this patch to split the shell script from previous commit
    - Fixup miscellaneous bugs

 buildtools/update-abi.sh | 42 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100755 buildtools/update-abi.sh
diff mbox series

Patch

diff --git a/buildtools/update-abi.sh b/buildtools/update-abi.sh
new file mode 100755
index 0000000000..89ba5804a6
--- /dev/null
+++ b/buildtools/update-abi.sh
@@ -0,0 +1,42 @@ 
+#!/bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+abi_version=$1
+abi_version_file="./config/ABI_VERSION"
+update_path="lib drivers"
+
+if [ -z "$1" ]; then
+      # output to stderr
+      >&2 echo "Please provide ABI version"
+      exit 1
+fi
+
+# check version string format
+echo $abi_version | grep -q -e "^[[:digit:]]\{1,2\}\.[[:digit:]]\{1,2\}$"
+if [ "$?" -ne 0 ]; then
+      # output to stderr
+      >&2 echo "ABI version must be formatted as MAJOR.MINOR version"
+      exit 1
+fi
+
+if [ -n "$2" ]; then
+      abi_version_file=$2
+fi
+
+if [ -n "$3" ]; then
+      # drop $1 and $2
+      shift 2
+      # assign all other arguments as update paths
+      update_path=$@
+fi
+
+echo "New ABI version:" $abi_version
+echo "ABI_VERSION path:" $abi_version_file
+echo "Path to update:" $update_path
+
+echo $abi_version > $abi_version_file
+
+find $update_path -name  \*version.map -exec \
+      ./buildtools/update_version_map_abi.py {} \
+      $abi_version \; -print