aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-08 11:29:07 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-08 11:29:07 +0000
commit141be4efd04237d93c6dff1a844ea9be376caf26 (patch)
treec33381316ecf77cbf6e9574b034fd10de32d18e1 /src
parent1d29ccaf6eb8bb3d5b0fdb56fc8a7ec07db4edb0 (diff)
downloadpaludis-141be4efd04237d93c6dff1a844ea9be376caf26.tar.gz
paludis-141be4efd04237d93c6dff1a844ea9be376caf26.tar.xz
less restrictive remove blockers
Diffstat (limited to 'src')
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.cc22
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.hh6
-rw-r--r--src/clients/cave/resolve_common.cc54
3 files changed, 74 insertions, 8 deletions
diff --git a/src/clients/cave/cmd_resolve_cmdline.cc b/src/clients/cave/cmd_resolve_cmdline.cc
index 1669470c6..b95cc3e02 100644
--- a/src/clients/cave/cmd_resolve_cmdline.cc
+++ b/src/clients/cave/cmd_resolve_cmdline.cc
@@ -66,17 +66,29 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A
a_permit_any_version(&g_resolution_options, "permit-any-version", 'a', "Permit installs of versions matching the supplied "
"specification even if those versions are worse than the best visible version in the slot. Use '*/*' "
"to allow all worse versions to be installed."),
+// a_purge(&g_resolution_options, "purge", 'P',
+// "Purge packages matching the given specification, if they will no longer be used after "
+// "a resolution. Use '*/*' to accept all purges, but note that by doing so you are putting "
+// "a great deal of trust in package authors to get dependencies right."),
+
+ g_dependent_options(this, "Dependent Options", "Dependent options. A package is dependent if it "
+ "requires (or looks like it might require) a package which is being removed. By default, "
+ "dependent packages are treated as errors. These options specify a different behaviour."),
a_uninstalls_may_break(&g_resolution_options, "uninstalls-may-break", 'u',
"Permit uninstalls that might break packages matching the specified specification. May be "
"specified multiple times. Use '*/*' to allow all packages to be broken."),
a_remove_if_dependent(&g_resolution_options, "remove-if-dependent", 'r',
"Remove dependent packages that might be broken by other changes if those packages match "
"the specified specification. May be specified multiple times. Use '*/*' to remove all "
- "dependent packages that might be broken, recursively. Does not imply --permit-uninstall."),
-// a_purge(&g_resolution_options, "purge", 'P',
-// "Purge packages matching the given specification, if they will no longer be used after "
-// "a resolution. Use '*/*' to accept all purges, but note that by doing so you are putting "
-// "a great deal of trust in package authors to get dependencies right."),
+ "dependent packages that might be broken, recursively. Does not imply --permit-uninstall, "
+ "which must also be specified."),
+ a_less_restrictive_remove_blockers(&g_resolution_options, "less-restrictive-remove-blockers", 'l',
+ "Use less restrictive blockers for packages matching the supplied specification if that "
+ "package is to be removed by --remove-if-dependent. May be specified multiple times. "
+ "Normally removing dependents is done by a pseudo-block in the form '!cat/pkg:slot'. If "
+ "matched by this option, the block will instead only block the installed dependent "
+ "package, so if reinstalling or upgrading the package will make it no longer be dependent "
+ "then this will be done instead."),
g_keep_options(this, "Reinstall Options", "Control whether installed packages are kept."),
a_keep_targets(&g_keep_options, "keep-targets", 'K',
diff --git a/src/clients/cave/cmd_resolve_cmdline.hh b/src/clients/cave/cmd_resolve_cmdline.hh
index 79eb58ea8..de465a8ec 100644
--- a/src/clients/cave/cmd_resolve_cmdline.hh
+++ b/src/clients/cave/cmd_resolve_cmdline.hh
@@ -46,15 +46,17 @@ namespace paludis
args::StringSetArg a_permit_uninstall;
args::StringSetArg a_permit_downgrade;
args::StringSetArg a_permit_any_version;
+// args::StringSetArg a_purge;
+
+ args::ArgsGroup g_dependent_options;
args::StringSetArg a_uninstalls_may_break;
args::StringSetArg a_remove_if_dependent;
-// args::StringSetArg a_purge;
+ args::StringSetArg a_less_restrictive_remove_blockers;
args::ArgsGroup g_keep_options;
args::EnumArg a_keep_targets;
args::EnumArg a_keep;
args::EnumArg a_reinstall_scm;
-// args::SwitchArg a_reinstall_for_removals;
args::StringSetArg a_with;
args::StringSetArg a_without;
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index ec0f5595c..c94524603 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -38,6 +38,7 @@
#include <paludis/util/thread.hh>
#include <paludis/util/timestamp.hh>
#include <paludis/util/map.hh>
+#include <paludis/util/make_shared_copy.hh>
#include <paludis/args/do_help.hh>
#include <paludis/args/escape.hh>
#include <paludis/resolver/resolver.hh>
@@ -66,6 +67,7 @@
#include <paludis/serialise-impl.hh>
#include <paludis/selection_cache.hh>
#include <paludis/package_dep_spec_properties.hh>
+#include <paludis/elike_slot_requirement.hh>
#include <algorithm>
#include <iostream>
@@ -1191,6 +1193,47 @@ namespace
));
}
+ const std::tr1::shared_ptr<ConstraintSequence> get_constraints_for_dependent_fn(
+ const Environment * const env,
+ const PackageDepSpecList & list,
+ const Resolvent &,
+ const std::tr1::shared_ptr<const Resolution> &,
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const PackageIDSequence> & ids)
+ {
+ const std::tr1::shared_ptr<ConstraintSequence> result(new ConstraintSequence);
+
+ std::tr1::shared_ptr<PackageDepSpec> spec;
+ if (match_any(env, list, id))
+ spec = make_shared_copy(id->uniquely_identifying_spec());
+ else
+ {
+ PartiallyMadePackageDepSpec partial_spec((PartiallyMadePackageDepSpecOptions()));
+ partial_spec.package(id->name());
+ if (id->slot_key())
+ partial_spec.slot_requirement(make_shared_ptr(new ELikeSlotExactRequirement(
+ id->slot_key()->value(), false)));
+ spec = make_shared_ptr(new PackageDepSpec(partial_spec));
+ }
+
+ for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ i != i_end ; ++i)
+ {
+ const std::tr1::shared_ptr<PresetReason> reason(new PresetReason("dependent " + stringify(**i), make_null_shared_ptr()));
+
+ result->push_back(make_shared_ptr(new Constraint(make_named_values<Constraint>(
+ value_for<n::destination_type>(dt_install_to_slash),
+ value_for<n::nothing_is_fine_too>(true),
+ value_for<n::reason>(reason),
+ value_for<n::spec>(BlockDepSpec("!" + stringify(*spec), *spec, false)),
+ value_for<n::untaken>(false),
+ value_for<n::use_existing>(ue_if_possible)
+ ))));
+ }
+
+ return result;
+ }
+
void ser_thread_func(StringListStream & ser_stream, const ResolverLists & resolution_lists)
{
Serialiser ser(ser_stream);
@@ -1421,7 +1464,7 @@ paludis::cave::resolve_common(
int retcode(0);
InitialConstraints initial_constraints;
- PackageDepSpecList allowed_to_remove_specs, allowed_to_break_specs, remove_if_dependent_specs;
+ PackageDepSpecList allowed_to_remove_specs, allowed_to_break_specs, remove_if_dependent_specs, less_restrictive_remove_blockers_specs;
for (args::StringSetArg::ConstIterator i(resolution_options.a_permit_uninstall.begin_args()),
i_end(resolution_options.a_permit_uninstall.end_args()) ;
@@ -1441,6 +1484,12 @@ paludis::cave::resolve_common(
remove_if_dependent_specs.push_back(parse_user_package_dep_spec(*i, env.get(),
UserPackageDepSpecOptions() + updso_allow_wildcards));
+ for (args::StringSetArg::ConstIterator i(resolution_options.a_less_restrictive_remove_blockers.begin_args()),
+ i_end(resolution_options.a_less_restrictive_remove_blockers.end_args()) ;
+ i != i_end ; ++i)
+ less_restrictive_remove_blockers_specs.push_back(parse_user_package_dep_spec(*i, env.get(),
+ UserPackageDepSpecOptions() + updso_allow_wildcards));
+
for (args::StringSetArg::ConstIterator i(resolution_options.a_preset.begin_args()),
i_end(resolution_options.a_preset.end_args()) ;
i != i_end ; ++i)
@@ -1488,6 +1537,9 @@ paludis::cave::resolve_common(
value_for<n::find_repository_for_fn>(std::tr1::bind(&find_repository_for_fn,
env.get(), std::tr1::cref(resolution_options), std::tr1::placeholders::_1, std::tr1::placeholders::_2,
std::tr1::placeholders::_3)),
+ value_for<n::get_constraints_for_dependent_fn>(std::tr1::bind(&get_constraints_for_dependent_fn,
+ env.get(), std::tr1::cref(less_restrictive_remove_blockers_specs), std::tr1::placeholders::_1,
+ std::tr1::placeholders::_2, std::tr1::placeholders::_3, std::tr1::placeholders::_4)),
value_for<n::get_destination_types_for_fn>(std::tr1::bind(&get_destination_types_for_fn,
env.get(), std::tr1::cref(resolution_options), std::tr1::placeholders::_1, std::tr1::placeholders::_2,
std::tr1::placeholders::_3)),