aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-16 21:14:20 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-16 21:14:20 +0100
commit4335244dfd067f24d44e775c08865753384e8158 (patch)
treebdb7c36344e3ca7a11301ce98365c48082801f65
parent988e54546d7a22c3862ed4c4d8bb2deace1825aa (diff)
downloadpaludis-4335244dfd067f24d44e775c08865753384e8158.tar.gz
paludis-4335244dfd067f24d44e775c08865753384e8158.tar.xz
virtuals support
-rw-r--r--.gitignore1
-rw-r--r--paludis/resolver/Makefile.am25
-rw-r--r--paludis/resolver/resolver.cc113
-rw-r--r--paludis/resolver/resolver.hh5
-rw-r--r--paludis/resolver/resolver_TEST_blockers.cc2
-rw-r--r--paludis/resolver/resolver_TEST_suggestions.cc2
-rw-r--r--paludis/resolver/resolver_TEST_virtuals.cc101
-rwxr-xr-xpaludis/resolver/resolver_TEST_virtuals_cleanup.sh9
-rwxr-xr-xpaludis/resolver/resolver_TEST_virtuals_setup.sh65
-rw-r--r--paludis/resolver/resolver_test.cc41
-rw-r--r--paludis/resolver/resolver_test.hh3
-rw-r--r--paludis/resolver/sanitised_dependencies.cc32
12 files changed, 367 insertions, 32 deletions
diff --git a/.gitignore b/.gitignore
index 71010b1..fa4095f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -310,6 +310,7 @@ paludis-*.*.*.tar.bz2
/paludis/repository_name_cache_TEST
/paludis/resolver/resolver_TEST_blockers
/paludis/resolver/resolver_TEST_suggestions
+/paludis/resolver/resolver_TEST_virtuals
/paludis/selection_TEST
/paludis/set_file_TEST
/paludis/stringify_formatter_TEST
diff --git a/paludis/resolver/Makefile.am b/paludis/resolver/Makefile.am
index a32ac91..6208ff9 100644
--- a/paludis/resolver/Makefile.am
+++ b/paludis/resolver/Makefile.am
@@ -73,19 +73,25 @@ TESTS_ENVIRONMENT = env \
$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/.libs/`" \
bash $(top_srcdir)/test/run_test.sh
+if ENABLE_VIRTUALS_REPOSITORY
+virtuals_tests = resolver_TEST_virtuals
+endif
+
if ENABLE_NEW_RESOLVER
noinst_LIBRARIES = libpaludisresolver.a
TESTS = \
resolver_TEST_blockers \
- resolver_TEST_suggestions
+ resolver_TEST_suggestions \
+ $(virtuals_tests)
endif
check_PROGRAMS = $(TESTS)
check_SCRIPTS = \
resolver_TEST_blockers_setup.sh resolver_TEST_blockers_cleanup.sh \
- resolver_TEST_suggestions_setup.sh resolver_TEST_suggestions_cleanup.sh
+ resolver_TEST_suggestions_setup.sh resolver_TEST_suggestions_cleanup.sh \
+ resolver_TEST_virtuals_setup.sh resolver_TEST_virtuals_cleanup.sh
check_LIBRARIES = libpaludisresolvertest.a
libpaludisresolvertest_a_SOURCES = \
@@ -107,6 +113,21 @@ resolver_TEST_blockers_LDADD = \
resolver_TEST_blockers_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+resolver_TEST_virtuals_SOURCES = resolver_TEST_virtuals.cc
+
+resolver_TEST_virtuals_LDADD = \
+ libpaludisresolvertest.a \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/test/libtest.a \
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/repositories/fake/libpaludisfakerepository_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ libpaludisresolver.a \
+ $(DYNAMIC_LD_LIBS)
+
+resolver_TEST_virtuals_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+
resolver_TEST_suggestions_SOURCES = resolver_TEST_suggestions.cc
resolver_TEST_suggestions_LDADD = \
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index 792ac3d..04e2cb8 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -29,12 +29,14 @@
#include <paludis/resolver/resolver_functions.hh>
#include <paludis/resolver/suggest_restart.hh>
#include <paludis/resolver/resolutions.hh>
+#include <paludis/resolver/serialise.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/log.hh>
#include <paludis/util/join.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/mutex.hh>
#include <paludis/environment.hh>
#include <paludis/notifier_callback.hh>
#include <paludis/dep_spec_flattener.hh>
@@ -52,16 +54,19 @@
#include <paludis/package_database.hh>
#include <paludis/repository.hh>
#include <paludis/choice.hh>
+#include <paludis/spec_tree.hh>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <set>
+#include "config.h"
using namespace paludis;
using namespace paludis::resolver;
typedef std::map<QPN_S, std::tr1::shared_ptr<Resolution> > ResolutionsByQPN_SMap;
+typedef std::map<QualifiedPackageName, std::set<QualifiedPackageName> > Rewrites;
namespace paludis
{
@@ -73,11 +78,16 @@ namespace paludis
ResolutionsByQPN_SMap resolutions_by_qpn_s;
+ mutable Mutex rewrites_mutex;
+ mutable Rewrites rewrites;
+ mutable bool has_rewrites;
+
std::tr1::shared_ptr<ResolutionLists> resolution_lists;
Implementation(const Environment * const e, const ResolverFunctions & f) :
env(e),
fns(f),
+ has_rewrites(false),
resolution_lists(new ResolutionLists(make_named_values<ResolutionLists>(
value_for<n::all>(new Resolutions),
value_for<n::errors>(new Resolutions),
@@ -530,7 +540,23 @@ Resolver::_made_wrong_decision(const QPN_S & qpn_s,
}
}
else
- throw InternalError(PALUDIS_HERE, "unimplemented: made decision, now can't make one");
+ {
+ std::string old_decision("none");
+ if (resolution->decision())
+ {
+ if (resolution->decision()->if_package_id())
+ old_decision = stringify(*resolution->decision()->if_package_id());
+ else
+ old_decision = stringify(resolution->decision()->kind());
+ }
+
+ std::stringstream str;
+ Serialiser ser(str);
+ constraint->serialise(ser);
+
+ throw InternalError(PALUDIS_HERE, "unimplemented: made decision " + old_decision +
+ ", now can't make one because of " + str.str());
+ }
}
void
@@ -632,15 +658,6 @@ bool
Resolver::_care_about_dependency_spec(const QPN_S & qpn_s,
const std::tr1::shared_ptr<const Resolution> & resolution, const SanitisedDependency & dep) const
{
- /* dirty dirty hack */
- if (dep.spec().if_block())
- if (dep.spec().if_block()->blocking().package_ptr()->category() == CategoryNamePart("virtual"))
- {
- Log::get_instance()->message("resolver.virtual_haxx", ll_warning, lc_context)
- << "Ignoring " << dep.spec() << " from " << qpn_s << " for now";
- return false;
- }
-
return _imp->fns.care_about_dep_fn()(qpn_s, resolution, dep);
}
@@ -1494,6 +1511,82 @@ Resolver::resolution_lists() const
return _imp->resolution_lists;
}
+const std::tr1::shared_ptr<DependencySpecTree>
+Resolver::rewrite_if_special(const PackageOrBlockDepSpec & s, const QPN_S & our_qpn_s) const
+{
+ if (s.if_package() && s.if_package()->package_ptr())
+ {
+ if (s.if_package()->package_ptr()->category() != CategoryNamePart("virtual"))
+ return make_null_shared_ptr();
+ _need_rewrites();
+
+ Rewrites::const_iterator r(_imp->rewrites.find(*s.if_package()->package_ptr()));
+ if (r == _imp->rewrites.end())
+ return make_null_shared_ptr();
+
+ std::tr1::shared_ptr<DependencySpecTree> result(new DependencySpecTree(make_shared_ptr(new AllDepSpec)));
+ std::tr1::shared_ptr<DependencySpecTree::NodeType<AnyDepSpec>::Type> any(result->root()->append(make_shared_ptr(new AnyDepSpec)));
+ for (std::set<QualifiedPackageName>::const_iterator n(r->second.begin()), n_end(r->second.end()) ;
+ n != n_end ; ++n)
+ any->append(make_shared_ptr(new PackageDepSpec(PartiallyMadePackageDepSpec(*s.if_package()).package(*n))));
+
+ return result;
+ }
+ else if (s.if_block() && s.if_block()->blocking().package_ptr())
+ {
+ if (s.if_block()->blocking().package_ptr()->category() != CategoryNamePart("virtual"))
+ return make_null_shared_ptr();
+ _need_rewrites();
+
+ Rewrites::const_iterator r(_imp->rewrites.find(*s.if_block()->blocking().package_ptr()));
+ if (r == _imp->rewrites.end())
+ return make_null_shared_ptr();
+
+ std::tr1::shared_ptr<DependencySpecTree> result(new DependencySpecTree(make_shared_ptr(new AllDepSpec)));
+ for (std::set<QualifiedPackageName>::const_iterator n(r->second.begin()), n_end(r->second.end()) ;
+ n != n_end ; ++n)
+ {
+ if (*n == our_qpn_s.package())
+ continue;
+
+ PackageDepSpec spec(PartiallyMadePackageDepSpec(s.if_block()->blocking()).package(*n));
+ std::string prefix(s.if_block()->blocking().text());
+ std::string::size_type p(prefix.find_first_not_of('!'));
+ if (std::string::npos != p)
+ prefix.erase(p);
+ result->root()->append(make_shared_ptr(new BlockDepSpec(prefix + stringify(spec), spec, s.if_block()->strong())));
+ }
+
+ return result;
+ }
+ else
+ return make_null_shared_ptr();
+}
+
+void
+Resolver::_need_rewrites() const
+{
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ Lock lock(_imp->rewrites_mutex);
+ if (_imp->has_rewrites)
+ return;
+ _imp->has_rewrites = true;
+
+ const std::tr1::shared_ptr<const PackageIDSequence> ids((*_imp->env)[selection::AllVersionsSorted(
+ generator::InRepository(RepositoryName("virtuals")) +
+ generator::InRepository(RepositoryName("installed-virtuals"))
+ )]);
+ for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ i != i_end ; ++i)
+ {
+ if (! ((*i)->virtual_for_key()))
+ throw InternalError(PALUDIS_HERE, "huh? " + stringify(**i) + " has no virtual_for_key");
+ _imp->rewrites.insert(std::make_pair((*i)->name(), std::set<QualifiedPackageName>())).first->second.insert(
+ (*i)->virtual_for_key()->value()->name());
+ }
+#endif
+}
+
template class WrappedForwardIterator<Resolver::ResolutionsByQPN_SConstIteratorTag,
const std::pair<const QPN_S, std::tr1::shared_ptr<Resolution> > >;
diff --git a/paludis/resolver/resolver.hh b/paludis/resolver/resolver.hh
index 15b658f..2d275ce 100644
--- a/paludis/resolver/resolver.hh
+++ b/paludis/resolver/resolver.hh
@@ -39,6 +39,7 @@
#include <paludis/name.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/repository-fwd.hh>
+#include <paludis/spec_tree-fwd.hh>
#include <tr1/memory>
namespace paludis
@@ -150,6 +151,8 @@ namespace paludis
const QPN_S &, const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const PackageIDSequence> &) const;
+ void _need_rewrites() const;
+
public:
Resolver(
const Environment * const,
@@ -172,6 +175,8 @@ namespace paludis
int find_any_score(const QPN_S &, const SanitisedDependency &) const;
+ const std::tr1::shared_ptr<DependencySpecTree> rewrite_if_special(const PackageOrBlockDepSpec &,
+ const QPN_S & from_qpn_s) const;
};
}
}
diff --git a/paludis/resolver/resolver_TEST_blockers.cc b/paludis/resolver/resolver_TEST_blockers.cc
index a05c9cf..3482831 100644
--- a/paludis/resolver/resolver_TEST_blockers.cc
+++ b/paludis/resolver/resolver_TEST_blockers.cc
@@ -57,7 +57,7 @@ namespace
struct ResolverBlockersTestCase : ResolverTestCase
{
ResolverBlockersTestCase(const std::string & s) :
- ResolverTestCase("blockers", s)
+ ResolverTestCase("blockers", s, "exheres-0", "exheres")
{
}
};
diff --git a/paludis/resolver/resolver_TEST_suggestions.cc b/paludis/resolver/resolver_TEST_suggestions.cc
index 9f9c75b..e6d662b 100644
--- a/paludis/resolver/resolver_TEST_suggestions.cc
+++ b/paludis/resolver/resolver_TEST_suggestions.cc
@@ -57,7 +57,7 @@ namespace
struct ResolverSuggestionsTestCase : ResolverTestCase
{
ResolverSuggestionsTestCase(const std::string & s) :
- ResolverTestCase("suggestions", s)
+ ResolverTestCase("suggestions", s, "exheres-0", "exheres")
{
}
};
diff --git a/paludis/resolver/resolver_TEST_virtuals.cc b/paludis/resolver/resolver_TEST_virtuals.cc
new file mode 100644
index 0000000..d8d1ce8
--- /dev/null
+++ b/paludis/resolver/resolver_TEST_virtuals.cc
@@ -0,0 +1,101 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/resolver/resolver.hh>
+#include <paludis/resolver/resolver_functions.hh>
+#include <paludis/resolver/resolution.hh>
+#include <paludis/resolver/decision.hh>
+#include <paludis/resolver/resolutions.hh>
+#include <paludis/resolver/constraint.hh>
+#include <paludis/resolver/qpn_s.hh>
+#include <paludis/resolver/suggest_restart.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <paludis/user_dep_spec.hh>
+#include <paludis/repository_factory.hh>
+#include <paludis/package_database.hh>
+
+#include <paludis/resolver/resolver_test.hh>
+#include <test/test_runner.hh>
+#include <test/test_framework.hh>
+
+#include <list>
+#include <tr1/functional>
+#include <algorithm>
+#include <map>
+
+using namespace paludis;
+using namespace paludis::resolver;
+using namespace paludis::resolver::resolver_test;
+using namespace test;
+
+namespace
+{
+ struct ResolverVirtualsTestCase : ResolverTestCase
+ {
+ ResolverVirtualsTestCase(const std::string & s) :
+ ResolverTestCase("virtuals", s, "0", "traditional")
+ {
+ }
+ };
+}
+
+namespace test_cases
+{
+ struct TestVirtuals : ResolverVirtualsTestCase
+ {
+ TestVirtuals() : ResolverVirtualsTestCase("virtuals") { }
+
+ void run()
+ {
+ std::tr1::shared_ptr<const ResolutionLists> resolutions(get_resolutions("virtuals/target"));
+
+ {
+ TestMessageSuffix s("errors");
+ check_resolution_list(resolutions->errors(), ResolutionListChecks()
+ .finished()
+ );
+ }
+
+ {
+ TestMessageSuffix s("ordered");
+ check_resolution_list(resolutions->ordered(), ResolutionListChecks()
+ .qpn(QualifiedPackageName("cat/foo-a"))
+ .qpn(QualifiedPackageName("virtuals/target"))
+ .finished()
+ );
+ }
+
+ {
+ TestMessageSuffix s("untaken");
+ check_resolution_list(resolutions->untaken(), ResolutionListChecks()
+ .finished()
+ );
+ }
+ }
+ } test_virtuals;
+}
+
diff --git a/paludis/resolver/resolver_TEST_virtuals_cleanup.sh b/paludis/resolver/resolver_TEST_virtuals_cleanup.sh
new file mode 100755
index 0000000..85c857e
--- /dev/null
+++ b/paludis/resolver/resolver_TEST_virtuals_cleanup.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d resolver_TEST_virtuals_dir ] ; then
+ rm -fr resolver_TEST_virtuals_dir
+else
+ true
+fi
+
diff --git a/paludis/resolver/resolver_TEST_virtuals_setup.sh b/paludis/resolver/resolver_TEST_virtuals_setup.sh
new file mode 100755
index 0000000..c177de3
--- /dev/null
+++ b/paludis/resolver/resolver_TEST_virtuals_setup.sh
@@ -0,0 +1,65 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir resolver_TEST_virtuals_dir || exit 1
+cd resolver_TEST_virtuals_dir || exit 1
+
+mkdir -p build
+mkdir -p distdir
+mkdir -p installed
+
+mkdir -p repo/{profiles/profile,metadata}
+
+cd repo
+echo "repo" > profiles/repo_name
+: > profiles/categories
+cat <<'END' > profiles/profile/make.defaults
+ARCH=test
+END
+cat <<'END' > profiles/profile/virtuals
+virtual/foo cat/foo-a
+END
+
+# common providers
+
+echo 'cat' >> profiles/categories
+
+mkdir -p 'cat/foo-a'
+cat <<END > cat/foo-a/foo-a-1.ebuild
+DESCRIPTION="dep"
+KEYWORDS="test"
+SLOT="0"
+PROVIDE="virtual/foo"
+END
+
+mkdir -p 'cat/foo-b'
+cat <<END > cat/foo-b/foo-b-1.ebuild
+DESCRIPTION="dep"
+KEYWORDS="test"
+SLOT="0"
+PROVIDE="virtual/foo"
+END
+
+mkdir -p 'cat/foo-c'
+cat <<END > cat/foo-c/foo-c-1.ebuild
+DESCRIPTION="dep"
+KEYWORDS="test"
+SLOT="0"
+PROVIDE="virtual/foo"
+END
+
+# virtuals
+echo 'virtuals' >> profiles/categories
+
+mkdir -p 'virtuals/target'
+cat <<END > virtuals/target/target-1.ebuild
+DESCRIPTION="target"
+KEYWORDS="test"
+SLOT="0"
+DEPEND="
+ ( virtual/foo )
+ "
+END
+
+cd ..
+
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index b2053ea..f2ba1fd 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -39,6 +39,7 @@
#include <paludis/package_database.hh>
#include <paludis/user_dep_spec.hh>
#include <algorithm>
+#include "config.h"
using namespace paludis;
using namespace paludis::resolver;
@@ -108,6 +109,28 @@ namespace
{
}
};
+
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ std::string virtuals_repo_keys(const std::string & k)
+ {
+ if (k == "format")
+ return "virtuals";
+ else if (k == "root")
+ return "/";
+ else
+ return "";
+ }
+
+ std::string installed_virtuals_repo_keys(const std::string & k)
+ {
+ if (k == "format")
+ return "installed_virtuals";
+ else if (k == "root")
+ return "/";
+ else
+ return "";
+ }
+#endif
}
bool
@@ -141,7 +164,8 @@ paludis::resolver::resolver_test::get_use_installed_fn(
return ui_never;
}
-ResolverTestCase::ResolverTestCase(const std::string & t, const std::string & s) :
+ResolverTestCase::ResolverTestCase(const std::string & t, const std::string & s, const std::string & e,
+ const std::string & l) :
TestCase(s)
{
std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
@@ -149,10 +173,10 @@ ResolverTestCase::ResolverTestCase(const std::string & t, const std::string & s)
keys->insert("names_cache", "/var/empty");
keys->insert("location", stringify(FSEntry::cwd() / ("resolver_TEST_" + t + "_dir") / "repo"));
keys->insert("profiles", stringify(FSEntry::cwd() / ("resolver_TEST_" + t + "_dir") / "repo/profiles/profile"));
- keys->insert("layout", "exheres");
- keys->insert("eapi_when_unknown", "exheres-0");
- keys->insert("eapi_when_unspecified", "exheres-0");
- keys->insert("profile_eapi", "exheres-0");
+ keys->insert("layout", l);
+ keys->insert("eapi_when_unknown", e);
+ keys->insert("eapi_when_unspecified", e);
+ keys->insert("profile_eapi", e);
keys->insert("distdir", stringify(FSEntry::cwd() / ("resolver_TEST_" + t + "_dir") / "distdir"));
keys->insert("builddir", stringify(FSEntry::cwd() / ("resolver_TEST_" + t + "_dir") / "build"));
repo = RepositoryFactory::get_instance()->create(&env,
@@ -160,7 +184,7 @@ ResolverTestCase::ResolverTestCase(const std::string & t, const std::string & s)
env.package_database()->add_repository(1, repo);
keys.reset(new Map<std::string, std::string>);
- keys->insert("format", "exndbam");
+ keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
keys->insert("location", stringify(FSEntry::cwd() / ("resolver_TEST_" + t + "_dir") / "installed"));
@@ -171,6 +195,11 @@ ResolverTestCase::ResolverTestCase(const std::string & t, const std::string & s)
fake_inst_repo.reset(new FakeInstalledRepository(&env, RepositoryName("fake-inst"), true, false));
env.package_database()->add_repository(1, fake_inst_repo);
+
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ env.package_database()->add_repository(0, RepositoryFactory::get_instance()->create(&env, virtuals_repo_keys));
+ env.package_database()->add_repository(0, RepositoryFactory::get_instance()->create(&env, installed_virtuals_repo_keys));
+#endif
}
const std::tr1::shared_ptr<const ResolutionLists>
diff --git a/paludis/resolver/resolver_test.hh b/paludis/resolver/resolver_test.hh
index fc9219c..43e0be9 100644
--- a/paludis/resolver/resolver_test.hh
+++ b/paludis/resolver/resolver_test.hh
@@ -75,7 +75,8 @@ namespace paludis
std::tr1::shared_ptr<Repository> repo, inst_repo;
std::tr1::shared_ptr<FakeInstalledRepository> fake_inst_repo;
- ResolverTestCase(const std::string & group, const std::string & test_name);
+ ResolverTestCase(const std::string & group, const std::string & test_name, const std::string & eapi,
+ const std::string & layout);
const std::tr1::shared_ptr<const ResolutionLists> get_resolutions(const PackageDepSpec & target);
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index 07efa00..868cf8c 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -46,7 +46,7 @@ namespace
l->push_back(t);
}
- struct AnyOfAlternativesVisitor
+ struct MakeAnyOfStringVisitor
{
std::string result;
@@ -74,7 +74,7 @@ namespace
{
if (node.spec()->condition_met())
{
- AnyOfAlternativesVisitor v;
+ MakeAnyOfStringVisitor v;
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
result.append(" " + stringify(*node.spec()) + " ( " + v.result + ")");
}
@@ -82,14 +82,14 @@ namespace
void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
{
- AnyOfAlternativesVisitor v;
+ MakeAnyOfStringVisitor v;
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
result.append(" || ( " + v.result + ")");
}
void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
{
- AnyOfAlternativesVisitor v;
+ MakeAnyOfStringVisitor v;
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
result.append(" ( " + v.result + ")");
}
@@ -124,13 +124,19 @@ namespace
{
seen_any = true;
- if (active_sublist)
- active_sublist->push_back(spec);
+ std::tr1::shared_ptr<DependencySpecTree> if_rewritten(resolver.rewrite_if_special(spec, our_qpn_s));
+ if (if_rewritten)
+ if_rewritten->root()->accept(*this);
else
{
- std::list<PackageOrBlockDepSpec> l;
- l.push_back(spec);
- child_groups.push_back(l);
+ if (active_sublist)
+ active_sublist->push_back(spec);
+ else
+ {
+ std::list<PackageOrBlockDepSpec> l;
+ l.push_back(spec);
+ child_groups.push_back(l);
+ }
}
}
@@ -307,7 +313,11 @@ namespace
void add(const SanitisedDependency & dep)
{
- sanitised_dependencies.add(dep);
+ std::tr1::shared_ptr<DependencySpecTree> if_rewritten(resolver.rewrite_if_special(dep.spec(), our_qpn_s));
+ if (if_rewritten)
+ if_rewritten->root()->accept(*this);
+ else
+ sanitised_dependencies.add(dep);
}
SanitisedDependency make_sanitised(const PackageOrBlockDepSpec & spec)
@@ -375,7 +385,7 @@ namespace
Save<std::string> save_original_specs_as_string(&original_specs_as_string);
{
- AnyOfAlternativesVisitor v;
+ MakeAnyOfStringVisitor v;
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(v));
original_specs_as_string = "|| (" + v.result + " )";
}