Fix SubProcess instances to call _set_returncode() when appropriate,
authorZac Medico <zmedico@gentoo.org>
Sun, 15 Aug 2010 21:34:14 +0000 (14:34 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 15 Aug 2010 21:34:14 +0000 (14:34 -0700)
instead of setting self.returncode directly.

pym/_emerge/BinpkgFetcher.py
pym/_emerge/EbuildFetcher.py
pym/_emerge/EbuildMetadataPhase.py
pym/_emerge/SpawnProcess.py

index 5677419e791b116971ff339cfa4a701a1591ea86..0032e601db194943ee47c67b764a0d0f111d4052 100644 (file)
@@ -63,7 +63,7 @@ class BinpkgFetcher(SpawnProcess):
 
                if pretend:
                        portage.writemsg_stdout("\n%s\n" % uri, noiselevel=-1)
-                       self.returncode = os.EX_OK
+                       self._set_returncode((self.pid, os.EX_OK))
                        self.wait()
                        return
 
@@ -102,7 +102,7 @@ class BinpkgFetcher(SpawnProcess):
 
        def _set_returncode(self, wait_retval):
                SpawnProcess._set_returncode(self, wait_retval)
-               if self.returncode == os.EX_OK:
+               if not self.pretend and self.returncode == os.EX_OK:
                        # If possible, update the mtime to match the remote package if
                        # the fetcher didn't already do it automatically.
                        bintree = self.pkg.root_config.trees["bintree"]
index 732a4be73bd9c54937c966709cdbc39d9601c47e..7f5bc6df40cf5f34dc2a42875cabed2b4c3e00d2 100644 (file)
@@ -33,13 +33,13 @@ class EbuildFetcher(SpawnProcess):
                                (self.pkg.cpv, e)
                        msg_lines.append(msg)
                        self._eerror(msg_lines)
-                       self.returncode = 1
+                       self._set_returncode((self.pid, 1))
                        self.wait()
                        return
 
                if not uri_map:
                        # Nothing to fetch.
-                       self.returncode = os.EX_OK
+                       self._set_returncode((self.pid, os.EX_OK))
                        self.wait()
                        return
 
@@ -49,7 +49,7 @@ class EbuildFetcher(SpawnProcess):
                if self.prefetch and \
                        self._prefetch_size_ok(uri_map, settings, ebuild_path):
                        self.config_pool.deallocate(settings)
-                       self.returncode = os.EX_OK
+                       self._set_returncode((self.pid, os.EX_OK))
                        self.wait()
                        return
 
index 1ad72b5497e6a2e0865d6c59ae87e37fe74786f0..eaa7f40b2d179ab5eb8aec3d3175a4bd80abf608 100644 (file)
@@ -46,7 +46,7 @@ class EbuildMetadataPhase(SubProcess):
                        if not portage.eapi_is_supported(eapi):
                                self.metadata_callback(self.cpv, self.ebuild_path,
                                        self.repo_path, {'EAPI' : eapi}, self.ebuild_mtime)
-                               self.returncode = os.EX_OK
+                               self._set_returncode((self.pid, os.EX_OK))
                                self.wait()
                                return
 
@@ -98,7 +98,7 @@ class EbuildMetadataPhase(SubProcess):
                if isinstance(retval, int):
                        # doebuild failed before spawning
                        self._unregister()
-                       self.returncode = retval
+                       self._set_returncode((self.pid, retval))
                        self.wait()
                        return
 
index e3acdc44cf0b77337a1e1750055ca5103cbfb373..6e0586815adef07efcfe84691e691c4ad4f54607 100644 (file)
@@ -120,7 +120,7 @@ class SpawnProcess(SubProcess):
                if isinstance(retval, int):
                        # spawn failed
                        self._unregister()
-                       self.returncode = retval
+                       self._set_returncode((self.pid, retval))
                        self.wait()
                        return