-
-
Save joestringer/2c65d33565ec66d515a055299f58eac0 to your computer and use it in GitHub Desktop.
Make a bunch of minor usability/speedup changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
## Check current git branch against original release abi | |
# Copyright (C) 2017, Red Hat, Inc | |
# Copyright (C) 2017, Nicira, 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 | |
MAKEFLAGS="-j8" | |
if ! abidiff --version 2>/dev/null; then | |
echo "ERROR: abidiff is not installed. Install abigail-tools first." | |
exit 1 | |
fi | |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | |
RELEASE=v$(echo ${BRANCH_NAME} | egrep -o '[0-9]+\.[0-9]+').0 | |
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 ${RELEASE} >/dev/null 2>/dev/null; | |
then | |
echo "ERROR: No base version (${RELEASE}) exists." | |
exit 1 | |
fi | |
LOCATION="." | |
while [ ! -e "${LOCATION}/.git" ]; do | |
LOCATION="${LOCATION}/.." | |
if ls ${LOCATION} | egrep '^boot$' >/dev/null 2>&1; then | |
echo "Could not find the root directory." | |
exit 1 | |
fi | |
done | |
LIBRARY_NAME=libopenvswitch.so | |
echo "Found ${LOCATION}" | |
pushd ${LOCATION} >/dev/null | |
echo "Found branch '${BRANCH_NAME}'" | |
if [ ! -e lib/.libs/${LIBRARY_NAME} ]; then | |
echo "Did not find shared library ${LIBRARY_NAME}; re-building" | |
if ! grep "enable\-shared" config.log 2>&1 >/dev/null; then | |
./boot.sh >/dev/null 2>&1 && ./configure --enable-shared >/dev/null 2>&1 | |
fi | |
make ${MAKEFLAGS} >/dev/null 2>&1 | |
fi | |
cp lib/.libs/${LIBRARY_NAME} libopenvswitch-new.so | |
echo "Building '${RELEASE}'" | |
git checkout ${RELEASE} 2>/dev/null | |
make ${MAKEFLAGS} >/dev/null 2>&1 | |
echo "Running abidiff" | |
abidiff --changed-fns --deleted-fns lib/.libs/${LIBRARY_NAME} \ | |
libopenvswitch-new.so | |
rm libopenvswitch-new.so lib/.libs/${LIBRARY_NAME} | |
popd >/dev/null | |
echo "Started on commit ${SAFE_COMMIT}; checking out ${BRANCH_NAME}" | |
git checkout ${BRANCH_NAME} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment