Generate xml output from the ABI compliance report, use that to summarize added/removed symbols.

This commit is contained in:
Eric Hawicz committed 2026-10-18 17:01:10 -04:00
1 parent e9750720c3
commit 5a79fb68c2
3 files changed
+65

No files matched your search

+1
View File
@@ -209,6 +209,7 @@ abidump ${release}
echo "=== Comparing ABIs ==="
perl "${ACC}" -l json-c -old ABI-${prev}.dump -new ABI-${release}.dump
perl "${ACC}" -l json-c -old ABI-${prev}.dump -new ABI-${release}.dump -report-format xml
echo
echo "Look in $(pwd)/compat_reports/json-c/${prev}_to_${release}"
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="elemname" /><!-- i.e. 'added_symbols' or 'removed_symbols -->
<xsl:param name="kind" /><!-- i.e. 'source' or 'binary' -->
<xsl:output method="text"/>
<xsl:template match="/">
<!-- Source symbols added: -->
<xsl:apply-templates select="/reports/report[@kind = $kind]/*[name()=$elemname]/header/library/name"/>
</xsl:template>
<xsl:template match="name">
<xsl:value-of select="substring-before(concat(., '@'), '@')"/><xsl:text>&#xa;</xsl:text>
</xsl:template>
</xsl:stylesheet>
+51
View File
@@ -0,0 +1,51 @@
#!/bin/bash
#
# Analyze the ABI compliance report and pick out things that
# may need attention when creating a new release.
#
RUNDIR=$(dirname "$0")
exitval=0
XMLREPORT="$1"
if [[ "${XMLREPORT}" = -* ]] || [ ! -r "${XMLREPORT}" ] ; then
fi
XSLTPROC=${XSLTPROC:-xsltproc}
if ! type -P "${XSLTPROC}" > /dev/null ; then
# Fallback to xsltproc.exe from Strawberry perl if on WSL
XSLTPROC=xsltproc.exe
fi
if ! type -P "${XSLTPROC}" > /dev/null ; then
echo "ERROR: can't find xsltproc, check ABI report for added/removed symbols" 1>&2
exit 1
fi
XMLREPORT=$HOME/abi-compliance-checker/compat_reports/json-c/0.19_to_0.19.99-50e3389/compat_report.xml
BIN_SYMBOLS="$("$XSLTPROC" --stringparam kind binary --stringparam elemname added_symbols "${RUNDIR}/acc_added_symbols.xsl" "${XMLREPORT}" | sort)"
SRC_SYMBOLS="$("$XSLTPROC" --stringparam kind source --stringparam elemname added_symbols "${RUNDIR}/acc_added_symbols.xsl" "${XMLREPORT}" | sort)"
echo "INFO: Added symbols, check if these are meant to be visible:"
echo "${SRC_SYMBOLS}" | sed -e's/^/ /'
echo
if ! cmp -s <(echo "${BIN_SYMBOLS}") <(echo "${SRC_SYMBOLS}") ; then
echo "WARNING: mismatch between src vs. bin added symbols, check json-c.sym" 1>&2
diff -u0 <(echo "${BIN_SYMBOLS}") <(echo "${SRC_SYMBOLS}") | \
awk 'NR>3 && /^(-|\+)/ { printf(" %s\n", $0); }'
echo
exitval=1
fi
DEL_SYMBOLS="$("$XSLTPROC" --stringparam elemname removed_symbols "${RUNDIR}/acc_added_symbols.xsl" "${XMLREPORT}" | sort)"
if [ -z "${DEL_SYMBOLS}" ] ; then
echo "OK: No removed symbols detected"
else
echo "=========================" 1>&2
echo "WARNING: major release may be needed! Removed symbols:" 1>&2
echo "${DEL_SYMBOLS}" 1>&2
echo 1>&2
exitval=1
fi
exit $exitval