Bug #233487 - Fix --fetch-all-uri breakage:
authorZac Medico <zmedico@gentoo.org>
Fri, 1 Aug 2008 00:47:23 +0000 (00:47 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 1 Aug 2008 00:47:23 +0000 (00:47 -0000)
* Make --fetch-all-uri imply --fetchonly so that all the --fetchonly
  conditionals apply to --fetch-all-uri as well.

* Add an EbuildFetcher.fetchall attribute, and also add the required
  support to portage.doebuild() for a "fetchall" phase that EbuildFetcher
  can invoke in the background via the ebuild(1) command.

svn path=/main/trunk/; revision=11303

pym/_emerge/__init__.py
pym/portage/__init__.py

index c99dfb09a22f0404e3c5f84a37d1d83380a3f6db..f002aa3186054403161be437b12582649b589108 100644 (file)
@@ -2227,7 +2227,7 @@ class MiscFunctionsProcess(SpawnProcess):
 
 class EbuildFetcher(SpawnProcess):
 
-       __slots__ = ("fetchonly", "pkg",)
+       __slots__ = ("fetchonly", "fetchall", "pkg",)
 
        def _start(self):
 
@@ -2235,6 +2235,9 @@ class EbuildFetcher(SpawnProcess):
                portdb = root_config.trees["porttree"].dbapi
                ebuild_path = portdb.findname(self.pkg.cpv)
                settings = root_config.settings
+               phase = "fetch"
+               if self.fetchall:
+                       phase = "fetchall"
 
                fetch_env = dict(settings.iteritems())
                fetch_env["PORTAGE_NICENESS"] = "0"
@@ -2244,7 +2247,7 @@ class EbuildFetcher(SpawnProcess):
                ebuild_binary = os.path.join(
                        settings["PORTAGE_BIN_PATH"], "ebuild")
 
-               fetch_args = [ebuild_binary, ebuild_path, "fetch"]
+               fetch_args = [ebuild_binary, ebuild_path, phase]
                debug = settings.get("PORTAGE_DEBUG") == "1"
                if debug:
                        fetch_args.append("--debug")
@@ -2396,7 +2399,8 @@ class EbuildBuild(CompositeTask):
                if self.background:
                        fetch_log = self.scheduler.fetch.log_file
 
-               fetcher = EbuildFetcher(fetchonly=opts.fetchonly,
+               fetcher = EbuildFetcher(fetchall=opts.fetch_all_uri,
+                       fetchonly=opts.fetchonly,
                        background=self.background, logfile=fetch_log,
                        pkg=pkg, scheduler=self.scheduler)
 
@@ -13399,6 +13403,9 @@ def emerge_main():
                        "--usepkg", "--usepkgonly"):
                        myopts.pop(opt, None)
 
+       if "--fetch-all-uri" in myopts:
+               myopts["--fetchonly"] = True
+
        if "--skipfirst" in myopts and "--resume" not in myopts:
                myopts["--resume"] = True
 
index e3e38868a0c8be3d16fb6c073acd4de6622c6fa5..f7abfe6c1ff10068c927a0396e41e871d055919c 100644 (file)
@@ -5061,7 +5061,8 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
 
        clean_phases = ("clean", "cleanrm")
        validcommands = ["help","clean","prerm","postrm","cleanrm","preinst","postinst",
-                       "config","info","setup","depend","fetch","digest",
+                       "config", "info", "setup", "depend",
+                       "fetch", "fetchall", "digest",
                        "unpack","compile","test","install","rpm","qmerge","merge",
                        "package","unmerge", "manifest"]
 
@@ -5076,6 +5077,10 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                writemsg("\n", noiselevel=-1)
                return 1
 
+       if mydo == "fetchall":
+               fetchall = 1
+               mydo = "fetch"
+
        if mydo not in clean_phases and not os.path.exists(myebuild):
                writemsg("!!! doebuild: %s not found for %s\n" % (myebuild, mydo),
                        noiselevel=-1)