[gnome-build-meta/jjardon/336_abicheck: 2/2] Add ABI checker from freedesktop-sdk



commit f910ea092b30dd28745621e74bf5490e3cfb2762
Author: Thomas Coldrick <othko97 gmail com>
Date:   Sun Aug 25 09:18:44 2019 +0300

    Add ABI checker from freedesktop-sdk
    
    Adds the ABI checker as it currently stands in freedesktop-sdk.
    
    The ABI check is run on `abi/abi-image.bst`, which is an image
    constructed from the platform and the headers of the SDK. This is how
    things are done in freedesktop-sdk also.
    
    There is also `abidiff-suppressions.ini`, which allows for configuration
    of the ABI checker to ignore some libraries or symbols. This is copied
    from freedesktop-sdk also, as otherwise we would get failures from
    breakages allowed in freedesktop-sdk.
    
    [abi skip]

 .gitlab-ci.yml                 |  43 ++++++++++
 .gitmodules                    |   3 +
 elements/abi/abi-image.bst     |   5 ++
 elements/abi/sdk-headers.bst   |  12 +++
 utils/abidiff-suppressions.ini | 180 +++++++++++++++++++++++++++++++++++++++++
 utils/buildstream-abi-checker  |   1 +
 6 files changed, 244 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5dee5988..70fd72b0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,9 +15,12 @@ variables:
   DOCKER_AMD64: "${DOCKER_REGISTRY}/bst14/amd64:${DOCKER_IMAGE_ID}"
   DOCKER_AARCH64: "${DOCKER_REGISTRY}/bst14/arm64:${DOCKER_IMAGE_ID}"
 
+  GIT_SUBMODULE_STRATEGY: "recursive"
+
 stages:
 - track
 - build
+- abi_check
 - prepare_flatpak
 - flatpak
 - finish_flatpak
@@ -102,6 +105,30 @@ default:
     - project.refs
     - image
     expire_in: 1 week
+  rules:
+  - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^gnome-\d-\d\d$/'
+    when: always
+
+.abi-template:
+  stage: abi_check
+  script:
+  - ${BST} -o arch "${ARCH}" build flatpak/platform-image.bst flatpak/sdk-image.bst
+  - export REFERENCE=$(git merge-base origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME HEAD)
+  - ./utils/buildstream-abi-checker/check-abi --suppressions=utils/abidiff-suppressions.ini 
--old="${REFERENCE}" --new=HEAD abi/abi-image.bst
+  cache: &bst-cache
+    key: bst-$FLATPAK_BRANCH
+    paths:
+    - "${XDG_CACHE_HOME}/buildstream/sources/"
+  # Store artifacts so we can inspect build failures
+  artifacts: &logging-artifacts
+    when: always
+    paths:
+    - logs
+    - project.refs
+    expire_in: 1 week
+  rules:
+  - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^gnome-\d-\d\d$/'
+    when: always
 
 .flatpak-template:
   stage: flatpak
@@ -214,6 +241,22 @@ build-gnome-core-arm:
   extends: .build-template
   <<: *arm
 
+abi-check-x86_64:
+  extends: .abi-template
+  <<: *x86_64
+
+abi-check-i386:
+  extends: .abi-template
+  <<: *i686
+
+abi-check-aarch64:
+  extends: .abi-template
+  <<: *aarch64
+
+abi-check-core-arm:
+  extends: .abi-template
+  <<: *arm
+
 
 flatpak-prepare:
   stage: prepare_flatpak
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 00000000..04ae20af
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "utils/buildstream-abi-checker"]
+       path = utils/buildstream-abi-checker
+       url = https://gitlab.com/freedesktop-sdk/buildstream-abi-checker.git
diff --git a/elements/abi/abi-image.bst b/elements/abi/abi-image.bst
new file mode 100644
index 00000000..2c16e346
--- /dev/null
+++ b/elements/abi/abi-image.bst
@@ -0,0 +1,5 @@
+kind: stack
+
+depends:
+- filename: flatpak/platform-image.bst
+- filename: abi/sdk-headers.bst
diff --git a/elements/abi/sdk-headers.bst b/elements/abi/sdk-headers.bst
new file mode 100644
index 00000000..aa1ecb25
--- /dev/null
+++ b/elements/abi/sdk-headers.bst
@@ -0,0 +1,12 @@
+kind: manual
+
+description: Extract the library headers from the desktop Sdk.
+
+depends:
+- filename: flatpak/sdk-image.bst
+  type: build
+
+config:
+  install-commands:
+  - mkdir -p %{install-root}%{includedir}
+  - cp -a %{includedir}/* %{install-root}%{includedir}
diff --git a/utils/abidiff-suppressions.ini b/utils/abidiff-suppressions.ini
new file mode 100644
index 00000000..ffc02176
--- /dev/null
+++ b/utils/abidiff-suppressions.ini
@@ -0,0 +1,180 @@
+# -- Begin rules for gdk-pixbuf -----------------------------------------------
+[suppress_file]
+label = gdk-pixbuf loaders are only used by the main gdk-pxbuf library
+file_name_regexp = ^libpixbufloader-.*\\.so.*
+drop = yes
+
+[suppress_function]
+label = Public functions in gdk-pixbuf all are namespaced
+soname_regexp = ^libgdk_pixbuf-2\\.0\\.so\\.0$
+name_not_regexp = ^gdk_(pixbuf|pixdata)_.*
+# -- End rules for gdk-pixbuf -------------------------------------------------
+
+# -- Begin rules for glib -----------------------------------------------------
+
+[suppress_function]
+label = Debug function in glib that was never supposed to be present in ABI
+soname_regexp = ^libglib-2.0.so.0$
+name_regexp = ^g_slice_debug_tree_statistics*
+
+# -- End rules for glib -------------------------------------------------------
+
+# -- Begin rules for harfbuzz -------------------------------------------------
+[suppress_file]
+label = Experimental library, its API changes regularly
+file_name_regexp = ^libharfbuzz-subset\\.so.*
+# -- End rules for harfbuzz ---------------------------------------------------
+
+
+# -- Begin rules for ibus -----------------------------------------------------
+[suppress_type]
+label = APIs used on the host, not inside Flatpak
+soname_regexp = ^libibus-1\\.0\\.so\\.5$
+name_regexp = IBus(Component|Config|Engine|LookupTable|PanelService|Registry).*
+drop = yes
+
+[suppress_function]
+label = APIs used on the host, not inside Flatpak
+soname_regexp = ^libibus-1\\.0\\.so\\.5$
+name_regexp = ^ibus_(component|config|engine|lookup_table|panel_service|registry)_.*
+drop = yes
+# -- End rules for ibus -------------------------------------------------------
+
+
+# -- Begin rules for libdrm ---------------------------------------------------
+[suppress_file]
+label = This is really only used by drivers
+file_name_regexp = ^libdrm_(amdgpu|etnaviv|freedreno|intel|nouveau|omap|radeon|tegra)\\.so.*
+# -- End rules for libdrm -----------------------------------------------------
+
+
+# -- Begin rules for libglvnd -------------------------------------------------
+[suppress_function]
+# https://github.com/KhronosGroup/OpenGL-Registry/commit/78379073350ef9cf99fe313e3392d19ae6c9744d
+label = Removed on purpose as it was misnamed, no app should have used it
+soname_regexp = libGL\\.so\\.1
+symbol_name = glMultiDrawElementsBaseVertexOES
+change_kind = deleted-function
+drop = yes
+# -- End rules for libglvnd ---------------------------------------------------
+
+
+# -- Begin rules for Mesa -----------------------------------------------------
+[suppress_function]
+label = Vulkan drivers export a lot of functions which are not actually part of ABI
+soname_regexp = ^libvulkan_.*\\.so$
+symbol_name_not_regexp = ^vk_.*
+change_kind = deleted-function
+drop = yes
+
+[suppress_file]
+label = lib*_mesa.so are not to be linked directly but to be used with dispatchers
+file_name_regexp = ^lib(EGL|GLX)_mesa\\.so.*$
+
+[suppress_file]
+label = libvulkan_o.so are not to be linked directly but to be used with dispatchers
+file_name_regexp = ^libvulkan_(radeon|intel)\\.so.*$
+
+[suppress_file]
+label = libglapi is a private library to Mesa
+file_name_regexp = ^libglapi\\.so.*$
+
+[suppress_file]
+label = libgallium_dri is a private library to Mesa
+file_name_regexp = ^libgallium_dri\\.so.*$
+# -- End rules for Mesa -------------------------------------------------------
+
+
+# -- Begin rules for Python ---------------------------------------------------
+[suppress_function]
+label = Private functions
+soname_regexp = ^libpython.*\\.so.*$
+symbol_name_regexp = ^(_py|_Py|_PY).*$
+drop = yes
+
+# -- End rules for Python -----------------------------------------------------
+
+
+# -- Begin rules for nss ------------------------------------------------------
+[suppress_type]
+label = Added enum values guarded by sentinel are safe
+type_kind = enum
+soname_regexp = ^libnss3\\.so|libsmime3\\.so|libnssutil3\\.so$
+changed_enumerators = SEC_OID_TOTAL
+# -- End rules for nss --------------------------------------------------------
+
+# -- Begin rules for seccomp --------------------------------------------------
+[suppress_type]
+label = Added enum values guarded by sentinel are safe
+type_kind = enum
+name = scmp_filter_attr
+soname_regexp = ^libseccomp\\.so\\.\\d+$
+changed_enumerators = _SCMP_FLTATR_MAX
+# -- End rules for seccomp ----------------------------------------------------
+
+
+# -- Begin rules for libcurl  -------------------------------------------------
+[suppress_type]
+label = Added enum values guarded by sentinel are safe
+type_kind = enum
+soname_regexp = ^libcurl\\.so\\.4$
+changed_enumerators = CURLOPT_LASTENTRY
+# -- End rules for nss --------------------------------------------------------
+
+
+# -- Begin rules for glibc ----------------------------------------------------
+[suppress_function]
+# https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=67c0579669ba1fc265d770252fab31babf887329
+label = Ignore functions symbols incorrectly exposed by glibc
+symbol_name_regexp = ^_fini|_init$
+change_kind = deleted-function
+# -- End rules for glibc ------------------------------------------------------
+
+
+# -- Begin rules for libabigail issues ----------------------------------------
+[suppress_file]
+# https://sourceware.org/bugzilla/show_bug.cgi?id=23596
+label = This takes more RAM than we have
+file_name_regexp = ^libLLVM-.*\\.so.*
+
+[suppress_file]
+# https://sourceware.org/bugzilla/show_bug.cgi?id=23596
+label = This takes more RAM than we have
+file_name_regexp = ^libclang\\.so.*
+
+[suppress_function]
+# https://sourceware.org/bugzilla/show_bug.cgi?id=23795
+label = Ignore libstdc++ symbols incorrectly exported by in other libraries
+soname_not_regexp = ^libstdc\\+\\+\\.so.*
+name_regexp = ^(__gnu_cxx|std\\:\\:__cxx11)\\:\\:.*
+# -- End rules for libabigail issues ------------------------------------------
+
+# -- Begin rules for libavcodec.so --------------------------------------------
+[suppress_function]
+label = av1_* symbols are libaom.so symbols not libavcodec.so
+soname_regexp = libavcodec\\.so\\.58
+symbol_name_regexp = ^av1_
+change_kind = deleted-function
+drop = yes
+
+[suppress_variable]
+label = av1_* symbols are libaom.so symbols not libavcodec.so
+soname_regexp = libavcodec\\.so\\.58
+symbol_name_regexp = ^av1_
+change_kind = deleted-variable
+drop = yes
+# -- End rules for libavcodec.so ----------------------------------------------
+
+# -- Begin rules for gnutls ---------------------------------------------------
+[suppress_function]
+# https://gitlab.com/gnutls/gnutls/issues/749#note_158170265
+label = Ignore functions with _gnutls prefix which are internal ones for unit testing
+soname_regexp = ^libgnutls\\.so\\.*
+symbol_name_regexp = ^_gnutls_*
+# -- End rules for gnutls  ----------------------------------------------------
+
+# -- Begin rules for pulseaudio -----------------------------------------------
+[suppress_file]
+label = Private library for pulseaudio
+file_name_regexp = ^libpulsecommon-.*\\.so
+# -- End rules for pulseaudio -------------------------------------------------
diff --git a/utils/buildstream-abi-checker b/utils/buildstream-abi-checker
new file mode 160000
index 00000000..7f4ae33f
--- /dev/null
+++ b/utils/buildstream-abi-checker
@@ -0,0 +1 @@
+Subproject commit 7f4ae33fa66bb90e51fb0f5a532433b54dc7da2a


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]