1 |
This is part of a series of fixes for the linked bug (failure |
2 |
to preserve libraries in some situations). |
3 |
|
4 |
When unpacking a binpkg to be installed, we should check |
5 |
for the existence of PROVIDES if we're installing any |
6 |
dynamic libraries. If PROVIDES does not exist in that case, |
7 |
this suggests that e.g. scanelf malfunctioned or some corruption occurred. |
8 |
|
9 |
Bug: https://bugs.gentoo.org/811462 |
10 |
Signed-off-by: Sam James <sam@g.o> |
11 |
--- |
12 |
lib/_emerge/Binpkg.py | 28 +++++++++++++++++++++++++++- |
13 |
1 file changed, 27 insertions(+), 1 deletion(-) |
14 |
|
15 |
diff --git a/lib/_emerge/Binpkg.py b/lib/_emerge/Binpkg.py |
16 |
index c7dde69bd..9b876f354 100644 |
17 |
--- a/lib/_emerge/Binpkg.py |
18 |
+++ b/lib/_emerge/Binpkg.py |
19 |
@@ -2,7 +2,7 @@ |
20 |
# Distributed under the terms of the GNU General Public License v2 |
21 |
|
22 |
import functools |
23 |
- |
24 |
+import glob |
25 |
import _emerge.emergelog |
26 |
from _emerge.EbuildPhase import EbuildPhase |
27 |
from _emerge.BinpkgFetcher import BinpkgFetcher |
28 |
@@ -13,6 +13,7 @@ from _emerge.EbuildMerge import EbuildMerge |
29 |
from _emerge.EbuildBuildDir import EbuildBuildDir |
30 |
from _emerge.SpawnProcess import SpawnProcess |
31 |
from portage.eapi import eapi_exports_replace_vars |
32 |
+from portage.output import colorize |
33 |
from portage.util import ensure_dirs |
34 |
from portage.util._async.AsyncTaskFuture import AsyncTaskFuture |
35 |
import portage |
36 |
@@ -425,6 +426,31 @@ class Binpkg(CompositeTask): |
37 |
self._async_unlock_builddir(returncode=self.returncode) |
38 |
return |
39 |
|
40 |
+ # Before anything else, let's do an integrity check. |
41 |
+ (provides,) = self._bintree.dbapi.aux_get(self.pkg.cpv, ["PROVIDES"]) |
42 |
+ if not provides: |
43 |
+ # Let's check if we've got inconsistent results. |
44 |
+ # If we're installing dynamic libraries (.so files), we should |
45 |
+ # really have a PROVIDES. |
46 |
+ # (This is a complementary check at the point of ingestion for the |
47 |
+ # creation check in doebuild.py) |
48 |
+ # Note: we could check a non-empty PROVIDES against the list of .sos, |
49 |
+ # but this doesn't gain us anything. We're interested in failure |
50 |
+ # to properly parse the installed files at all, which should really |
51 |
+ # be a global problem (e.g. bug #811462) |
52 |
+ installed_dynlibs = glob.glob( |
53 |
+ self.settings["D"] + "/**/*.so", recursive=True |
54 |
+ ) |
55 |
+ if installed_dynlibs: |
56 |
+ self._writemsg_level( |
57 |
+ colorize( |
58 |
+ "BAD", |
59 |
+ "!!! Error! Installing dynamic libraries (.so) with blank PROVIDES!", |
60 |
+ ), |
61 |
+ noiselevel=-1, |
62 |
+ level=logging.ERROR, |
63 |
+ ) |
64 |
+ |
65 |
try: |
66 |
with io.open( |
67 |
_unicode_encode( |
68 |
-- |
69 |
2.33.0 |