aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-03 12:07:18 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-06 10:56:04 +0100
commit42be90444057f963083ad2fc1b7223ec22973e8b (patch)
treecb579bdfdf7459fa7f2eaef7d06dbbbab44698e6
parentbdd51f003d5c3ccebecefac9244b110051996ed2 (diff)
downloadpaludis-42be90444057f963083ad2fc1b7223ec22973e8b.tar.gz
paludis-42be90444057f963083ad2fc1b7223ec22973e8b.tar.xz
More chrooty goodness
-rw-r--r--src/clients/cave/cmd_display_resolution.cc2
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.cc14
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.hh2
-rw-r--r--src/clients/cave/resolve_common.cc28
4 files changed, 32 insertions, 14 deletions
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 3cc4580..89be254 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -1111,7 +1111,7 @@ namespace
case dt_install_to_chroot:
c = c::blue();
if (maybe_totals)
- ++maybe_totals->installs_count;
+ ++maybe_totals->installs_ct_count.insert(std::make_pair(decision.change_type(), 0)).first->second;
continue;
case dt_create_binary:
diff --git a/src/clients/cave/cmd_resolve_cmdline.cc b/src/clients/cave/cmd_resolve_cmdline.cc
index 1a4f6f7..6811ff2 100644
--- a/src/clients/cave/cmd_resolve_cmdline.cc
+++ b/src/clients/cave/cmd_resolve_cmdline.cc
@@ -228,24 +228,32 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A
"does not satisfy other constraints. Also note that specifying a preset will not force a package to be "
"considered if it would otherwise not be part of the resolution set."),
-#ifdef ENABLE_PBINS
g_destination_options(this, "Destination Options", "Control to which destinations targets are installed. Dependencies "
"will always be installed to / as necessary."),
a_make(&g_destination_options, "make", 'm', "Specify what to do with targets.",
args::EnumArg::EnumArgOptions
("install", 'i', "Install targets to /")
- ("binaries", 'b', "Create binary packages for targets"),
+#ifdef ENABLE_PBINS
+ ("binaries", 'b', "Create binary packages for targets")
+#endif
+ ("chroot", 'c', "Install targets to a chroot"),
"install"),
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.",
args::EnumArg::EnumArgOptions
+#ifdef ENABLE_PBINS
("auto", '\0', "Select appropriate behaviour based upon --make. For 'install', 'all', and "
- "for 'binaries', 'runtime'.")
+ "for 'binaries' and 'chroot', 'runtime'.")
+#else
+ ("auto", '\0', "Select appropriate behaviour based upon --make. For 'install', 'all', and "
+ "for 'chroot', 'runtime'.")
+#endif
("runtime", 'r', "Only care about runtime dependencies")
("all", 'a', "Care about all dependencies")
("none", 'n', "Don't care about dependencies at all"),
"auto"),
+#ifdef ENABLE_PBINS
a_via_binary(&g_destination_options, "via-binary", 'b', "When building a package matching the supplied spec, "
"create a binary package and use that for the install. May be specified multiple times. If this option "
"is not specified, a package will be built multiple times for multiple destinations"),
diff --git a/src/clients/cave/cmd_resolve_cmdline.hh b/src/clients/cave/cmd_resolve_cmdline.hh
index 079414d..bda9eab 100644
--- a/src/clients/cave/cmd_resolve_cmdline.hh
+++ b/src/clients/cave/cmd_resolve_cmdline.hh
@@ -93,10 +93,10 @@ namespace paludis
args::ArgsGroup g_preset_options;
args::StringSetArg a_preset;
-#ifdef ENABLE_PBINS
args::ArgsGroup g_destination_options;
args::EnumArg a_make;
args::EnumArg a_make_dependencies;
+#ifdef ENABLE_PBINS
args::StringSetArg a_via_binary;
#endif
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index fecc150..658c334 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -190,17 +190,15 @@ namespace
DestinationTypes visit(const TargetReason &) const
{
-#ifdef ENABLE_PBINS
if (resolution_options.a_make.argument() == "binaries")
return DestinationTypes() + dt_create_binary;
else if (resolution_options.a_make.argument() == "install")
return DestinationTypes() + dt_install_to_slash;
+ else if (resolution_options.a_make.argument() == "chroot")
+ return DestinationTypes() + dt_install_to_chroot;
else
throw args::DoHelp("Don't understand argument '" + resolution_options.a_make.argument() + "' to '--"
+ resolution_options.a_make.long_name() + "'");
-#else
- return DestinationTypes() + dt_install_to_slash;
-#endif
}
DestinationTypes visit(const DependentReason &) const
@@ -222,7 +220,6 @@ namespace
{
DestinationTypes extras;
-#ifdef ENABLE_PBINS
if (resolution_options.a_make.argument() == "binaries")
{
bool binary_if_possible(false);
@@ -240,7 +237,21 @@ namespace
if (binary_if_possible && package_id_unless_error && can_make_binary_for(package_id_unless_error))
extras += dt_create_binary;
}
-#endif
+ else if (resolution_options.a_make.argument() == "chroot")
+ {
+ bool chroot_if_possible(false);
+ if (resolution_options.a_make_dependencies.argument() == "auto" ||
+ resolution_options.a_make_dependencies.argument() == "all")
+ chroot_if_possible = true;
+ else if (resolution_options.a_make_dependencies.argument() == "runtime")
+ {
+ if (is_run_or_post_dep(dep.sanitised_dependency()))
+ chroot_if_possible = true;
+ }
+
+ if (chroot_if_possible)
+ extras += dt_install_to_chroot;
+ }
return (DestinationTypes() + dt_install_to_slash) | extras;
}
@@ -316,11 +327,9 @@ namespace
const Generator & g,
const std::shared_ptr<const Resolution> &)
{
-#ifdef ENABLE_PBINS
if (resolution_options.a_make.argument() == "binaries")
return g | BinaryableFilter();
else
-#endif
return g;
}
@@ -743,7 +752,8 @@ namespace
const std::shared_ptr<const PackageIDSequence> installed_ids((*env)[selection::BestVersionInEachSlot(
generator::Matches(spec, { }) |
- filter::InstalledAtRoot(FSEntry("/")))]);
+ (resolution_options.a_make.argument() == "chroot" ?
+ Filter(filter::InstalledAtNotSlash()) : Filter(filter::InstalledAtSlash())))]);
const args::EnumArg & arg(is_target(reason) ? resolution_options.a_target_slots : resolution_options.a_slots);