#! /bin/bash # Get the last commit which may change libbfd.so and libopcodes.so ABIs. last_abi_commit=$1 if test -z "$last_abi_commit"; then last_abi_commit=$(git log bfd/version.h | head -1 | awk '{ print $2 }') fi # The list of files and directories which may change the ABI. abi_files=" bfd opcodes include/bfdlink.h include/dis-asm.h include/plugin-api.h " # Get the list of files changed since the last commit which may change # the ABI. abi_files_changed=$(git --no-pager diff --stat=4096 $last_abi_commit $abi_files \ | awk '/files changed/ { next }; \ /ChangeLog.*/ { next }; \ /version.h/ { next }; \ /version.m4/ { next }; \ /\/doc\// { next }; \ /\/po\// { next }; \ { print $1 }') if test -z "$abi_files_changed"; then echo No ABI change since commit: echo git --no-pager log -1 --oneline $last_abi_commit echo exit 1 else echo The following files are changed since commit: echo git --no-pager log -1 --oneline $last_abi_commit echo for f in $abi_files_changed; do echo " $f" done echo echo which may change ABIs of libbfd.so and libopcodes.so exit 0 fi