summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/EbuildBuild.py7
-rw-r--r--pym/_emerge/EbuildExecuter.py8
-rw-r--r--pym/portage/package/ebuild/_spawn_nofetch.py6
-rw-r--r--pym/portage/package/ebuild/doebuild.py81
4 files changed, 40 insertions, 62 deletions
diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
index 235095842..1eab21d34 100644
--- a/pym/_emerge/EbuildBuild.py
+++ b/pym/_emerge/EbuildBuild.py
@@ -226,13 +226,6 @@ class EbuildBuild(CompositeTask):
return
self.returncode = None
- if "A" not in self.settings.configdict["pkg"]:
- mytree = os.path.dirname(os.path.dirname(
- os.path.dirname(self._ebuild_path)))
- portdb = self.pkg.root_config.trees[self._tree].dbapi
- fetch_map = portdb.getFetchMap(self.pkg.cpv,
- useflags=self.pkg.use.enabled, mytree=mytree)
- self.settings.configdict["pkg"]["A"] = " ".join(fetch_map)
nofetch_phase = EbuildPhase(background=self.background,
phase='nofetch', scheduler=self.scheduler, settings=self.settings)
self._start_task(nofetch_phase, self._nofetch_exit)
diff --git a/pym/_emerge/EbuildExecuter.py b/pym/_emerge/EbuildExecuter.py
index 419ee6b1a..d3a4dd8dd 100644
--- a/pym/_emerge/EbuildExecuter.py
+++ b/pym/_emerge/EbuildExecuter.py
@@ -35,13 +35,7 @@ class EbuildExecuter(CompositeTask):
portdb = pkg.root_config.trees['porttree'].dbapi
ebuild_path = settings['EBUILD']
- mytree = os.path.dirname(os.path.dirname(
- os.path.dirname(ebuild_path)))
- alist = portdb.getFetchMap(pkg.cpv,
- useflags=pkg.use.enabled, mytree=mytree)
- aalist = portdb.getFetchMap(pkg.cpv, mytree=mytree)
- settings.configdict["pkg"]["A"] = " ".join(alist)
- settings.configdict["pkg"]["AA"] = " ".join(aalist)
+ alist = settings.configdict["pkg"].get("A", "").split()
_prepare_fake_distdir(settings, alist)
if eapi_exports_replace_vars(settings['EAPI']):
diff --git a/pym/portage/package/ebuild/_spawn_nofetch.py b/pym/portage/package/ebuild/_spawn_nofetch.py
index 1678faf56..befdc89d4 100644
--- a/pym/portage/package/ebuild/_spawn_nofetch.py
+++ b/pym/portage/package/ebuild/_spawn_nofetch.py
@@ -60,12 +60,6 @@ def spawn_nofetch(portdb, ebuild_path, settings=None):
try:
doebuild_environment(ebuild_path, 'nofetch',
settings=settings, db=portdb)
- if "A" not in settings.configdict["pkg"]:
- mytree = os.path.dirname(os.path.dirname(
- os.path.dirname(ebuild_path)))
- fetch_map = portdb.getFetchMap(settings.mycpv,
- useflags=settings["PORTAGE_USE"].split(), mytree=mytree)
- settings.configdict["pkg"]["A"] = " ".join(fetch_map)
restrict = settings['PORTAGE_RESTRICT'].split()
defined_phases = settings['DEFINED_PHASES'].split()
if not defined_phases:
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index aeb3f864a..753b36af6 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -37,6 +37,7 @@ from portage.const import EBUILD_SH_ENV_FILE, EBUILD_SH_ENV_DIR, \
EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY
from portage.data import portage_gid, portage_uid, secpass, \
uid, userpriv_groups
+from portage.dbapi.porttree import _parse_uri_map
from portage.dbapi.virtual import fakedbapi
from portage.dep import Atom, paren_enclose, use_reduce
from portage.eapi import eapi_exports_KV, eapi_exports_merge_type, \
@@ -132,6 +133,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
mydbapi = db
ebuild_path = os.path.abspath(myebuild)
pkg_dir = os.path.dirname(ebuild_path)
+ mytree = os.path.dirname(os.path.dirname(pkg_dir))
if "CATEGORY" in mysettings.configdict["pkg"]:
cat = mysettings.configdict["pkg"]["CATEGORY"]
@@ -199,7 +201,6 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
mysettings["PF"] = mypv
if hasattr(mydbapi, '_repo_info'):
- mytree = os.path.dirname(os.path.dirname(pkg_dir))
repo_info = mydbapi._repo_info[mytree]
mysettings['PORTDIR'] = repo_info.portdir
mysettings['PORTDIR_OVERLAY'] = repo_info.portdir_overlay
@@ -240,6 +241,31 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
# can't do anything with this.
raise UnsupportedAPIException(mycpv, eapi)
+ if "A" not in mysettings.configdict["pkg"] or \
+ "AA" not in mysettings.configdict["pkg"]:
+ src_uri, = mydbapi.aux_get(mysettings.mycpv,
+ ["SRC_URI"], mytree=mytree)
+ metadata = {
+ "EAPI" : eapi,
+ "SRC_URI" : src_uri,
+ }
+ use = frozenset(mysettings["PORTAGE_USE"].split())
+ try:
+ uri_map = _parse_uri_map(mysettings.mycpv, metadata, use=use)
+ except InvalidDependString:
+ mysettings.configdict["pkg"]["A"] = ""
+ else:
+ mysettings.configdict["pkg"]["A"] = " ".join(uri_map)
+
+ # NOTE: We initialize AA here, regardless of EAPI, since
+ # it's used by doebuild() for fetchall support.
+ try:
+ uri_map = _parse_uri_map(mysettings.mycpv, metadata)
+ except InvalidDependString:
+ mysettings.configdict["pkg"]["AA"] = ""
+ else:
+ mysettings.configdict["pkg"]["AA"] = " ".join(uri_map)
+
if mysplit[2] == "r0":
mysettings["PVR"]=mysplit[1]
else:
@@ -681,50 +707,21 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
# Only try and fetch the files if we are going to need them ...
# otherwise, if user has FEATURES=noauto and they run `ebuild clean
# unpack compile install`, we will try and fetch 4 times :/
- need_distfiles = \
+ need_distfiles = tree == "porttree" and \
(mydo in ("fetch", "unpack") or \
mydo not in ("digest", "manifest") and "noauto" not in features)
- alist = mysettings.configdict["pkg"].get("A")
- aalist = mysettings.configdict["pkg"].get("AA")
- if not hasattr(mydbapi, 'getFetchMap'):
- if alist is None:
- alist = ""
- if aalist is None:
- aalist = ""
- alist = set(alist.split())
- aalist = set(aalist.split())
- elif alist is None or aalist is None or \
- need_distfiles:
- # Make sure we get the correct tree in case there are overlays.
- mytree = os.path.realpath(
- os.path.dirname(os.path.dirname(mysettings["O"])))
- useflags = mysettings["PORTAGE_USE"].split()
- try:
- alist = mydbapi.getFetchMap(mycpv, useflags=useflags,
- mytree=mytree)
- aalist = mydbapi.getFetchMap(mycpv, mytree=mytree)
- except InvalidDependString as e:
- writemsg("!!! %s\n" % str(e), noiselevel=-1)
- writemsg(_("!!! Invalid SRC_URI for '%s'.\n") % mycpv,
- noiselevel=-1)
- del e
- return 1
- mysettings.configdict["pkg"]["A"] = " ".join(alist)
- mysettings.configdict["pkg"]["AA"] = " ".join(aalist)
-
- if need_distfiles:
- if "mirror" in features or fetchall:
- fetchme = aalist
- else:
- fetchme = alist
- if not fetch(fetchme, mysettings, listonly=listonly,
- fetchonly=fetchonly):
- spawn_nofetch(mydbapi, myebuild, settings=mysettings)
- return 1
+ alist = set(mysettings.configdict["pkg"].get("A", "").split())
+ aalist = set(mysettings.configdict["pkg"].get("AA", "").split())
+ if need_distfiles:
- else:
- alist = set(alist.split())
- aalist = set(aalist.split())
+ if "mirror" in features or fetchall:
+ fetchme = aalist
+ else:
+ fetchme = alist
+ if not fetch(fetchme, mysettings, listonly=listonly,
+ fetchonly=fetchonly):
+ spawn_nofetch(mydbapi, myebuild, settings=mysettings)
+ return 1
if mydo == "fetch":
# Files are already checked inside fetch(),