aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2015-07-04 04:50:20 -0400
committerTim Harder <radhermit@gmail.com>2015-07-04 12:50:19 -0400
commit7d2670222ff35f8b50d249546629beb70e90b563 (patch)
tree0024a52263ddfbf2bbcabe56a6b8c89e7dee833a
parentcommandline: drop extra unnecessary option --config-empty (diff)
downloadpkgcore-7d2670222ff35f8b50d249546629beb70e90b563.tar.gz
pkgcore-7d2670222ff35f8b50d249546629beb70e90b563.tar.bz2
pkgcore-7d2670222ff35f8b50d249546629beb70e90b563.zip
portage_conf: simplify fetcher config object
Previously we were duplicating almost the entire make.conf dict into the fetcher object when it really only requires a few fields.
-rw-r--r--pkgcore/ebuild/portage_conf.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/pkgcore/ebuild/portage_conf.py b/pkgcore/ebuild/portage_conf.py
index 8c5e73d5..4db779b2 100644
--- a/pkgcore/ebuild/portage_conf.py
+++ b/pkgcore/ebuild/portage_conf.py
@@ -216,22 +216,17 @@ def add_profile(config, base_path, user_profile_path=None, profile_override=None
})
-def add_fetcher(config, make_conf, distdir):
+def add_fetcher(config, make_conf):
fetchcommand = make_conf.pop("FETCHCOMMAND")
resumecommand = make_conf.pop("RESUMECOMMAND", fetchcommand)
- # copy it to prevent modification.
- # map a config arg to an obj arg, pop a few values
- fetcher_dict = dict(make_conf)
- if "FETCH_ATTEMPTS" in fetcher_dict:
- fetcher_dict["attempts"] = fetcher_dict.pop("FETCH_ATTEMPTS")
- fetcher_dict.pop("readonly", None)
- fetcher_dict.update({
+ fetcher_dict = {
"class": "pkgcore.fetch.custom.fetcher",
- "distdir": distdir,
+ "distdir": normpath(os.environ.get("DISTDIR", make_conf.pop("DISTDIR"))),
"command": fetchcommand,
"resume_command": resumecommand,
- })
+ "attempts": make_conf.pop("FETCH_ATTEMPTS", '10'),
+ }
config["fetcher"] = basics.AutoConfigSection(fetcher_dict)
@@ -590,8 +585,7 @@ def config_from_make_conf(location="/etc/", profile_override=None, **kwargs):
# now add the fetcher- we delay it till here to clean out the environ
# it passes to the command.
# *everything* in make_conf must be str values also.
- distdir = normpath(os.environ.get("DISTDIR", make_conf.pop("DISTDIR")))
- add_fetcher(config, make_conf, distdir)
+ add_fetcher(config, make_conf)
# finally... domain.
make_conf.update({