CI: improve abi-checking script

- less frightening warnings
- fewer subshells and `pwd -P` things
- clean up on uccess
This commit is contained in:
Adriaan de Groot 2024-02-17 18:20:17 +01:00
parent 14e9da251a
commit e4b9d754df

View File

@ -25,9 +25,13 @@ do_build() {
BUILD_DIR=build-abi-$LABEL
rm -rf $BUILD_DIR
mkdir $BUILD_DIR
rm -f $BUILD_DIR.log
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
cmake -S $SOURCE_DIR -B $BUILD_DIR -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Og -g -gdwarf" -DCMAKE_C_FLAGS="-Og -g -gdwarf" > /dev/null 2>&1
test -f $BUILD_DIR/Makefile || { echo "! failed to CMake $LABEL" ; exit 1 ; }
# Two targets make knows about at top-level
if make -C $BUILD_DIR -j12 calamares calamaresui > $BUILD_DIR.log 2>&1
then
ls -1 $BUILD_DIR/libcalamares*.so.*
# Copy the un-versioned files; .so is a symlink to the just-built one
@ -35,6 +39,7 @@ do_build() {
do
cp $lib ci/`basename $lib`.$LABEL
done
rm -rf $BUILD_DIR $BUILD_DIR.log
else
echo "! failed to build $LABEL"
exit 1
@ -44,7 +49,7 @@ do_build() {
### Build current tree and get ABI info
#
#
do_build current `pwd -P`
do_build current .
### Build ABI base version
#
@ -56,9 +61,10 @@ then
# The ABI version is cached, so we're good
:
else
git worktree remove --force tree-abi-$BASE_VERSION
git worktree remove --force tree-abi-$BASE_VERSION > /dev/null 2>&1
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 )
do_build $BASE_VERSION tree-abi-$BASE_VERSION
git worktree remove --force tree-abi-$BASE_VERSION > /dev/null 2>&1
fi
### Compare & Report