summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/__init__.py13
-rw-r--r--pym/portage/__init__.py12
2 files changed, 20 insertions, 5 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index fc320ad75..617a81ec1 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -2867,17 +2867,26 @@ class EbuildMetadataPhase(SubProcess):
files = self._files
self._raw_metadata.append(files.ebuild.read())
if not self._raw_metadata[-1]:
+ # Split lines here so they can be counted inside _set_returncode().
+ self._raw_metadata = "".join(self._raw_metadata).splitlines()
self._unregister()
self.wait()
if self.returncode == os.EX_OK:
- metadata = izip(portage.auxdbkeys,
- "".join(self._raw_metadata).splitlines())
+ metadata = izip(portage.auxdbkeys, self._raw_metadata)
self.metadata_callback(self.cpv, self.ebuild_path,
self.repo_path, metadata, self.ebuild_mtime)
return self._registered
+ def _set_returncode(self, wait_retval):
+ SubProcess._set_returncode(self, wait_retval)
+ if self.returncode == os.EX_OK and \
+ len(portage.auxdbkeys) != len(self._raw_metadata):
+ # Don't trust bash's returncode if the
+ # number of lines is incorrect.
+ self.returncode = 1
+
class EbuildProcess(SpawnProcess):
__slots__ = ("phase", "pkg", "settings", "tree")
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 5e6fc9125..cf966195a 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -5504,9 +5504,15 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
# shift in order to distinguish it from a return value. (just
# like portage.process.spawn() would do).
if retval & 0xff:
- return (retval & 0xff) << 8
- # Otherwise, return its exit code.
- return retval >> 8
+ retval = (retval & 0xff) << 8
+ else:
+ # Otherwise, return its exit code.
+ retval = retval >> 8
+ if retval == os.EX_OK and len(dbkey) != len(auxdbkeys):
+ # Don't trust bash's returncode if the
+ # number of lines is incorrect.
+ retval = 1
+ return retval
elif dbkey:
mysettings["dbkey"] = dbkey
else: