2
#---------------------------------------------------------------------
3
# Script to run abi-compliance-checker to ensure ABI not broken.
4
#---------------------------------------------------------------------
5
# Copyright (C) 2013 Canonical Ltd.
7
# Author: James Hunt <james.hunt@canonical.com>
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation, version 3 of the License.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#---------------------------------------------------------------------
26
echo "ERROR: $msg" >&2
30
build_dir="@abs_builddir@"
31
source_dir="@abs_srcdir@"
32
acc="@abi_compliance_checker@"
33
acc_descriptor="@abi_build_XML@"
34
libupstart_libtool="@libupstart@"
35
lib_prefix="${libupstart_libtool%.la}"
36
libupstart_lt_version="@libupstart_version@"
38
# convert libtool(1) version to dotted form
39
dotted_version=$(echo "$libupstart_lt_version"|tr ':' '.')
41
libupstart_path="$build_dir/$libupstart_libtool"
43
old_abi="$source_dir/abi_dumps/${lib_prefix}/${lib_prefix}_${dotted_version}.abi.tar.gz"
45
echo "Checking ABI for $lib_prefix"
48
for file in "$libupstart_path" "$old_abi"
50
[ -f "$file" ] || die "file $file not found"
53
# Install the library to a temporary location since we need the
54
# full path to the shared library to pass to abi-compliance-checker.
55
install_dir=$(mktemp -d --tmpdir="$build_dir")
56
[ -z "$install_dir" ] && \
57
die "failed to create temporary install directory"
59
libtool --mode=install install \
60
"$libupstart_libtool" "$install_dir" >/dev/null 2>&1
62
abi_dump_dir=$(mktemp -d --tmpdir="$build_dir")
63
[ -z "$abi_dump_dir" ] && \
64
die "failed to create temporary dump directory"
66
abi_dump_path="$abi_dump_dir/${lib_prefix}_${dotted_version}.abi.tar.gz"
68
installed_so="$install_dir/$(echo "$lib_prefix"|cut -d\. -f1).so"
70
[ -f "$installed_so" ] || die "cannot find $installed_so"
72
# generate a descriptor for the newly-built library version
73
"$acc" -library "$lib_prefix" -dump "$acc_descriptor" -dump-path "$abi_dump_path"
75
new_abi="$abi_dump_dir/${lib_prefix}_${dotted_version}.abi.tar.gz"
76
[ -f "$new_abi" ] || die "cannot find $new_abi"
79
"$acc" -library "$lib_prefix" -old "$old_abi" -new "$new_abi"
82
libtool --mode=uninstall \
83
rm "$install_dir/$libupstart_libtool" >/dev/null 2>&1
85
rm -rf "$abi_dump_dir" "$build_dir/logs" "$install_dir"
87
# HTML report generated by $acc
88
rm -rf compat_reports/