File check.spec of Package headers-abi-check
#
# Copyright (c) 2010 Lubos Lunak <l.lunak@suse.cz>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# norootforbuild
%define pkgname headers
Name: %{pkgname}-abi-check
BuildRequires: abi-compliance-checker %{pkgname}-abi-last %{pkgname}-abi-current
License: Same as %{pkgname}
#Url:
Group: Development/Tools/Other
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: ABI check for %{pkgname}
%define oldversion %(rpm -q --qf "%{VERSION}" %{pkgname}-abi-last)
%define newversion %(rpm -q --qf "%{VERSION}" %{pkgname}-abi-current)
Version: %{newversion}
Release: 1
%description
This package contains ABI information for %{pkgname} that can be used with abi-compliance checker.
When a new version of the package is released, the ABI of that package can be checked for backwards
compatibility using this information.
%prep
%setup -c -n %{name}-%{version} -T -q
echo %{newversion}
%build
cat `rpm -ql %{pkgname}-abi-last | grep 'descriptor\.xml'` >descriptor1.xml
cat `rpm -ql %{pkgname}-abi-current | grep 'descriptor\.xml'` >descriptor2.xml
cat descriptor1.xml | grep -A 100000 '<headers>' | grep -B 100000 '</headers>' | sort > headers1.txt
cat descriptor2.xml | grep -A 100000 '<headers>' | grep -B 100000 '</headers>' | sort > headers2.txt
removedheaders=`diff -u0 headers1.txt headers2.txt | grep '^-' | grep -v '^---' | sed 's/^-//'`
if test -n "$removedheaders"; then
echo Removed headers: $removedheaders
exit 1
fi
abi-compliance-checker.pl -l %{pkgname} -d1 `rpm -ql %{pkgname}-abi-last | grep '\.abi\.'` \
-d2 `rpm -ql %{pkgname}-abi-current | grep '\.abi\.'` || fail=1
echo === HTML REPORT BEGIN === >report.html
cat compat_reports/%{pkgname}/%{oldversion}_to_%{newversion}/abi_compat_report.html >>report.html
echo >>report.html
echo === HTML REPORT END === >>report.html
cat report.html
if test -n "$fail"; then
exit 1
fi
%install
DESTDIR=%{?buildroot:%{buildroot}}
mkdir -p $DESTDIR/%{_libdir}/abi-compliance-checker/%{pkgname}
cp -p compat_reports/%{pkgname}/*/abi_compat_report.html $DESTDIR/%{_libdir}/abi-compliance-checker/%{pkgname}/%{oldversion}-%{newversion}.xml
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_libdir}/abi-compliance-checker/%{pkgname}
%changelog