From befa6778232bd060c737e3148e8a2953a496c070 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Aug 2022 15:36:53 +0200 Subject: [PATCH] CI: import abi-checking script (with a suitable 3.2 base version) --- ci/abicheck.sh | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 ci/abicheck.sh diff --git a/ci/abicheck.sh b/ci/abicheck.sh new file mode 100755 index 000000000..31e50e699 --- /dev/null +++ b/ci/abicheck.sh @@ -0,0 +1,74 @@ +#! /bin/sh +# +# SPDX-FileCopyrightText: 2021 Adriaan de Groot +# SPDX-License-Identifier: BSD-2-Clause +# +# Compares the ABI of the current working tree with the ABI +# from a base-version. Uses libabigail for the actual comparison. +# +# To use the tool, just run the script. It will build Calamares at +# least once, maybe twice (if it needs the base-version ABI information +# and hasn't cached it). + +# The base version can be a tag or git-hash; it will be checked-out +# in a worktree. +# +# Note that the hash here now is 3.2.60, which is sort-of-the +# start of LTS releases. We try to keep ABI compatibility from +# there on out. +BASE_VERSION=b11ee3abc583e571e588fd00afb99d1a528373e6 + +### Build a tree and cache the ABI info into ci/ +# +# +do_build() { + LABEL=$1 + SOURCE_DIR=$2 + + BUILD_DIR=build-abi-$LABEL + rm -rf $BUILD_DIR + mkdir $BUILD_DIR + + if ( cd $BUILD_DIR && cmake $SOURCE_DIR -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Og -g -gdwarf" -DCMAKE_C_FLAGS="-Og -g -gdwarf" && make -j12 ) > /dev/null 2>&1 + then + ls -1 $BUILD_DIR/libcalamares*.so.* + # Copy the un-versioned files; .so is a symlink to the just-built one + for lib in $BUILD_DIR/libcalamares*.so + do + cp $lib ci/`basename $lib`.$LABEL + done + else + echo "! failed to build $LABEL" + exit 1 + fi +} + +### Build current tree and get ABI info +# +# +do_build current `pwd -P` + +### Build ABI base version +# +# We cache this to save on some build time, if we are chasing a +# single branch from an unchanging base version. +# +if test -f ci/libcalamares.so.$BASE_VERSION +then + # The ABI version is cached, so we're good + : +else + git worktree remove --force tree-abi-$BASE_VERSION + git worktree add tree-abi-$BASE_VERSION $BASE_VERSION > /dev/null 2>&1 || { echo "! could not create worktree for $BASE_VERSION" ; exit 1 ; } + do_build $BASE_VERSION $( cd tree-abi-$BASE_VERSION && pwd -P ) +fi + +### Compare & Report +# +# abidiff compares the Application Binary Interfaces (ABI) of two +# shared libraries in ELF format. It emits a meaningful report describing +# the differences between the two ABIs. +# +# -l prints only the leaf changes, leaving out explanations of why. +# +abidiff -l ci/libcalamares.so.$BASE_VERSION ci/libcalamares.so.current