Skip to contentSkip to conversation

insane.bbclass: Warning for so file version mismatch

PATCH New [email protected] 2 participants 3 messages Apr 14, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 insane.bbclass: Warning for so file version mismatch

Adds a warning if a package produces a .so file with a version that doesn't match the package PV.

This will catch issues like the one in a recent lua version where the .so file was getting the wrong version number.

The following changes since commit 5d47cdf448b6cff5bb7cc5b0ba0426b8235ec478:

build-appliance-image: Update to master head revision (2020-04-07 22:15:35 +0100)

are available in the Git repository at:

git://push.yoctoproject.org/poky-contrib mwillard/so-version-warning

Mike Willard (1):
insane.bbclass: Warning for so file version mismatch

 meta/classes/insane.bbclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 insane.bbclass: Warning for so file version mismatch

Adds a warning if a package produces a .so file with a version that doesn't match the package PV.

---
 meta/classes/insane.bbclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +19 -1
index 478240fa57..bb7f625667 100644
@@ -28,7 +28,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
             pn-overrides infodir build-deps src-uri-bad \
             unknown-configure-option symlink-to-sysroot multilib \
             invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \
-            mime mime-xdg \
+            mime mime-xdg so-file-version \
             "
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
             perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -488,6 +488,24 @@ def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages):
                 trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "")
                 package_qa_add_message(messages, "symlink-to-sysroot", "Symlink %s in %s points to TMPDIR" % (trimmed, name))
 
+QAPATHTEST[so-file-version] = "package_qa_check_so_file_version"
+def package_qa_check_so_file_version(path, name, d, elf, messages):
+    """
+    Check for ".so" files that do not match the package version
+    """
+    import re
+
+    pv = d.getVar('PV')
+    # Search for .so file with version number following
+    prog = re.compile(r'.*\.so\.(\d+\.\d+\.\d+)')
+    matches = prog.findall(path)
+    if len(matches) > 0:
+        so_file_version = matches[0]
+        if so_file_version != pv:
+            package_qa_add_message(messages, "so-file-version",
+                ".so file version does not match package version:\nFile: {}\nFile version:\t{}\nPV:\t\t{}\n".format(
+                    path, so_file_version, pv))
+
 # Check license variables
 do_populate_lic[postfuncs] += "populate_lic_qa_checksum"
 python populate_lic_qa_checksum() {
Signature · 1 line
2.17.1
#2 lore raw
Quoted 3 lines · Mike Willard

Adds a warning if a package produces a .so file with a version that doesn't match the package PV.

These versions are not expected to match and it's easy to find examples where they do not, e.g. curl 7.69.1 creates libcurl.so.4.6.0.

Quoted 47 lines
---
 meta/classes/insane.bbclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +19 -2
index 478240fa57..bb7f625667 100644
@@ -28,7 +28,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
             pn-overrides infodir build-deps src-uri-bad \
             unknown-configure-option symlink-to-sysroot multilib \
             invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \
-            mime mime-xdg \
+            mime mime-xdg so-file-version \
             "
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
             perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -488,6 +488,24 @@ def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages):
                 trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "")
                 package_qa_add_message(messages, "symlink-to-sysroot", "Symlink %s in %s points to TMPDIR" % (trimmed, name))
 
+QAPATHTEST[so-file-version] = "package_qa_check_so_file_version"
+def package_qa_check_so_file_version(path, name, d, elf, messages):
+    """
+    Check for ".so" files that do not match the package version
+    """
+    import re
+
+    pv = d.getVar('PV')
+    # Search for .so file with version number following
+    prog = re.compile(r'.*\.so\.(\d+\.\d+\.\d+)')
+    matches = prog.findall(path)
+    if len(matches) > 0:
+        so_file_version = matches[0]
+        if so_file_version != pv:
+            package_qa_add_message(messages, "so-file-version",
+                ".so file version does not match package version:\nFile: {}\nFile version:\t{}\nPV:\t\t{}\n".format(
+                    path, so_file_version, pv))
+
 # Check license variables
 do_populate_lic[postfuncs] += "populate_lic_qa_checksum"
 python populate_lic_qa_checksum() {
--

2.17.1