Skip to content

Instantly share code, notes, and snippets.

@apconole
Last active April 28, 2017 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save apconole/95c3129f677be0483daac437853c4071 to your computer and use it in GitHub Desktop.
Save apconole/95c3129f677be0483daac437853c4071 to your computer and use it in GitHub Desktop.
#! /bin/sh
## Check current git branch against original release abi
# Copyright (C) 2017, Red Hat, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# sanitize path
PATH=/bin:/usr/bin:/sbin:/usr/sbin
BRANCH_NAME=$(git status 2>/dev/null | grep On\ branch | egrep -o '[0-9]+\.[0-9]+')
if [ $? -eq 1 ]; then
echo "ERROR: Please ensure you are in a git tree, and on a branch tip"
exit 1
fi
SAFE_COMMIT=$(git show HEAD | egrep ^commit | cut -d" " -f2)
if [ $? -eq 1 ]; then
echo "ERROR: unable to get commit id for HEAD - is there a problem?"
exit 1
fi
if ! git tag --list 2>/dev/null | grep v${BRANCH_NAME}.0 >/dev/null 2>/dev/null;
then
echo "ERROR: No base version (v${BRANCH_NAME}.0) exists."
exit 1
fi
LOCATION="."
while [ ! -e "${LOCATION}/.git" ]; do
LOCATION="${LOCATION}/.."
if ls ${LOCATION} | egrep '^boot$' >/dev/null 2>/dev/null; then
echo "Could not find the root directory."
exit 1
fi
done
LIBRARY_NAME=libopenvswitch.so
echo "Found ${LOCATION}"
pushd ${LOCATION}
if [ ! -e lib/.libs/${LIBRARY_NAME} ]; then
echo "Did not find shared library ${LIBRARY_NAME}; re-building"
./boot.sh >/dev/null && ./configure --enable-shared >/dev/null \
&& make >/dev/null
fi
cp lib/.libs/${LIBRARY_NAME} libopenvswitch-new.so
git checkout v${BRANCH_NAME}.0 >/dev/null 2>&1
make >/dev/null
abidiff --changed-fns --deleted-fns \
--changed-vars --deleted-vars \
lib/.libs/${LIBRARY_NAME} libopenvswitch-new.so
rm libopenvswitch-new.so lib/.libs/${LIBRARY_NAME}
popd
echo "Started on commit ${SAFE_COMMIT}; checking out branch-${BRANCH_NAME}"
git checkout branch-${BRANCH_NAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment