specfile: extraction of API version is now automated

This commit is contained in:
David Kaspar [Dee'Kej] 2017-11-01 15:34:03 +01:00
parent f318f0d9b8
commit 7fc194cb68
1 changed files with 8 additions and 20 deletions

View File

@ -30,15 +30,14 @@
# For more info: https://fedoraproject.org/wiki/Packaging:Guidelines#PIE # For more info: https://fedoraproject.org/wiki/Packaging:Guidelines#PIE
%global _hardened_build 1 %global _hardened_build 1
# We are defining the gawk(abi) version value based on these values, because # Extraction of API major & minor versions, so we can export them below:
# upstream updates the API from time to time, which breaks the ABI for packages %global gawk_api_major %%(tar -xf %{SOURCE0} gawk-%{version}/gawkapi.h --to-stdout | \
# depending on gawk's shared objects. The gawk(abi) version value is exported grep -i -e "gawk_api_major.*[[:digit:]]" | \
# below via the Provides: field. grep -o -e "[[:digit:]]")
#
# These values are defined in the gawkapi.h header file. To see them, run: %global gawk_api_minor %%(tar -xf %{SOURCE0} gawk-%{version}/gawkapi.h --to-stdout | \
# grep -E "gawk_api_(major|minor).*[[:digit:]]" gawkapi.h grep -i -e "gawk_api_minor.*[[:digit:]]" | \
%global gawk_api_major 1 grep -o -e "[[:digit:]]")
%global gawk_api_minor 1
# ============================================================================= # =============================================================================
@ -190,17 +189,6 @@ makeinfo --html -I doc -o html/gawkinet doc/gawkinet.texi
%check %check
make check make check
# Check we have correctly specified the ABI version for the current sources:
api_major_vers=$(grep -i -e "gawk_api_major.*[[:digit:]]" gawkapi.h | grep -o -e "[[:digit:]]")
api_minor_vers=$(grep -i -e "gawk_api_minor.*[[:digit:]]" gawkapi.h | grep -o -e "[[:digit:]]")
if [[ "$api_major_vers" != %{gawk_api_major} || "$api_minor_vers" != %{gawk_api_minor} ]]; then
echo "Build Error: specified gawk(abi) version [%{gawk_api_major}.%{gawk_api_minor}] is different than source code API version [$api_major_vers.$api_minor_vers]!" >&2
exit 1
else
unset api_major_vers api_minor_vers
fi
# --------------- # ---------------
%install %install