aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-10-31 15:11:28 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-10-31 15:11:28 +0000
commitfc026ef00a65518b590866ce4c06f6dfffbb2583 (patch)
treee291d7ea6a11233e50948f4fbc47b6f5cd3287bd
parent07a7abd7892f3e50e826fe05ccb27648e92c67ca (diff)
downloadpaludis-fc026ef00a65518b590866ce4c06f6dfffbb2583.tar.gz
paludis-fc026ef00a65518b590866ce4c06f6dfffbb2583.tar.xz
Don't assume slash is /
Fixes: ticket:995
-rw-r--r--paludis/resolver/collect_installed.cc3
-rw-r--r--paludis/resolver/decider.cc10
-rw-r--r--paludis/resolver/destination_utils-fwd.hh6
-rw-r--r--paludis/resolver/destination_utils.cc9
-rw-r--r--paludis/resolver/find_repository_for_helper.cc4
-rw-r--r--paludis/resolver/get_initial_constraints_for_helper.cc22
-rw-r--r--paludis/resolver/get_resolvents_for_helper.cc4
-rw-r--r--paludis/resolver/interest_in_spec_helper.cc5
-rw-r--r--paludis/resolver/make_destination_filtered_generator_helper.cc2
-rw-r--r--src/clients/cave/select_format_for_spec.cc3
10 files changed, 30 insertions, 38 deletions
diff --git a/paludis/resolver/collect_installed.cc b/paludis/resolver/collect_installed.cc
index 7980450..ea8d2a6 100644
--- a/paludis/resolver/collect_installed.cc
+++ b/paludis/resolver/collect_installed.cc
@@ -25,6 +25,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
#include <paludis/environment.hh>
+#include <paludis/metadata_key.hh>
#include <algorithm>
using namespace paludis;
@@ -36,7 +37,7 @@ paludis::resolver::collect_installed(
)
{
const std::shared_ptr<const PackageIDSequence> q((*env)[selection::AllVersionsUnsorted(
- generator::All() | filter::InstalledAtSlash())]);
+ generator::All() | filter::InstalledAtRoot(env->system_root_key()->value()))]);
const std::shared_ptr<PackageIDSet> result(std::make_shared<PackageIDSet>());
std::copy(q->begin(), q->end(), result->inserter());
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index d89f269..2de8eb7 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -397,7 +397,7 @@ const std::shared_ptr<const PackageIDSequence>
Decider::_collect_staying(const std::shared_ptr<const ChangeByResolventSequence> & going_away) const
{
const std::shared_ptr<const PackageIDSequence> existing((*_imp->env)[selection::AllVersionsUnsorted(
- generator::All() | filter::InstalledAtSlash())]);
+ generator::All() | filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
const std::shared_ptr<PackageIDSequence> result(std::make_shared<PackageIDSequence>());
for (PackageIDSequence::ConstIterator x(existing->begin()), x_end(existing->end()) ;
@@ -1350,7 +1350,7 @@ Decider::find_any_score(
{
const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly(
generator::Matches(spec, { }) |
- filter::InstalledAtSlash())]);
+ filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
if (! installed_ids->empty() ^ is_block)
return std::make_pair(acs_already_installed, operator_bias);
}
@@ -1360,7 +1360,7 @@ Decider::find_any_score(
{
const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly(
generator::Matches(spec, { mpo_ignore_additional_requirements }) |
- filter::InstalledAtSlash())]);
+ filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
if (! installed_ids->empty())
return std::make_pair(acs_wrong_options_installed, operator_bias);
}
@@ -1404,7 +1404,7 @@ Decider::find_any_score(
{
const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly(
generator::Matches(spec, { }) |
- filter::InstalledAtSlash())]);
+ filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
if (! installed_ids->empty())
return std::make_pair(acs_blocks_installed, operator_bias);
}
@@ -2115,7 +2115,7 @@ Decider::_already_met(const PackageOrBlockDepSpec & spec) const
{
const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::AllVersionsUnsorted(
generator::Matches(spec.if_package() ? *spec.if_package() : spec.if_block()->blocking(), { }) |
- filter::InstalledAtSlash())]);
+ filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
if (installed_ids->empty())
return bool(spec.if_block());
else
diff --git a/paludis/resolver/destination_utils-fwd.hh b/paludis/resolver/destination_utils-fwd.hh
index 4da6c2e..250083a 100644
--- a/paludis/resolver/destination_utils-fwd.hh
+++ b/paludis/resolver/destination_utils-fwd.hh
@@ -25,6 +25,7 @@
#include <paludis/package_id-fwd.hh>
#include <paludis/generator-fwd.hh>
#include <paludis/filtered_generator-fwd.hh>
+#include <paludis/environment-fwd.hh>
namespace paludis
{
@@ -33,7 +34,10 @@ namespace paludis
bool can_make_binary_for(const std::shared_ptr<const PackageID> & id) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
bool can_chroot(const std::shared_ptr<const PackageID> & id) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
- FilteredGenerator destination_filtered_generator(const DestinationType, const Generator &) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
+ FilteredGenerator destination_filtered_generator(
+ const Environment * const,
+ const DestinationType,
+ const Generator &) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
}
}
diff --git a/paludis/resolver/destination_utils.cc b/paludis/resolver/destination_utils.cc
index 3abba34..7097e87 100644
--- a/paludis/resolver/destination_utils.cc
+++ b/paludis/resolver/destination_utils.cc
@@ -83,15 +83,18 @@ namespace
}
FilteredGenerator
-paludis::resolver::destination_filtered_generator(const DestinationType t, const Generator & g)
+paludis::resolver::destination_filtered_generator(
+ const Environment * const env,
+ const DestinationType t,
+ const Generator & g)
{
switch (t)
{
case dt_install_to_slash:
- return g | filter::InstalledAtSlash();
+ return g | filter::InstalledAtRoot(env->system_root_key()->value());
case dt_install_to_chroot:
- return g | filter::InstalledAtNotSlash();
+ return g | filter::InstalledNotAtRoot(env->system_root_key()->value());
case dt_create_binary:
return g & BinaryDestinationGenerator();
diff --git a/paludis/resolver/find_repository_for_helper.cc b/paludis/resolver/find_repository_for_helper.cc
index b0b0221..3aaf4a6 100644
--- a/paludis/resolver/find_repository_for_helper.cc
+++ b/paludis/resolver/find_repository_for_helper.cc
@@ -81,12 +81,12 @@ FindRepositoryForHelper::operator() (
switch (resolution->resolvent().destination_type())
{
case dt_install_to_slash:
- if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() != FSPath("/")))
+ if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() != _imp->env->system_root_key()->value()))
continue;
break;
case dt_install_to_chroot:
- if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() == FSPath("/")))
+ if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() == _imp->env->system_root_key()->value()))
continue;
break;
diff --git a/paludis/resolver/get_initial_constraints_for_helper.cc b/paludis/resolver/get_initial_constraints_for_helper.cc
index a82a3ee..85b1540 100644
--- a/paludis/resolver/get_initial_constraints_for_helper.cc
+++ b/paludis/resolver/get_initial_constraints_for_helper.cc
@@ -143,26 +143,6 @@ GetInitialConstraintsForHelper::operator() (const Resolvent & resolvent) const
namespace
{
- Filter make_destination_filter_fn(const Resolvent & resolvent)
- {
- switch (resolvent.destination_type())
- {
- case dt_install_to_slash:
- return filter::InstalledAtSlash();
-
- case dt_install_to_chroot:
- return filter::InstalledAtNotSlash();
-
- case dt_create_binary:
- throw InternalError(PALUDIS_HERE, "no dt_create_binary yet");
-
- case last_dt:
- break;
- }
-
- throw InternalError(PALUDIS_HERE, "unhandled dt");
- }
-
bool is_scm_name(const QualifiedPackageName & n)
{
std::string pkg(stringify(n.package()));
@@ -214,7 +194,7 @@ namespace
Context context("When working out whether '" + stringify(q) + "' has installed SCM packages:");
const std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsUnsorted(
- destination_filtered_generator(q.destination_type(), generator::Package(q.package())) |
+ destination_filtered_generator(env, q.destination_type(), generator::Package(q.package())) |
make_slot_filter(q)
)]);
diff --git a/paludis/resolver/get_resolvents_for_helper.cc b/paludis/resolver/get_resolvents_for_helper.cc
index daa85dc..04d5f49 100644
--- a/paludis/resolver/get_resolvents_for_helper.cc
+++ b/paludis/resolver/get_resolvents_for_helper.cc
@@ -36,6 +36,7 @@
#include <paludis/filter.hh>
#include <paludis/selection.hh>
#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
#include <algorithm>
using namespace paludis;
@@ -280,7 +281,8 @@ GetResolventsForHelper::operator() (
auto installed_ids((*_imp->env)[selection::BestVersionInEachSlot(
generator::Matches(spec, { }) |
(_imp->target_destination_type == dt_install_to_chroot ?
- Filter(filter::InstalledAtNotSlash()) : Filter(filter::InstalledAtSlash())))]);
+ Filter(filter::InstalledNotAtRoot(_imp->env->system_root_key()->value())) :
+ Filter(filter::InstalledAtRoot(_imp->env->system_root_key()->value()))))]);
auto target(is_target(reason));
auto want_installed(target ? _imp->want_installed_slots_for_targets : _imp->want_installed_slots_otherwise);
diff --git a/paludis/resolver/interest_in_spec_helper.cc b/paludis/resolver/interest_in_spec_helper.cc
index 0d29c70..76d7192 100644
--- a/paludis/resolver/interest_in_spec_helper.cc
+++ b/paludis/resolver/interest_in_spec_helper.cc
@@ -35,6 +35,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/environment.hh>
#include <paludis/package_dep_spec_collection.hh>
+#include <paludis/metadata_key.hh>
#include <list>
using namespace paludis;
@@ -184,7 +185,7 @@ namespace
const std::shared_ptr<const PackageIDSequence> installed_ids(
(*env)[selection::SomeArbitraryVersion(
generator::Matches(*dep.spec().if_package(), { }) |
- filter::InstalledAtSlash())]);
+ filter::InstalledAtRoot(env->system_root_key()->value()))]);
if (installed_ids->empty())
return false;
}
@@ -293,7 +294,7 @@ InterestInSpecHelper::operator() (
const std::shared_ptr<const PackageIDSequence> installed_ids(
(*_imp->env)[selection::SomeArbitraryVersion(
generator::Matches(*dep.spec().if_package(), { }) |
- filter::InstalledAtSlash())]);
+ filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]);
if (! installed_ids->empty())
return si_take;
}
diff --git a/paludis/resolver/make_destination_filtered_generator_helper.cc b/paludis/resolver/make_destination_filtered_generator_helper.cc
index 96a55b5..000508a 100644
--- a/paludis/resolver/make_destination_filtered_generator_helper.cc
+++ b/paludis/resolver/make_destination_filtered_generator_helper.cc
@@ -64,7 +64,7 @@ MakeDestinationFilteredGeneratorHelper::operator() (
const Generator & g,
const std::shared_ptr<const Resolution> & r) const
{
- return destination_filtered_generator(r->resolvent().destination_type(), g);
+ return destination_filtered_generator(_imp->env, r->resolvent().destination_type(), g);
}
template class Pimp<MakeDestinationFilteredGeneratorHelper>;
diff --git a/src/clients/cave/select_format_for_spec.cc b/src/clients/cave/select_format_for_spec.cc
index 62cbfa1..94be4a9 100644
--- a/src/clients/cave/select_format_for_spec.cc
+++ b/src/clients/cave/select_format_for_spec.cc
@@ -25,6 +25,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/generator.hh>
+#include <paludis/metadata_key.hh>
using namespace paludis;
using namespace cave;
@@ -39,7 +40,7 @@ paludis::cave::select_format_for_spec(
const T_ & if_unavailable
)
{
- if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, { }) | filter::InstalledAtSlash())]->empty())
+ if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->system_root_key()->value()))]->empty())
return if_installed;
if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, { }) | filter::SupportsAction<InstallAction>()
| filter::NotMasked())]->empty())