public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH] _post_src_install_soname_symlinks: fix bug 543818
Date: Sat, 21 Mar 2015 17:10:46 -0700	[thread overview]
Message-ID: <1426983046-6507-1-git-send-email-zmedico@gentoo.org> (raw)

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
---
 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..6f49f70 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 not 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



             reply	other threads:[~2015-03-22  0:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-22  0:10 Zac Medico [this message]
2015-03-22 18:10 ` [gentoo-portage-dev] [PATCH v2] _post_src_install_soname_symlinks: fix bug 543818 Zac Medico
2015-03-22 18:43 ` [gentoo-portage-dev] [PATCH v3] " Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426983046-6507-1-git-send-email-zmedico@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox