[v7,03/10] buildtools: add ABI update shell script
diff mbox series

Message ID d1af51f1795ee2e8f3a0180a7655ae707760916b.1573230233.git.anatoly.burakov@intel.com
State New
Delegated to: Thomas Monjalon
Headers show
Series
  • Implement the new ABI policy and add helper scripts
Related show

Checks

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

Commit Message

Burakov, Anatoly Nov. 8, 2019, 4:25 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

Patch
diff mbox series

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