commit:     cba2156dba89a22f2858238013469b4d80208854
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 28 04:40:09 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 28 04:52:18 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=cba2156d

portage/util/_dyn_libs/dyn_libs.py: add helper

Needed for binpkg/image verification commits coming...

Bug: https://bugs.gentoo.org/811462
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/util/_dyn_libs/dyn_libs.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/lib/portage/util/_dyn_libs/dyn_libs.py 
b/lib/portage/util/_dyn_libs/dyn_libs.py
new file mode 100644
index 000000000..2a014812c
--- /dev/null
+++ b/lib/portage/util/_dyn_libs/dyn_libs.py
@@ -0,0 +1,23 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+import glob
+
+from portage.output import colorize
+
+
+def check_dyn_libs_inconsistent(directory, provides):
+    """Checks directory for whether any dynamic libraries were installed and
+    if PROVIDES corresponds."""
+
+    # Let's check if we've got inconsistent results.
+    # If we're installing dynamic libraries (.so files), we should
+    # really have a PROVIDES.
+    # (This is a complementary check at the point of ingestion for the
+    # creation check in doebuild.py)
+    # Note: we could check a non-empty PROVIDES against the list of .sos,
+    # but this doesn't gain us anything. We're interested in failure
+    # to properly parse the installed files at all, which should really
+    # be a global problem (e.g. bug #811462)
+    installed_dynlibs = glob.glob(directory + "/**/*.so", recursive=True)
+    return installed_dynlibs and not provides

Reply via email to