aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-13 14:12:11 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-13 14:12:11 +0100
commit7bf961188d1895dcb58a12de5174d7919ce1b3c8 (patch)
tree28db00c497855cb301a69d842d2216d900f6af86
parentd4ae54b97e6fc3218443b389618ee1c71674c097 (diff)
downloadpaludis-7bf961188d1895dcb58a12de5174d7919ce1b3c8.tar.gz
paludis-7bf961188d1895dcb58a12de5174d7919ce1b3c8.tar.xz
cave resolve --make defaults to chroot when root != /
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.cc3
-rw-r--r--src/clients/cave/resolve_common.cc23
2 files changed, 19 insertions, 7 deletions
diff --git a/src/clients/cave/cmd_resolve_cmdline.cc b/src/clients/cave/cmd_resolve_cmdline.cc
index 6811ff2..c58f318 100644
--- a/src/clients/cave/cmd_resolve_cmdline.cc
+++ b/src/clients/cave/cmd_resolve_cmdline.cc
@@ -232,12 +232,13 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A
"will always be installed to / as necessary."),
a_make(&g_destination_options, "make", 'm', "Specify what to do with targets.",
args::EnumArg::EnumArgOptions
+ ("auto", 'a', "'install', or 'chroot' if the preferred root is not /")
("install", 'i', "Install targets to /")
#ifdef ENABLE_PBINS
("binaries", 'b', "Create binary packages for targets")
#endif
("chroot", 'c', "Install targets to a chroot"),
- "install"),
+ "auto"),
a_make_dependencies(&g_destination_options, "make-dependencies", 'M', "Specify what to do with dependencies of "
"targets. Only useful when '--make' is not set to 'install', since dependencies on / are considered "
"specially.",
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index 6dda1f6..551ef0b 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -90,6 +90,7 @@
#include <paludis/selection_cache.hh>
#include <paludis/package_id.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/metadata_key.hh>
#include <algorithm>
#include <iostream>
@@ -499,9 +500,18 @@ namespace
+ arg.long_name() + "'");
}
- DestinationType destination_type_from_arg(const args::EnumArg & arg)
+ DestinationType destination_type_from_arg(
+ const Environment * const env,
+ const args::EnumArg & arg)
{
- if (arg.argument() == "binaries")
+ if (arg.argument() == "auto")
+ {
+ if (env->preferred_root_key()->value() == FSEntry("/"))
+ return dt_install_to_slash;
+ else
+ return dt_install_to_chroot;
+ }
+ else if (arg.argument() == "binaries")
return dt_create_binary;
else if (arg.argument() == "install")
return dt_install_to_slash;
@@ -585,7 +595,7 @@ paludis::cave::resolve_common(
GetConstraintsForViaBinaryHelper get_constraints_for_via_binary_helper(env.get());
GetDestinationTypesForErrorHelper get_destination_types_for_error_helper(env.get());
- get_destination_types_for_error_helper.set_target_destination_type(destination_type_from_arg(resolution_options.a_make));
+ get_destination_types_for_error_helper.set_target_destination_type(destination_type_from_arg(env.get(), resolution_options.a_make));
GetInitialConstraintsForHelper get_initial_constraints_for_helper(env.get());
for (args::StringSetArg::ConstIterator i(resolution_options.a_without.begin_args()),
@@ -601,11 +611,11 @@ paludis::cave::resolve_common(
get_initial_constraints_for_helper.set_reinstall_scm_days(reinstall_scm_days(resolution_options));
GetResolventsForHelper get_resolvents_for_helper(env.get());
- get_resolvents_for_helper.set_target_destination_type(destination_type_from_arg(resolution_options.a_make));
+ get_resolvents_for_helper.set_target_destination_type(destination_type_from_arg(env.get(), resolution_options.a_make));
if (resolution_options.a_make_dependencies.argument() == "auto")
{
- if ("install" == resolution_options.a_make.argument())
+ if (dt_install_to_slash == destination_type_from_arg(env.get(), resolution_options.a_make))
{
get_resolvents_for_helper.set_want_target_dependencies(true);
get_resolvents_for_helper.set_want_target_runtime_dependencies(true);
@@ -677,7 +687,8 @@ paludis::cave::resolve_common(
MakeDestinationFilteredGeneratorHelper make_destination_filtered_generator_helper(env.get());
MakeOriginFilteredGeneratorHelper make_origin_filtered_generator_helper(env.get());
- make_origin_filtered_generator_helper.set_making_binaries("binaries" == resolution_options.a_make.argument());
+ make_origin_filtered_generator_helper.set_making_binaries(
+ dt_create_binary == destination_type_from_arg(env.get(), resolution_options.a_make));
MakeUnmaskableFilterHelper make_unmaskable_filter_helper(env.get());
make_unmaskable_filter_helper.set_override_masks(! resolution_options.a_no_override_masks.specified());