EbuildBuild: spawn nofetch for fetchonly
authorZac Medico <zmedico@gentoo.org>
Mon, 31 Jan 2011 22:10:14 +0000 (14:10 -0800)
committerZac Medico <zmedico@gentoo.org>
Wed, 2 Feb 2011 23:25:04 +0000 (15:25 -0800)
pym/_emerge/EbuildBuild.py

index 5645eade93cabac52eae6508bd8299ab0c600409..f7381ca5c0a160678c5706ba6a785290ef6c001b 100644 (file)
@@ -16,6 +16,7 @@ from portage import os
 from portage.output import colorize
 from portage.package.ebuild.digestcheck import digestcheck
 from portage.package.ebuild.doebuild import _check_temp_dir
+from portage.package.ebuild._spawn_nofetch import spawn_nofetch
 
 class EbuildBuild(CompositeTask):
 
@@ -118,6 +119,8 @@ class EbuildBuild(CompositeTask):
                                        settings=settings)
                                retval = fetcher.execute()
                                self.returncode = retval
+                               self.wait()
+                               return
                        else:
                                fetcher = EbuildFetcher(
                                        config_pool=self.config_pool,
@@ -127,11 +130,8 @@ class EbuildBuild(CompositeTask):
                                        logfile=None,
                                        pkg=self.pkg,
                                        scheduler=self.scheduler)
-                               fetcher.start()
-                               self.returncode = fetcher.wait()
-
-                       self.wait()
-                       return
+                               self._start_task(fetcher, self._fetchonly_exit)
+                               return
 
                self._build_dir = EbuildBuildDir(
                        scheduler=self.scheduler, settings=settings)
@@ -150,6 +150,13 @@ class EbuildBuild(CompositeTask):
                        phase='clean', scheduler=self.scheduler, settings=self.settings)
                self._start_task(pre_clean_phase, self._pre_clean_exit)
 
+       def _fetchonly_exit(self, fetcher):
+               self._final_exit(fetcher)
+               if self.returncode != os.EX_OK:
+                       portdb = self.pkg.root_config.trees[self._tree].dbapi
+                       spawn_nofetch(portdb, self._ebuild_path, settings=self.settings)
+               self.wait()
+
        def _pre_clean_exit(self, pre_clean_phase):
                if self._default_exit(pre_clean_phase) != os.EX_OK:
                        self._unlock_builddir()