Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] _post_src_install_soname_symlinks: fix bug 543818
Date: Sun, 22 Mar 2015 00:11:20
Message-Id: 1426983046-6507-1-git-send-email-zmedico@gentoo.org
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 bin/phase-functions.sh | 2 +-
12 pym/portage/package/ebuild/doebuild.py | 59 +++++++++++++++++++++++-----------
13 2 files changed, 42 insertions(+), 19 deletions(-)
14
15 diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
16 index def2080..2743e27 100644
17 --- a/bin/phase-functions.sh
18 +++ b/bin/phase-functions.sh
19 @@ -580,7 +580,7 @@ __dyn_install() {
20 for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \
21 CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
22 LDFLAGS LIBCFLAGS LIBCXXFLAGS QA_CONFIGURE_OPTIONS \
23 - QA_DESKTOP_FILE PROVIDES_EXCLUDE REQUIRES_EXCLUDE ; do
24 + QA_DESKTOP_FILE QA_PREBUILT PROVIDES_EXCLUDE REQUIRES_EXCLUDE ; do
25 x=$(echo -n ${!f})
26 [[ -n $x ]] && echo "$x" > $f
27 done
28 diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
29 index 94785b5..6f49f70 100644
30 --- a/pym/portage/package/ebuild/doebuild.py
31 +++ b/pym/portage/package/ebuild/doebuild.py
32 @@ -8,6 +8,7 @@ __all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild']
33 import grp
34 import gzip
35 import errno
36 +import fnmatch
37 import io
38 from itertools import chain
39 import logging
40 @@ -2209,24 +2210,29 @@ def _post_src_install_soname_symlinks(mysettings, out):
41 if f is not None:
42 f.close()
43
44 - qa_no_symlink = ""
45 - f = None
46 - try:
47 - f = io.open(_unicode_encode(os.path.join(
48 - mysettings["PORTAGE_BUILDDIR"],
49 - "build-info", "QA_SONAME_NO_SYMLINK"),
50 - encoding=_encodings['fs'], errors='strict'),
51 - mode='r', encoding=_encodings['repo.content'],
52 - errors='replace')
53 - qa_no_symlink = f.read()
54 - except IOError as e:
55 - if e.errno not in (errno.ENOENT, errno.ESTALE):
56 - raise
57 - finally:
58 - if f is not None:
59 - f.close()
60 + metadata = {}
61 + for k in ("QA_PREBUILT", "QA_NO_SYMLINK"):
62 + try:
63 + with io.open(_unicode_encode(os.path.join(
64 + mysettings["PORTAGE_BUILDDIR"],
65 + "build-info", k),
66 + encoding=_encodings['fs'], errors='strict'),
67 + mode='r', encoding=_encodings['repo.content'],
68 + errors='replace') as f:
69 + v = f.read()
70 + except IOError as e:
71 + if e.errno not in (errno.ENOENT, errno.ESTALE):
72 + raise
73 + else:
74 + metadata[k] = v
75 +
76 + qa_prebuilt = metadata.get("QA_PREBUILT", "").strip()
77 + if qa_prebuilt:
78 + qa_prebuilt = re.compile("|".join(
79 + fnmatch.translate(x.lstrip(os.sep))
80 + for x in portage.util.shlex_split(qa_prebuilt)))
81
82 - qa_no_symlink = qa_no_symlink.split()
83 + qa_no_symlink = metadata.get("QA_NO_SYMLINK", "").split()
84 if qa_no_symlink:
85 if len(qa_no_symlink) > 1:
86 qa_no_symlink = "|".join("(%s)" % x for x in qa_no_symlink)
87 @@ -2297,6 +2303,7 @@ def _post_src_install_soname_symlinks(mysettings, out):
88 requires_exclude = ""
89
90 missing_symlinks = []
91 + unrecognized_elf_files = []
92 soname_deps = SonameDepsProcessor(
93 provides_exclude, requires_exclude)
94
95 @@ -2326,7 +2333,14 @@ def _post_src_install_soname_symlinks(mysettings, out):
96 entry.multilib_category = compute_multilib_category(elf_header)
97 needed_file.write(_unicode(entry))
98
99 - soname_deps.add(entry)
100 + if entry.multilib_category is None:
101 + if qa_prebuilt.match(
102 + entry.filename[len(mysettings["EPREFIX"]):].lstrip(
103 + os.sep)) is not None:
104 + unrecognized_elf_files.append(entry)
105 + else:
106 + soname_deps.add(entry)
107 +
108 obj = entry.filename
109 soname = entry.soname
110
111 @@ -2365,6 +2379,15 @@ def _post_src_install_soname_symlinks(mysettings, out):
112 errors='strict') as f:
113 f.write(soname_deps.provides)
114
115 + if unrecognized_elf_files:
116 + qa_msg = ["QA Notice: Unrecognized ELF file(s):"]
117 + qa_msg.append("")
118 + qa_msg.extend("\t%s" % _unicode(entry).rstrip()
119 + for entry in unrecognized_elf_files)
120 + qa_msg.append("")
121 + for line in qa_msg:
122 + eqawarn(line, key=mysettings.mycpv, out=out)
123 +
124 if not missing_symlinks:
125 return
126
127 --
128 2.3.1

Replies