aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2013-02-21 07:00:20 -0800
committerAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2013-03-09 12:17:33 -0800
commitb62787ab8a2f2c1f7dc8793c8451ee7f7e932ca3 (patch)
tree5de43102d7806f809e403d43400a82103b58ea9a
parent6539642bc137e6f0c52a2cd15a6e13929eaa3a9d (diff)
downloadpaludis-b62787ab8a2f2c1f7dc8793c8451ee7f7e932ca3.tar.gz
paludis-b62787ab8a2f2c1f7dc8793c8451ee7f7e932ca3.tar.xz
hoist a few common subexpressions into variables
-rw-r--r--paludis/repositories/e/do_fetch_action.cc22
-rw-r--r--paludis/repositories/e/do_info_action.cc24
-rw-r--r--paludis/repositories/e/do_install_action.cc40
-rw-r--r--paludis/repositories/e/do_pretend_action.cc71
4 files changed, 90 insertions, 67 deletions
diff --git a/paludis/repositories/e/do_fetch_action.cc b/paludis/repositories/e/do_fetch_action.cc
index cd09397..a615d35 100644
--- a/paludis/repositories/e/do_fetch_action.cc
+++ b/paludis/repositories/e/do_fetch_action.cc
@@ -178,14 +178,17 @@ paludis::erepository::do_fetch_action(
if (can_skip_phase(env, id, *phase))
continue;
+ const auto params = repo->params();
+ const auto profile = repo->profile();
+
EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
- n::builddir() = repo->params().builddir(),
+ n::builddir() = params.builddir(),
n::clearenv() = phase->option("clearenv"),
n::commands() = join(phase->begin_commands(), phase->end_commands(), " "),
- n::distdir() = repo->params().distdir(),
+ n::distdir() = params.distdir(),
n::ebuild_dir() = repo->layout()->package_directory(id->name()),
n::ebuild_file() = id->fs_location_key()->parse_value(),
- n::eclassdirs() = repo->params().eclassdirs(),
+ n::eclassdirs() = params.eclassdirs(),
n::environment() = env,
n::exlibsdirs() = exlibsdirs,
n::files_dir() = repo->layout()->package_directory(id->name()) / "files",
@@ -194,8 +197,9 @@ paludis::erepository::do_fetch_action(
n::package_id() = id,
n::permitted_directories() = make_null_shared_ptr(),
n::portdir() =
- (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ?
- (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(),
+ (params.master_repositories() && ! params.master_repositories()->empty())
+ ? (*params.master_repositories()->begin())->params().location()
+ : params.location(),
n::root() = "/",
n::sandbox() = phase->option("sandbox"),
n::sydbox() = phase->option("sydbox"),
@@ -207,12 +211,12 @@ paludis::erepository::do_fetch_action(
n::aa() = all_archives,
n::expand_vars() = expand_vars,
n::loadsaveenv_dir() = package_builddir / "temp",
- n::profiles() = repo->params().profiles(),
- n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
+ n::profiles() = params.profiles(),
+ n::profiles_with_parents() = profile->profiles_with_parents(),
n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value().raw_value()) : "",
n::use() = use,
- n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
- n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
+ n::use_expand() = join(profile->use_expand()->begin(), profile->use_expand()->end(), " "),
+ n::use_expand_hidden() = join(profile->use_expand_hidden()->begin(), profile->use_expand_hidden()->end(), " ")
));
if (! fetch_extra_cmd())
diff --git a/paludis/repositories/e/do_info_action.cc b/paludis/repositories/e/do_info_action.cc
index ea86428..375599e 100644
--- a/paludis/repositories/e/do_info_action.cc
+++ b/paludis/repositories/e/do_info_action.cc
@@ -87,24 +87,28 @@ paludis::erepository::do_info_action(
if (phase->option("installed=true"))
continue;
+ const auto params = repo->params();
+ const auto profile = repo->profile();
+
EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
- n::builddir() = repo->params().builddir(),
+ n::builddir() = params.builddir(),
n::clearenv() = phase->option("clearenv"),
n::commands() = join(phase->begin_commands(), phase->end_commands(), " "),
- n::distdir() = repo->params().distdir(),
+ n::distdir() = params.distdir(),
n::ebuild_dir() = repo->layout()->package_directory(id->name()),
n::ebuild_file() = id->fs_location_key()->parse_value(),
- n::eclassdirs() = repo->params().eclassdirs(),
+ n::eclassdirs() = params.eclassdirs(),
n::environment() = env,
n::exlibsdirs() = exlibsdirs,
n::files_dir() = repo->layout()->package_directory(id->name()) / "files",
n::maybe_output_manager() = output_manager,
- n::package_builddir() = repo->params().builddir() / (stringify(id->name().category()) + "-" + stringify(id->name().package()) + "-" + stringify(id->version()) + "-info"),
+ n::package_builddir() = params.builddir() / (stringify(id->name().category()) + "-" + stringify(id->name().package()) + "-" + stringify(id->version()) + "-info"),
n::package_id() = id,
n::permitted_directories() = make_null_shared_ptr(),
n::portdir() =
- (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ?
- (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(),
+ (params.master_repositories() && ! params.master_repositories()->empty())
+ ? (*params.master_repositories()->begin())->params().location()
+ : params.location(),
n::root() = stringify(env->preferred_root_key()->parse_value()),
n::sandbox() = phase->option("sandbox"),
n::sydbox() = phase->option("sydbox"),
@@ -117,12 +121,12 @@ paludis::erepository::do_info_action(
n::info_vars() = repo->info_vars_key() ?
repo->info_vars_key()->parse_value() : std::make_shared<const Set<std::string>>(),
n::load_environment() = static_cast<const FSPath *>(0),
- n::profiles() = repo->params().profiles(),
- n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
+ n::profiles() = params.profiles(),
+ n::profiles_with_parents() = profile->profiles_with_parents(),
n::use() = use,
n::use_ebuild_file() = true,
- n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
- n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
+ n::use_expand() = join(profile->use_expand()->begin(), profile->use_expand()->end(), " "),
+ n::use_expand_hidden() = join(profile->use_expand_hidden()->begin(), profile->use_expand_hidden()->end(), " ")
));
EbuildInfoCommand cmd(command_params, info_params);
diff --git a/paludis/repositories/e/do_install_action.cc b/paludis/repositories/e/do_install_action.cc
index 5439b31..a0ac4d2 100644
--- a/paludis/repositories/e/do_install_action.cc
+++ b/paludis/repositories/e/do_install_action.cc
@@ -358,14 +358,17 @@ paludis::erepository::do_install_action(
continue;
}
+ const auto params = repo->params();
+ const auto profile = repo->profile();
+
EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
- n::builddir() = repo->params().builddir(),
+ n::builddir() = params.builddir(),
n::clearenv() = phase->option("clearenv"),
n::commands() = join(phase->begin_commands(), phase->end_commands(), " "),
- n::distdir() = repo->params().distdir(),
+ n::distdir() = params.distdir(),
n::ebuild_dir() = repo->layout()->package_directory(id->name()),
n::ebuild_file() = id->fs_location_key()->parse_value(),
- n::eclassdirs() = repo->params().eclassdirs(),
+ n::eclassdirs() = params.eclassdirs(),
n::environment() = env,
n::exlibsdirs() = exlibsdirs,
n::files_dir() = repo->layout()->package_directory(id->name()) / "files",
@@ -374,8 +377,8 @@ paludis::erepository::do_install_action(
n::package_id() = id,
n::permitted_directories() = permitted_directories,
n::portdir() =
- (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ?
- (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(),
+ (params.master_repositories() && ! params.master_repositories()->empty()) ?
+ (*params.master_repositories()->begin())->params().location() : params.location(),
n::root() = install_action.options.destination()->installed_root_key() ?
stringify(install_action.options.destination()->installed_root_key()->parse_value()) :
"/",
@@ -395,13 +398,13 @@ paludis::erepository::do_install_action(
n::expand_vars() = expand_vars,
n::is_from_pbin() = id->eapi()->supported()->is_pbin(),
n::loadsaveenv_dir() = package_builddir / "temp",
- n::profiles() = repo->params().profiles(),
- n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
+ n::profiles() = params.profiles(),
+ n::profiles_with_parents() = profile->profiles_with_parents(),
n::replacing_ids() = install_action.options.replacing(),
n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value().raw_value()) : "",
n::use() = use,
- n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
- n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
+ n::use_expand() = join(profile->use_expand()->begin(), profile->use_expand()->end(), " "),
+ n::use_expand_hidden() = join(profile->use_expand_hidden()->begin(), profile->use_expand_hidden()->end(), " ")
));
EbuildInstallCommand cmd(command_params, install_params);
@@ -420,13 +423,13 @@ paludis::erepository::do_install_action(
continue;
EbuildCommandParams tidyup_command_params(make_named_values<EbuildCommandParams>(
- n::builddir() = repo->params().builddir(),
+ n::builddir() = params.builddir(),
n::clearenv() = tidyup_phase->option("clearenv"),
n::commands() = join(tidyup_phase->begin_commands(), tidyup_phase->end_commands(), " "),
- n::distdir() = repo->params().distdir(),
+ n::distdir() = params.distdir(),
n::ebuild_dir() = repo->layout()->package_directory(id->name()),
n::ebuild_file() = id->fs_location_key()->parse_value(),
- n::eclassdirs() = repo->params().eclassdirs(),
+ n::eclassdirs() = params.eclassdirs(),
n::environment() = env,
n::exlibsdirs() = exlibsdirs,
n::files_dir() = repo->layout()->package_directory(id->name()) / "files",
@@ -435,8 +438,9 @@ paludis::erepository::do_install_action(
n::package_id() = id,
n::permitted_directories() = permitted_directories,
n::portdir() =
- (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ?
- (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(),
+ (params.master_repositories() && ! params.master_repositories()->empty())
+ ? (*params.master_repositories()->begin())->params().location()
+ : params.location(),
n::root() = install_action.options.destination()->installed_root_key() ?
stringify(install_action.options.destination()->installed_root_key()->parse_value()) :
"/",
@@ -456,13 +460,13 @@ paludis::erepository::do_install_action(
n::expand_vars() = expand_vars,
n::is_from_pbin() = id->eapi()->supported()->is_pbin(),
n::loadsaveenv_dir() = package_builddir / "temp",
- n::profiles() = repo->params().profiles(),
- n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
+ n::profiles() = params.profiles(),
+ n::profiles_with_parents() = profile->profiles_with_parents(),
n::replacing_ids() = install_action.options.replacing(),
n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value().raw_value()) : "",
n::use() = use,
- n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
- n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
+ n::use_expand() = join(profile->use_expand()->begin(), profile->use_expand()->end(), " "),
+ n::use_expand_hidden() = join(profile->use_expand_hidden()->begin(), profile->use_expand_hidden()->end(), " ")
));
EbuildInstallCommand tidyup_cmd(tidyup_command_params, tidyup_install_params);
diff --git a/paludis/repositories/e/do_pretend_action.cc b/paludis/repositories/e/do_pretend_action.cc
index b651c8f..eeb7436 100644
--- a/paludis/repositories/e/do_pretend_action.cc
+++ b/paludis/repositories/e/do_pretend_action.cc
@@ -104,24 +104,27 @@ paludis::erepository::do_pretend_action(
if (! output_manager)
output_manager = a.options.make_output_manager()(a);
+ const auto params = repo->params();
+ const auto profile = repo->profile();
+
EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
- n::builddir() = repo->params().builddir(),
+ n::builddir() = params.builddir(),
n::clearenv() = phase->option("clearenv"),
n::commands() = join(phase->begin_commands(), phase->end_commands(), " "),
- n::distdir() = repo->params().distdir(),
+ n::distdir() = params.distdir(),
n::ebuild_dir() = repo->layout()->package_directory(id->name()),
n::ebuild_file() = id->fs_location_key()->parse_value(),
- n::eclassdirs() = repo->params().eclassdirs(),
+ n::eclassdirs() = params.eclassdirs(),
n::environment() = env,
n::exlibsdirs() = exlibsdirs,
n::files_dir() = repo->layout()->package_directory(id->name()) / "files",
n::maybe_output_manager() = output_manager,
- n::package_builddir() = repo->params().builddir() / (stringify(id->name().category()) + "-" + stringify(id->name().package()) + "-" + stringify(id->version()) + "-bad_options"),
+ n::package_builddir() = params.builddir() / (stringify(id->name().category()) + "-" + stringify(id->name().package()) + "-" + stringify(id->version()) + "-bad_options"),
n::package_id() = id,
n::permitted_directories() = make_null_shared_ptr(),
n::portdir() =
- (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ?
- (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(),
+ (params.master_repositories() && ! params.master_repositories()->empty()) ?
+ (*params.master_repositories()->begin())->params().location() : params.location(),
n::root() = a.options.destination()->installed_root_key() ?
stringify(a.options.destination()->installed_root_key()->parse_value()) :
"/",
@@ -133,12 +136,12 @@ paludis::erepository::do_pretend_action(
EbuildBadOptionsCommand bad_options_cmd(command_params,
make_named_values<EbuildBadOptionsCommandParams>(
n::expand_vars() = expand_vars,
- n::profiles() = repo->params().profiles(),
- n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
+ n::profiles() = params.profiles(),
+ n::profiles_with_parents() = profile->profiles_with_parents(),
n::unmet_requirements() = verifier.unmet_requirements(),
n::use() = use,
- n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
- n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
+ n::use_expand() = join(profile->use_expand()->begin(), profile->use_expand()->end(), " "),
+ n::use_expand_hidden() = join(profile->use_expand_hidden()->begin(), profile->use_expand_hidden()->end(), " ")
));
if (! bad_options_cmd())
@@ -166,24 +169,28 @@ paludis::erepository::do_pretend_action(
if (! output_manager)
output_manager = a.options.make_output_manager()(a);
+ const auto params = repo->params();
+ const auto profile = repo->profile();
+
EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
- n::builddir() = repo->params().builddir(),
+ n::builddir() = params.builddir(),
n::clearenv() = phase->option("clearenv"),
n::commands() = join(phase->begin_commands(), phase->end_commands(), " "),
- n::distdir() = repo->params().distdir(),
+ n::distdir() = params.distdir(),
n::ebuild_dir() = repo->layout()->package_directory(id->name()),
n::ebuild_file() = id->fs_location_key()->parse_value(),
- n::eclassdirs() = repo->params().eclassdirs(),
+ n::eclassdirs() = params.eclassdirs(),
n::environment() = env,
n::exlibsdirs() = exlibsdirs,
n::files_dir() = repo->layout()->package_directory(id->name()) / "files",
n::maybe_output_manager() = output_manager,
- n::package_builddir() = repo->params().builddir() / (stringify(id->name().category()) + "-" + stringify(id->name().package()) + "-" + stringify(id->version()) + "-bad_options"),
+ n::package_builddir() = params.builddir() / (stringify(id->name().category()) + "-" + stringify(id->name().package()) + "-" + stringify(id->version()) + "-bad_options"),
n::package_id() = id,
n::permitted_directories() = make_null_shared_ptr(),
n::portdir() =
- (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ?
- (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(),
+ (params.master_repositories() && ! params.master_repositories()->empty())
+ ? (*params.master_repositories()->begin())->params().location()
+ : params.location(),
n::root() = a.options.destination()->installed_root_key() ?
stringify(a.options.destination()->installed_root_key()->parse_value()) :
"/",
@@ -195,12 +202,12 @@ paludis::erepository::do_pretend_action(
EbuildBadOptionsCommand bad_options_cmd(command_params,
make_named_values<EbuildBadOptionsCommandParams>(
n::expand_vars() = expand_vars,
- n::profiles() = repo->params().profiles(),
- n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
+ n::profiles() = params.profiles(),
+ n::profiles_with_parents() = profile->profiles_with_parents(),
n::unmet_requirements() = verifier.unmet_requirements(),
n::use() = use,
- n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
- n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
+ n::use_expand() = join(profile->use_expand()->begin(), profile->use_expand()->end(), " "),
+ n::use_expand_hidden() = join(profile->use_expand_hidden()->begin(), profile->use_expand_hidden()->end(), " ")
));
if (! bad_options_cmd())
@@ -226,24 +233,28 @@ paludis::erepository::do_pretend_action(
if (! output_manager)
output_manager = a.options.make_output_manager()(a);
+ const auto params = repo->params();
+ const auto profile = repo->profile();
+
EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
- n::builddir() = repo->params().builddir(),
+ n::builddir() = params.builddir(),
n::clearenv() = phase->option("clearenv"),
n::commands() = join(phase->begin_commands(), phase->end_commands(), " "),
- n::distdir() = repo->params().distdir(),
+ n::distdir() = params.distdir(),
n::ebuild_dir() = repo->layout()->package_directory(id->name()),
n::ebuild_file() = id->fs_location_key()->parse_value(),
- n::eclassdirs() = repo->params().eclassdirs(),
+ n::eclassdirs() = params.eclassdirs(),
n::environment() = env,
n::exlibsdirs() = exlibsdirs,
n::files_dir() = repo->layout()->package_directory(id->name()) / "files",
n::maybe_output_manager() = output_manager,
- n::package_builddir() = repo->params().builddir() / (stringify(id->name().category()) + "-" + stringify(id->name().package()) + "-" + stringify(id->version()) + "-pretend"),
+ n::package_builddir() = params.builddir() / (stringify(id->name().category()) + "-" + stringify(id->name().package()) + "-" + stringify(id->version()) + "-pretend"),
n::package_id() = id,
n::permitted_directories() = make_null_shared_ptr(),
n::portdir() =
- (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ?
- (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(),
+ (params.master_repositories() && ! params.master_repositories()->empty())
+ ? (*params.master_repositories()->begin())->params().location()
+ : params.location(),
n::root() = a.options.destination()->installed_root_key() ?
stringify(a.options.destination()->installed_root_key()->parse_value()) :
"/",
@@ -257,12 +268,12 @@ paludis::erepository::do_pretend_action(
n::destination() = a.options.destination(),
n::expand_vars() = expand_vars,
n::is_from_pbin() = id->eapi()->supported()->is_pbin(),
- n::profiles() = repo->params().profiles(),
- n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
+ n::profiles() = params.profiles(),
+ n::profiles_with_parents() = profile->profiles_with_parents(),
n::replacing_ids() = a.options.replacing(),
n::use() = use,
- n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
- n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
+ n::use_expand() = join(profile->use_expand()->begin(), profile->use_expand()->end(), " "),
+ n::use_expand_hidden() = join(profile->use_expand_hidden()->begin(), profile->use_expand_hidden()->end(), " ")
));
if (! pretend_cmd())