aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2014-01-05 18:35:48 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2014-01-05 19:03:25 +0000
commitda285b5d7279a823e680c8e3a8f7d7c5d538ca03 (patch)
treebeb01a1505f0184d87380921cc3454673ea991af
parente7bcd85c494e5bdc6d2446bb94dd49df0c39dbb2 (diff)
downloadpaludis-da285b5d7279a823e680c8e3a8f7d7c5d538ca03.tar.gz
paludis-da285b5d7279a823e680c8e3a8f7d7c5d538ca03.tar.xz
Don't try to make binaries out of binaries
-rw-r--r--paludis/resolver/decider.cc17
-rw-r--r--paludis/resolver/decider.hh3
-rw-r--r--paludis/resolver/destination_utils-fwd.hh6
-rw-r--r--paludis/resolver/destination_utils.cc27
4 files changed, 46 insertions, 7 deletions
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 64f9f16..8e24af4 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 388aab0..77a9257 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 3770f51..012c609 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 0e42da8..b7d6968 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");
+}
+