1 |
The SonameDepsProcessor.add() method raises AssertionError if the |
2 |
multilib category of an ELF file is not recognized. It's not possible |
3 |
to account for soname dependencies in this case (the file is probably |
4 |
intended for a foreign architecture), so avoid the AssertionError and |
5 |
generate an eqawarn message for this case. The eqawarn message is |
6 |
suppressed for files matched by the QA_PREBUILT variable. |
7 |
|
8 |
X-Gentoo-Bug: 543818 |
9 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=543818 |
10 |
--- |
11 |
PATCH v2 fixes inverted logic for the QA Notice, so that warnings will |
12 |
be correctly suppressed for files matched by the QA_PREBUILT variable. |
13 |
|
14 |
bin/phase-functions.sh | 2 +- |
15 |
pym/portage/package/ebuild/doebuild.py | 59 +++++++++++++++++++++++----------- |
16 |
2 files changed, 42 insertions(+), 19 deletions(-) |
17 |
|
18 |
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh |
19 |
index def2080..2743e27 100644 |
20 |
--- a/bin/phase-functions.sh |
21 |
+++ b/bin/phase-functions.sh |
22 |
@@ -580,7 +580,7 @@ __dyn_install() { |
23 |
for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \ |
24 |
CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \ |
25 |
LDFLAGS LIBCFLAGS LIBCXXFLAGS QA_CONFIGURE_OPTIONS \ |
26 |
- QA_DESKTOP_FILE PROVIDES_EXCLUDE REQUIRES_EXCLUDE ; do |
27 |
+ QA_DESKTOP_FILE QA_PREBUILT PROVIDES_EXCLUDE REQUIRES_EXCLUDE ; do |
28 |
x=$(echo -n ${!f}) |
29 |
[[ -n $x ]] && echo "$x" > $f |
30 |
done |
31 |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
32 |
index 94785b5..3c31eba 100644 |
33 |
--- a/pym/portage/package/ebuild/doebuild.py |
34 |
+++ b/pym/portage/package/ebuild/doebuild.py |
35 |
@@ -8,6 +8,7 @@ __all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild'] |
36 |
import grp |
37 |
import gzip |
38 |
import errno |
39 |
+import fnmatch |
40 |
import io |
41 |
from itertools import chain |
42 |
import logging |
43 |
@@ -2209,24 +2210,29 @@ def _post_src_install_soname_symlinks(mysettings, out): |
44 |
if f is not None: |
45 |
f.close() |
46 |
|
47 |
- qa_no_symlink = "" |
48 |
- f = None |
49 |
- try: |
50 |
- f = io.open(_unicode_encode(os.path.join( |
51 |
- mysettings["PORTAGE_BUILDDIR"], |
52 |
- "build-info", "QA_SONAME_NO_SYMLINK"), |
53 |
- encoding=_encodings['fs'], errors='strict'), |
54 |
- mode='r', encoding=_encodings['repo.content'], |
55 |
- errors='replace') |
56 |
- qa_no_symlink = f.read() |
57 |
- except IOError as e: |
58 |
- if e.errno not in (errno.ENOENT, errno.ESTALE): |
59 |
- raise |
60 |
- finally: |
61 |
- if f is not None: |
62 |
- f.close() |
63 |
+ metadata = {} |
64 |
+ for k in ("QA_PREBUILT", "QA_NO_SYMLINK"): |
65 |
+ try: |
66 |
+ with io.open(_unicode_encode(os.path.join( |
67 |
+ mysettings["PORTAGE_BUILDDIR"], |
68 |
+ "build-info", k), |
69 |
+ encoding=_encodings['fs'], errors='strict'), |
70 |
+ mode='r', encoding=_encodings['repo.content'], |
71 |
+ errors='replace') as f: |
72 |
+ v = f.read() |
73 |
+ except IOError as e: |
74 |
+ if e.errno not in (errno.ENOENT, errno.ESTALE): |
75 |
+ raise |
76 |
+ else: |
77 |
+ metadata[k] = v |
78 |
+ |
79 |
+ qa_prebuilt = metadata.get("QA_PREBUILT", "").strip() |
80 |
+ if qa_prebuilt: |
81 |
+ qa_prebuilt = re.compile("|".join( |
82 |
+ fnmatch.translate(x.lstrip(os.sep)) |
83 |
+ for x in portage.util.shlex_split(qa_prebuilt))) |
84 |
|
85 |
- qa_no_symlink = qa_no_symlink.split() |
86 |
+ qa_no_symlink = metadata.get("QA_NO_SYMLINK", "").split() |
87 |
if qa_no_symlink: |
88 |
if len(qa_no_symlink) > 1: |
89 |
qa_no_symlink = "|".join("(%s)" % x for x in qa_no_symlink) |
90 |
@@ -2297,6 +2303,7 @@ def _post_src_install_soname_symlinks(mysettings, out): |
91 |
requires_exclude = "" |
92 |
|
93 |
missing_symlinks = [] |
94 |
+ unrecognized_elf_files = [] |
95 |
soname_deps = SonameDepsProcessor( |
96 |
provides_exclude, requires_exclude) |
97 |
|
98 |
@@ -2326,7 +2333,14 @@ def _post_src_install_soname_symlinks(mysettings, out): |
99 |
entry.multilib_category = compute_multilib_category(elf_header) |
100 |
needed_file.write(_unicode(entry)) |
101 |
|
102 |
- soname_deps.add(entry) |
103 |
+ if entry.multilib_category is None: |
104 |
+ if qa_prebuilt.match( |
105 |
+ entry.filename[len(mysettings["EPREFIX"]):].lstrip( |
106 |
+ os.sep)) is None: |
107 |
+ unrecognized_elf_files.append(entry) |
108 |
+ else: |
109 |
+ soname_deps.add(entry) |
110 |
+ |
111 |
obj = entry.filename |
112 |
soname = entry.soname |
113 |
|
114 |
@@ -2365,6 +2379,15 @@ def _post_src_install_soname_symlinks(mysettings, out): |
115 |
errors='strict') as f: |
116 |
f.write(soname_deps.provides) |
117 |
|
118 |
+ if unrecognized_elf_files: |
119 |
+ qa_msg = ["QA Notice: Unrecognized ELF file(s):"] |
120 |
+ qa_msg.append("") |
121 |
+ qa_msg.extend("\t%s" % _unicode(entry).rstrip() |
122 |
+ for entry in unrecognized_elf_files) |
123 |
+ qa_msg.append("") |
124 |
+ for line in qa_msg: |
125 |
+ eqawarn(line, key=mysettings.mycpv, out=out) |
126 |
+ |
127 |
if not missing_symlinks: |
128 |
return |
129 |
|
130 |
-- |
131 |
2.3.1 |