diff options
-rw-r--r-- | paludis/resolver/decider.cc | 17 | ||||
-rw-r--r-- | paludis/resolver/decider.hh | 3 | ||||
-rw-r--r-- | paludis/resolver/destination_utils-fwd.hh | 6 | ||||
-rw-r--r-- | paludis/resolver/destination_utils.cc | 27 |
4 files changed, 46 insertions, 7 deletions
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc index 64f9f1651..8e24af4ab 100644 --- a/paludis/resolver/decider.cc +++ b/paludis/resolver/decider.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010, 2011, 2013 Ciaran McCreesh + * Copyright (c) 2009, 2010, 2011, 2013, 2014 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -41,6 +41,7 @@ #include <paludis/resolver/make_uninstall_blocker.hh> #include <paludis/resolver/has_behaviour-fwd.hh> #include <paludis/resolver/get_sameness.hh> +#include <paludis/resolver/destination_utils.hh> #include <paludis/util/exception.hh> #include <paludis/util/stringify.hh> #include <paludis/util/make_named_values.hh> @@ -1439,7 +1440,7 @@ Decider::_get_error_resolvents_for( ), *t); - auto ids(_find_installable_id_candidates_for(*spec.package_ptr(), filter::All(), true, true)); + auto ids(_find_installable_id_candidates_for(*spec.package_ptr(), filter::All(), filter::All(), true, true)); if (! ids->empty()) resolvent.slot() = make_named_values<SlotNameOrNull>( n::name_or_null() = (*ids->rbegin())->slot_key() ? @@ -1619,7 +1620,10 @@ Decider::_cannot_decide_for( unsuitable_candidates->push_back(_make_unsuitable_candidate(resolution, existing_id, true)); const std::shared_ptr<const PackageIDSequence> installable_ids(_find_installable_id_candidates_for( - resolution->resolvent().package(), make_slot_filter(resolution->resolvent()), true, false)); + resolution->resolvent().package(), + make_slot_filter(resolution->resolvent()), + make_destination_type_filter(resolution->resolvent().destination_type()), + true, false)); for (PackageIDSequence::ConstIterator i(installable_ids->begin()), i_end(installable_ids->end()) ; i != i_end ; ++i) unsuitable_candidates->push_back(_make_unsuitable_candidate(resolution, *i, false)); @@ -1727,6 +1731,7 @@ const std::shared_ptr<const PackageIDSequence> Decider::_find_installable_id_candidates_for( const QualifiedPackageName & package, const Filter & slot_filter, + const Filter & destination_type_filter, const bool include_errors, const bool include_unmaskable) const { @@ -1736,6 +1741,7 @@ Decider::_find_installable_id_candidates_for( (*_imp->env)[selection::AllVersionsSorted( _imp->fns.make_origin_filtered_generator_fn()(generator::Package(package)) | slot_filter | + destination_type_filter | filter::SupportsAction<InstallAction>() | (include_errors ? filter::All() : include_unmaskable ? _imp->fns.make_unmaskable_filter_fn()(package) : filter::NotMasked()) )]); @@ -1747,7 +1753,10 @@ Decider::_find_installable_id_for(const std::shared_ptr<const Resolution> & reso const bool include_unmaskable) const { return _find_id_for_from(resolution, _find_installable_id_candidates_for( - resolution->resolvent().package(), make_slot_filter(resolution->resolvent()), false, include_unmaskable), + resolution->resolvent().package(), + make_slot_filter(resolution->resolvent()), + make_destination_type_filter(resolution->resolvent().destination_type()), + false, include_unmaskable), include_option_changes, false); } diff --git a/paludis/resolver/decider.hh b/paludis/resolver/decider.hh index 388aab004..77a9257b6 100644 --- a/paludis/resolver/decider.hh +++ b/paludis/resolver/decider.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010, 2011, 2013 Ciaran McCreesh + * Copyright (c) 2009, 2010, 2011, 2013, 2014 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -176,6 +176,7 @@ namespace paludis const std::shared_ptr<const PackageIDSequence> _find_installable_id_candidates_for( const QualifiedPackageName &, const Filter &, + const Filter &, const bool include_errors, const bool include_unmaskable) const; diff --git a/paludis/resolver/destination_utils-fwd.hh b/paludis/resolver/destination_utils-fwd.hh index 3770f51d8..012c60958 100644 --- a/paludis/resolver/destination_utils-fwd.hh +++ b/paludis/resolver/destination_utils-fwd.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2010 Ciaran McCreesh + * Copyright (c) 2010, 2014 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -25,6 +25,7 @@ #include <paludis/package_id-fwd.hh> #include <paludis/generator-fwd.hh> #include <paludis/filtered_generator-fwd.hh> +#include <paludis/filter-fwd.hh> #include <paludis/environment-fwd.hh> namespace paludis @@ -39,6 +40,9 @@ namespace paludis const Environment * const, const DestinationType, const Generator &) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE; + + Filter make_destination_type_filter( + const DestinationType) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE; } } diff --git a/paludis/resolver/destination_utils.cc b/paludis/resolver/destination_utils.cc index 0e42da8e6..b7d6968f2 100644 --- a/paludis/resolver/destination_utils.cc +++ b/paludis/resolver/destination_utils.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2010, 2011 Ciaran McCreesh + * Copyright (c) 2010, 2011, 2014 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -120,3 +120,28 @@ paludis::resolver::destination_filtered_generator( throw InternalError(PALUDIS_HERE, "unhandled dt"); } +Filter +paludis::resolver::make_destination_type_filter( + const DestinationType t) +{ + switch (t) + { + case dt_install_to_slash: + return filter::All(); + + case dt_install_to_chroot: + return filter::All(); + + case dt_create_binary: + return filter::ByFunction([] (const std::shared_ptr<const PackageID> & id) { + return ! can_make_binary_for(id); + }, + "can be made into a binary"); + + case last_dt: + break; + } + + throw InternalError(PALUDIS_HERE, "unhandled dt"); +} + |