commit:     38794780d573792ba92166291f9bf24b6a6c25aa
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  3 07:40:44 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Dec  3 07:40:44 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=38794780

EbuildPhase: filter unresolved soname deps from host system in Prefix

Libs like libc.so.1, libnsl.so.1, libsocket.so.1 etc. all come from the
host system, and cannot be provided by a package (unless we hack up a
VDB entry).  So, when operating under Prefix, check unresolved libs in
the host system.

Caveats:
- we don't check whether the endianness/bits match, anything that has
  the same name is fine
- we can also include libs that we shouldn't use, e.g. libxml2.so

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 lib/_emerge/EbuildPhase.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/_emerge/EbuildPhase.py b/lib/_emerge/EbuildPhase.py
index e4c0428a6..6d08d88d1 100644
--- a/lib/_emerge/EbuildPhase.py
+++ b/lib/_emerge/EbuildPhase.py
@@ -27,6 +27,8 @@ from portage.util._async.AsyncTaskFuture import 
AsyncTaskFuture
 from portage.util._async.BuildLogger import BuildLogger
 from portage.util.futures import asyncio
 from portage.util.futures.executor.fork import ForkExecutor
+# PREFIX LOCAL
+from portage.const import EPREFIX
 
 try:
        from portage.xml.metadata import MetaDataXML
@@ -505,6 +507,22 @@ class _PostPhaseCommands(CompositeTask):
 
                unresolved = 
_get_unresolved_soname_deps(os.path.join(self.settings['PORTAGE_BUILDDIR'], 
'build-info'), all_provides)
 
+               # BEGIN PREFIX LOCAL
+               if EPREFIX != "" and unresolved:
+                       # in prefix, consider the host libs for any unresolved 
libs,
+                       # so we kill warnings about missing libc.so.1, etc.
+                       for obj, libs in list(unresolved):
+                               unresolved.remove((obj, libs))
+                               libs=list(libs)
+                               for lib in list(libs):
+                                       for path in ['/lib64', '/lib/64', 
'/lib']:
+                                               if 
os.path.exists(os.path.join(path, lib)):
+                                                       libs.remove(lib)
+                                                       break
+                               if len(libs) > 0:
+                                       unresolved.add((obj, tuple(libs)))
+               # END PREFIX LOCAL
+
                if unresolved:
                        unresolved.sort()
                        qa_msg = ["QA Notice: Unresolved soname dependencies:"]

Reply via email to