public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-portage-dev] [PATCH v2] _post_src_install_soname_symlinks: fix bug 543818
  @ 2015-03-22 18:10 99% ` Zac Medico
  0 siblings, 0 replies; 1+ results
From: Zac Medico @ 2015-03-22 18:10 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

The SonameDepsProcessor.add() method raises AssertionError if the
multilib category of an ELF file is not recognized. It's not possible
to account for soname dependencies in this case (the file is probably
intended for a foreign architecture), so avoid the AssertionError and
generate an eqawarn message for this case. The eqawarn message is
suppressed for files matched by the QA_PREBUILT variable.

X-Gentoo-Bug: 543818
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=543818
---
PATCH v2 fixes inverted logic for the QA Notice, so that warnings will
be correctly suppressed for files matched by the QA_PREBUILT variable.

 bin/phase-functions.sh                 |  2 +-
 pym/portage/package/ebuild/doebuild.py | 59 +++++++++++++++++++++++-----------
 2 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index def2080..2743e27 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -580,7 +580,7 @@ __dyn_install() {
 		for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \
 			CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
 			LDFLAGS LIBCFLAGS LIBCXXFLAGS QA_CONFIGURE_OPTIONS \
-			QA_DESKTOP_FILE PROVIDES_EXCLUDE REQUIRES_EXCLUDE ; do
+			QA_DESKTOP_FILE QA_PREBUILT PROVIDES_EXCLUDE REQUIRES_EXCLUDE ; do
 			x=$(echo -n ${!f})
 			[[ -n $x ]] && echo "$x" > $f
 		done
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 94785b5..3c31eba 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -8,6 +8,7 @@ __all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild']
 import grp
 import gzip
 import errno
+import fnmatch
 import io
 from itertools import chain
 import logging
@@ -2209,24 +2210,29 @@ def _post_src_install_soname_symlinks(mysettings, out):
 		if f is not None:
 			f.close()
 
-	qa_no_symlink = ""
-	f = None
-	try:
-		f = io.open(_unicode_encode(os.path.join(
-			mysettings["PORTAGE_BUILDDIR"],
-			"build-info", "QA_SONAME_NO_SYMLINK"),
-			encoding=_encodings['fs'], errors='strict'),
-			mode='r', encoding=_encodings['repo.content'],
-			errors='replace')
-		qa_no_symlink = f.read()
-	except IOError as e:
-		if e.errno not in (errno.ENOENT, errno.ESTALE):
-			raise
-	finally:
-		if f is not None:
-			f.close()
+	metadata = {}
+	for k in ("QA_PREBUILT", "QA_NO_SYMLINK"):
+		try:
+			with io.open(_unicode_encode(os.path.join(
+				mysettings["PORTAGE_BUILDDIR"],
+				"build-info", k),
+				encoding=_encodings['fs'], errors='strict'),
+				mode='r', encoding=_encodings['repo.content'],
+				errors='replace') as f:
+				v = f.read()
+		except IOError as e:
+			if e.errno not in (errno.ENOENT, errno.ESTALE):
+				raise
+		else:
+			metadata[k] = v
+
+	qa_prebuilt = metadata.get("QA_PREBUILT", "").strip()
+	if qa_prebuilt:
+		qa_prebuilt = re.compile("|".join(
+			fnmatch.translate(x.lstrip(os.sep))
+			for x in portage.util.shlex_split(qa_prebuilt)))
 
-	qa_no_symlink = qa_no_symlink.split()
+	qa_no_symlink = metadata.get("QA_NO_SYMLINK", "").split()
 	if qa_no_symlink:
 		if len(qa_no_symlink) > 1:
 			qa_no_symlink = "|".join("(%s)" % x for x in qa_no_symlink)
@@ -2297,6 +2303,7 @@ def _post_src_install_soname_symlinks(mysettings, out):
 		requires_exclude = ""
 
 	missing_symlinks = []
+	unrecognized_elf_files = []
 	soname_deps = SonameDepsProcessor(
 		provides_exclude, requires_exclude)
 
@@ -2326,7 +2333,14 @@ def _post_src_install_soname_symlinks(mysettings, out):
 		entry.multilib_category = compute_multilib_category(elf_header)
 		needed_file.write(_unicode(entry))
 
-		soname_deps.add(entry)
+		if entry.multilib_category is None:
+			if qa_prebuilt.match(
+				entry.filename[len(mysettings["EPREFIX"]):].lstrip(
+				os.sep)) is None:
+				unrecognized_elf_files.append(entry)
+		else:
+			soname_deps.add(entry)
+
 		obj = entry.filename
 		soname = entry.soname
 
@@ -2365,6 +2379,15 @@ def _post_src_install_soname_symlinks(mysettings, out):
 			errors='strict') as f:
 			f.write(soname_deps.provides)
 
+	if unrecognized_elf_files:
+		qa_msg = ["QA Notice: Unrecognized ELF file(s):"]
+		qa_msg.append("")
+		qa_msg.extend("\t%s" % _unicode(entry).rstrip()
+			for entry in unrecognized_elf_files)
+		qa_msg.append("")
+		for line in qa_msg:
+			eqawarn(line, key=mysettings.mycpv, out=out)
+
 	if not missing_symlinks:
 		return
 
-- 
2.3.1



^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-03-22  0:10     [gentoo-portage-dev] [PATCH] _post_src_install_soname_symlinks: fix bug 543818 Zac Medico
2015-03-22 18:10 99% ` [gentoo-portage-dev] [PATCH v2] " Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox