From db2d78023aaf2814b28afd6ce488d98b1100aec5 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sun, 18 Mar 2018 15:46:36 +0100 Subject: The abi-check target was updated to check against the last tag As abi-dumper and abi-compliance-checker tools are not reliable when run across different systems, we now compare the previous tag ABI with the current compiled library. That is in contrast with the previous behavior of storing the output files of abi-dumper, which can become obsolete on a CI update. That also moves the ABI check only on the CI, and not in the 'make dist' rule as it takes significant time to run. This relates to an issue reported against libidn2's use of abi-compliance-checker but it affects gnutls as they share similar code: https://gitlab.com/libidn/libidn2/issues/42 Signed-off-by: Nikos Mavrogiannopoulos --- .gitlab-ci.yml | 7 +++++-- CONTRIBUTING.md | 4 ++++ Makefile.am | 64 ++++++++++++++++++++++++++++++++++++--------------------- 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b74452b43..cbfd269121 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ stages: # name to allow expiration of old caches. cache: - key: "$CI_JOB_NAME-ver2" + key: "$CI_JOB_NAME-ver3" paths: - cache/ @@ -60,7 +60,7 @@ abi-coverage.Fedora: script: - git submodule update --init --no-fetch - make autoreconf - - CFLAGS="-std=c99 -O2 -g" dash ./configure --disable-gcc-warnings --cache-file cache/config.cache --prefix=/usr --libdir=/usr/lib64 --disable-cxx --enable-code-coverage --disable-non-suiteb-curves --disable-maintainer-mode --disable-doc + - CFLAGS="-std=c99 -g -Og" dash ./configure --disable-gcc-warnings --cache-file cache/config.cache --prefix=/usr --libdir=/usr/lib64 --enable-code-coverage --disable-non-suiteb-curves --disable-maintainer-mode --disable-doc && make -j$(nproc) - make abi-check - make pic-check @@ -74,6 +74,9 @@ abi-coverage.Fedora: expire_in: 1 week when: on_failure paths: + - ./*.xml + - ./gnutls-prev-abi.tmp/ + - compat_reports/ - tests/*.log - tests/*/*.log - tests/suite/*/*.log diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ddae0821e..cc63fe07d0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -113,6 +113,10 @@ As such, some questions to answer before adding a new API: 13.0 is made available? Would it harm the addition of a new protocol? +The make rule 'abi-check' verifies that the ABI remained compatible since +the last tagged release. It relies on the git tree and abi-compliance-checker. + + # Constructed types: The constructed types in gnutls always have the ```gnutls_``` prefix. diff --git a/Makefile.am b/Makefile.am index 200e356d4a..5b2c979a32 100644 --- a/Makefile.am +++ b/Makefile.am @@ -55,8 +55,6 @@ ACLOCAL_AMFLAGS = -I m4 -I gl/m4 -I src/libopts/m4 -I src/gl/m4 -I lib/unistring EXTRA_DIST = cfg.mk maint.mk CONTRIBUTING.md README.md LICENSE AUTHORS NEWS \ ChangeLog THANKS INSTALL.md -TMPFILE="abi-temp.xml" - pic-check: @echo "Checking for position dependent code" readelf -d $(builddir)/lib/.libs/libgnutls.so|grep TEXTREL; if test $$? = 0;then \ @@ -66,29 +64,49 @@ pic-check: abi-dump: @abi-dumper lib/.libs/libgnutls.so -lver $(VERSION) -o "./devel/ABI-$(VERSION)-$$(uname -m).dump" -public-headers lib/includes/gnutls/ - @echo "*******************************************************************************" - @echo "You need to modify Makefile.am abi-check rule if you need to check this release" - @echo "*******************************************************************************" -abi-check: - @rm -f $(TMPFILE) +ABI_TMPCLONEDIR="gnutls-prev-abi.tmp" +ABI_TMPFILE_CUR="abi-temp-cur.xml" +ABI_TMPFILE_PRE="abi-temp-prev.xml" +ABIREF := $(shell git for-each-ref --sort=taggerdate --format '%(refname)' refs/tags|tail -1) +ABIVER := $(shell git for-each-ref --sort=taggerdate --format '%(refname)' refs/tags|tail -1|cut -d '/' -f 3|sed -e 's/gnutls_//' -e 's/_/./g') +prev-tag-abi.stamp: + @rm -rf $(ABI_TMPCLONEDIR) + @git clone -l . $(ABI_TMPCLONEDIR) + @echo "Creating ABI for $(ABIVER)" + cd $(ABI_TMPCLONEDIR) && \ + git checkout $(ABIREF) && \ + make autoreconf && CFLAGS="-g -Og" ./configure --disable-doc && \ + $(MAKE) -j$$(nproc) -C gl && $(MAKE) -j$$(nproc) -C lib && $(MAKE) -j$$(nproc) -C libdane + touch $@ + +abi-check: prev-tag-abi.stamp + @rm -f $(ABI_TMPFILE_CUR) $(ABI_TMPFILE_PRE) @echo "Checking libgnutls ABI" - @echo "$(VERSION)" >$(TMPFILE) - @echo "$(srcdir)/lib/includes/gnutls" >>$(TMPFILE) - @echo "$(builddir)/lib/includes/gnutls" >>$(TMPFILE) - @echo "$(builddir)/lib/.libs" >>$(TMPFILE) - for i in 3.4.0 3.4.17 3.5.8 3.6.0;do \ - test ! -f "$(srcdir)/devel/ABI-$$i-$$(uname -m).dump" || \ - abi-compliance-checker -abi -lib gnutls -old "$(srcdir)/devel/ABI-$$i-$$(uname -m).dump" -new $(TMPFILE) -skip-symbols $(srcdir)/devel/abi-unchecked-symbols; \ - done + @echo "$(VERSION)" >$(ABI_TMPFILE_CUR) + @echo "$(srcdir)/lib/includes/gnutls" >>$(ABI_TMPFILE_CUR) + @echo "$(builddir)/lib/includes/gnutls" >>$(ABI_TMPFILE_CUR) + @echo "$(builddir)/lib/.libs" >>$(ABI_TMPFILE_CUR) + @echo "$(ABIVER)" >$(ABI_TMPFILE_PRE) + @echo "$(builddir)/$(ABI_TMPCLONEDIR)/lib/includes/gnutls" >>$(ABI_TMPFILE_PRE) + @echo "$(builddir)/$(ABI_TMPCLONEDIR)/lib/includes/gnutls" >>$(ABI_TMPFILE_PRE) + @echo "$(builddir)/$(ABI_TMPCLONEDIR)/lib/.libs" >>$(ABI_TMPFILE_PRE) + PATH="/sbin$(PATH_SEPARATOR)$$PATH" \ + abi-compliance-checker -abi -lib gnutls -old $(ABI_TMPFILE_PRE) -new $(ABI_TMPFILE_CUR) -skip-symbols $(srcdir)/devel/abi-unchecked-symbols @echo "Checking libgnutls-dane ABI" - @echo "$(VERSION)" >$(TMPFILE) - @echo "$(srcdir)/libdane/includes/gnutls" >>$(TMPFILE) - @echo "$(srcdir)/lib/includes/gnutls" >>$(TMPFILE) - @echo "$(builddir)/lib/includes/gnutls" >>$(TMPFILE) - @echo "$(builddir)/libdane/.libs" >>$(TMPFILE) - test ! -f "$(srcdir)/devel/ABI-dane-$$(uname -m).dump" || abi-compliance-checker -abi -lib gnutls-dane -old "$(srcdir)/devel/ABI-dane-$$(uname -m).dump" -new $(TMPFILE) - @rm -f $(TMPFILE) + @echo "$(VERSION)" >$(ABI_TMPFILE_CUR) + @echo "$(srcdir)/libdane/includes/gnutls" >>$(ABI_TMPFILE_CUR) + @echo "$(srcdir)/lib/includes/gnutls" >>$(ABI_TMPFILE_CUR) + @echo "$(builddir)/lib/includes/gnutls" >>$(ABI_TMPFILE_CUR) + @echo "$(builddir)/libdane/.libs" >>$(ABI_TMPFILE_CUR) + @echo "3.5.0" >$(ABI_TMPFILE_PRE) + @echo "$(builddir)/$(ABI_TMPCLONEDIR)/libdane/includes/gnutls" >>$(ABI_TMPFILE_PRE) + @echo "$(builddir)/$(ABI_TMPCLONEDIR)/lib/includes/gnutls" >>$(ABI_TMPFILE_PRE) + @echo "$(builddir)/$(ABI_TMPCLONEDIR)/lib/includes/gnutls" >>$(ABI_TMPFILE_PRE) + @echo "$(builddir)/$(ABI_TMPCLONEDIR)/libdane/.libs" >>$(ABI_TMPFILE_PRE) + PATH="/sbin$(PATH_SEPARATOR)$$PATH" \ + abi-compliance-checker -abi -lib gnutls-dane -old $(ABI_TMPFILE_PRE) -new $(ABI_TMPFILE_CUR) + @rm -f $(ABI_TMPFILE_CUR) $(ABI_TMPFILE_PRE) symbol-check: @objdump -T $(builddir)/lib/.libs/libgnutls.so | grep -v ' \*UND\*' | awk '{print $$7 "@" $$6;}' | grep -v GNUTLS_FIPS140 | grep -v GNUTLS_PRIVATE | grep -v '^@' | sort -u >symbols.last.tmp @@ -141,7 +159,7 @@ files-update: libopts-check @echo "updated auto-generated files; please use git diff to verify the correctness of the changes" @echo "******************************************************************************************" -dist-hook: libopts-check symbol-check abi-check +dist-hook: libopts-check symbol-check make -C doc/ compare-makefile make -C doc/ compare-exported make -C doc/manpages compare-makefile -- cgit v1.2.1