aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-20 20:56:10 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-20 20:56:10 +0000
commitbd6ed3ba8274e80d8d78bd55c942159bd6149465 (patch)
tree92b88ea641305c5f1cb39a7be614b70f40d49389
parent8d1975d4ae88a0c11360206d5840450a3f3f2049 (diff)
downloadpaludis-bd6ed3ba8274e80d8d78bd55c942159bd6149465.tar.gz
paludis-bd6ed3ba8274e80d8d78bd55c942159bd6149465.tar.xz
We need generation with dpe list entry destinations
-rw-r--r--paludis/dep_list/dep_list.cc45
-rw-r--r--paludis/dep_list/dep_list.hh8
-rw-r--r--paludis/dep_list/dep_list.sr11
-rw-r--r--paludis/tasks/install_task.cc18
-rw-r--r--paludis/util/compare.hh4
-rw-r--r--ruby/dep_list.cc4
-rw-r--r--ruby/dep_list_TEST.rb2
-rw-r--r--src/output/console_install_task.cc10
8 files changed, 73 insertions, 29 deletions
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index 5cad3d4..2ce4aeb 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -26,6 +26,7 @@
#include <paludis/match_package.hh>
#include <paludis/hashed_containers.hh>
#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/compare.hh>
#include <paludis/util/iterator.hh>
#include <paludis/util/join.hh>
#include <paludis/util/log.hh>
@@ -341,6 +342,7 @@ DepList::QueryVisitor::visit(const PackageDepAtom * const a)
result = false;
+ // TODO: check destinations
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> matches(d->_imp->env->package_database()->query(
*a, is_installed_only, qo_whatever));
@@ -383,6 +385,7 @@ DepList::QueryVisitor::visit(const PackageDepAtom * const a)
if (p.second != std::find_if(p.first, p.second,
MatchDepListEntryAgainstPackageDepAtom(d->_imp->env, a)))
{
+ // TODO: check destination
result = true;
return;
}
@@ -484,6 +487,7 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
Context context("When adding PackageDepAtom '" + stringify(*a) + "':");
/* find already installed things */
+ // TODO: check destinations
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> already_installed(d->_imp->env->package_database()->query(
*a, is_installed_only, qo_order_by_version));
@@ -507,6 +511,9 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
.tag(std::tr1::shared_ptr<DepTag>(new DependencyDepTag(*d->_imp->current_pde())))
.generation(d->_imp->merge_list_generation));
+ /* add an appropriate destination */
+ // TODO
+
/* have our deps been merged already, or is this a circular dep? */
if (dle_no_deps == existing_merge_list_entry->state)
{
@@ -867,6 +874,8 @@ DepList::AddVisitor::visit(const BlockDepAtom * const a)
if (dl_blocks_discard_completely == d->_imp->opts->blocks)
return;
+ // TODO: check destinations
+
Context context("When checking BlockDepAtom '!" + stringify(*a->blocked_atom()) + "':");
PackageDepAtom just_package(a->blocked_atom()->package());
@@ -1104,10 +1113,11 @@ DepList::add_package(const PackageDatabaseEntry & p, std::tr1::shared_ptr<const
/* create our merge list entry. insert pre deps before ourself in the list. insert
* post deps after ourself, and after any provides. */
- std::tr1::shared_ptr<DestinationsCollection> our_merge_entry_destinations(
- new DestinationsCollection::Concrete);
+ std::tr1::shared_ptr<SortedCollection<DepListEntryDestination> > our_merge_entry_destinations(
+ new SortedCollection<DepListEntryDestination>::Concrete);
if (! metadata->virtual_interface)
- our_merge_entry_destinations->insert(find_destination(p, destinations));
+ our_merge_entry_destinations->insert(
+ DepListEntryDestination(find_destination(p, destinations), _imp->merge_list_generation));
MergeList::iterator our_merge_entry_position(
_imp->merge_list.insert(_imp->merge_list_insert_position,
@@ -1175,8 +1185,8 @@ DepList::add_package(const PackageDatabaseEntry & p, std::tr1::shared_ptr<const
.generation(_imp->merge_list_generation)
.state(dle_has_all_deps)
.tags(std::tr1::shared_ptr<DepListEntryTags>(new DepListEntryTags::Concrete))
- .destinations(std::tr1::shared_ptr<DestinationsCollection>(
- new DestinationsCollection::Concrete))
+ .destinations(std::tr1::shared_ptr<SortedCollection<DepListEntryDestination> >(
+ new SortedCollection<DepListEntryDestination>::Concrete))
.associated_entry(&*_imp->current_merge_list_entry)
.kind(dlk_provided)));
_imp->merge_list_index.insert(std::make_pair((*i)->text(), our_merge_entry_post_position));
@@ -1247,8 +1257,8 @@ DepList::add_error_package(const PackageDatabaseEntry & p, const DepListEntryKin
.generation(_imp->merge_list_generation)
.state(dle_has_all_deps)
.tags(std::tr1::shared_ptr<DepListEntryTags>(new DepListEntryTags::Concrete))
- .destinations(std::tr1::shared_ptr<DestinationsCollection>(
- new DestinationsCollection::Concrete))
+ .destinations(std::tr1::shared_ptr<SortedCollection<DepListEntryDestination> >(
+ new SortedCollection<DepListEntryDestination>::Concrete))
.associated_entry(&*_imp->current_merge_list_entry)
.kind(kind)));
@@ -1275,9 +1285,10 @@ DepList::add_suggested_package(const PackageDatabaseEntry & p,
return;
}
- std::tr1::shared_ptr<DestinationsCollection> our_merge_entry_destinations(
- new DestinationsCollection::Concrete);
- our_merge_entry_destinations->insert(find_destination(p, destinations));
+ std::tr1::shared_ptr<SortedCollection<DepListEntryDestination> > our_merge_entry_destinations(
+ new SortedCollection<DepListEntryDestination>::Concrete);
+ our_merge_entry_destinations->insert(DepListEntryDestination(find_destination(p, destinations),
+ _imp->merge_list_generation));
MergeList::iterator our_merge_entry_position(
_imp->merge_list.insert(_imp->merge_list_insert_position,
@@ -1371,8 +1382,8 @@ DepList::add_already_installed_package(const PackageDatabaseEntry & p, std::tr1:
.generation(_imp->merge_list_generation)
.tags(std::tr1::shared_ptr<DepListEntryTags>(new DepListEntryTags::Concrete))
.state(dle_has_pre_deps)
- .destinations(std::tr1::shared_ptr<DestinationsCollection>(
- new DestinationsCollection::Concrete))
+ .destinations(std::tr1::shared_ptr<SortedCollection<DepListEntryDestination> >(
+ new SortedCollection<DepListEntryDestination>::Concrete))
.associated_entry(0)
.kind(dlk_already_installed)));
_imp->merge_list_index.insert(std::make_pair(p.name, our_merge_entry));
@@ -1614,3 +1625,13 @@ DepList::find_destination(const PackageDatabaseEntry & p,
throw NoDestinationError(p, dd);
}
+std::tr1::shared_ptr<DestinationsCollection>
+paludis::extract_dep_list_entry_destinations(std::tr1::shared_ptr<SortedCollection<DepListEntryDestination> > d)
+{
+ std::tr1::shared_ptr<DestinationsCollection> result(new DestinationsCollection::Concrete);
+ for (SortedCollection<DepListEntryDestination>::Iterator i(d->begin()), i_end(d->end()) ;
+ i != i_end ; ++i)
+ result->insert(i->destination);
+ return result;
+}
+
diff --git a/paludis/dep_list/dep_list.hh b/paludis/dep_list/dep_list.hh
index de4a83f..a1d44a6 100644
--- a/paludis/dep_list/dep_list.hh
+++ b/paludis/dep_list/dep_list.hh
@@ -130,6 +130,14 @@ namespace paludis
///\}
};
+
+ /**
+ * Extract the destinations from a DepListEntry destinations member.
+ *
+ * \ingroup grpdepresolver
+ */
+ std::tr1::shared_ptr<DestinationsCollection> extract_dep_list_entry_destinations(
+ std::tr1::shared_ptr<SortedCollection<DepListEntryDestination> >);
}
#endif
diff --git a/paludis/dep_list/dep_list.sr b/paludis/dep_list/dep_list.sr
index 82b581f..fdfd8bf 100644
--- a/paludis/dep_list/dep_list.sr
+++ b/paludis/dep_list/dep_list.sr
@@ -45,6 +45,15 @@ END
END
}
+make_class_DepListEntryDestination()
+{
+ key destination "std::tr1::shared_ptr<Repository>"
+ key generation long
+
+ allow_named_args
+ comparison_operators "all" "destination"
+}
+
make_class_DepListEntry()
{
key kind DepListEntryKind
@@ -53,7 +62,7 @@ make_class_DepListEntry()
key associated_entry "const DepListEntry *"
key metadata "std::tr1::shared_ptr<const VersionMetadata>"
key tags "std::tr1::shared_ptr<DepListEntryTags>"
- key destinations "std::tr1::shared_ptr<const DestinationsCollection>"
+ key destinations "std::tr1::shared_ptr<SortedCollection<DepListEntryDestination> >"
key generation long
key state DepListEntryState
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index fc1297c..dd0e768 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -229,9 +229,10 @@ InstallTask::execute()
for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
dep != dep_end && ! any_live_destination ; ++dep)
if (dlk_package == dep->kind && dep->destinations)
- for (DestinationsCollection::Iterator d(dep->destinations->begin()),
+ for (SortedCollection<DepListEntryDestination>::Iterator d(dep->destinations->begin()),
d_end(dep->destinations->end()) ; d != d_end ; ++d)
- if ((*d)->destination_interface && (*d)->destination_interface->want_pre_post_phases())
+ if (d->destination->destination_interface &&
+ d->destination->destination_interface->want_pre_post_phases())
any_live_destination = true;
_imp->env->perform_hook(Hook("install_all_pre")
@@ -255,9 +256,9 @@ InstallTask::execute()
bool live_destination(false);
if (dep->destinations)
- for (DestinationsCollection::Iterator d(dep->destinations->begin()),
+ for (SortedCollection<DepListEntryDestination>::Iterator d(dep->destinations->begin()),
d_end(dep->destinations->end()) ; d != d_end ; ++d)
- if ((*d)->destination_interface && (*d)->destination_interface->want_pre_post_phases())
+ if (d->destination->destination_interface && d->destination->destination_interface->want_pre_post_phases())
live_destination = true;
++x;
@@ -293,7 +294,7 @@ InstallTask::execute()
try
{
- _imp->install_options.destinations = dep->destinations;
+ _imp->install_options.destinations = extract_dep_list_entry_destinations(dep->destinations);
installable_interface->install(dep->package.name, dep->package.version, _imp->install_options);
}
catch (const PackageInstallActionError & e)
@@ -336,12 +337,13 @@ InstallTask::execute()
std::tr1::shared_ptr<PackageDatabaseEntryCollection> collision_list;
if (dep->destinations)
- for (DestinationsCollection::Iterator d(dep->destinations->begin()),
+ for (SortedCollection<DepListEntryDestination>::Iterator d(dep->destinations->begin()),
d_end(dep->destinations->end()) ; d != d_end ; ++d)
- if ((*d)->uninstallable_interface)
+ if (d->destination->uninstallable_interface)
collision_list = _imp->env->package_database()->query(
query::Matches(PackageDepAtom(stringify(dep->package.name) + ":" + stringify(dep->metadata->slot)
- + "::" + stringify((*d)->name()))) & query::RepositoryHasInstalledInterface(), qo_order_by_version);
+ + "::" + stringify(d->destination->name()))) &
+ query::RepositoryHasInstalledInterface(), qo_order_by_version);
// don't clean the thing we just installed
PackageDatabaseEntryCollection::Concrete clean_list;
diff --git a/paludis/util/compare.hh b/paludis/util/compare.hh
index b695a84..458fc70 100644
--- a/paludis/util/compare.hh
+++ b/paludis/util/compare.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -152,7 +152,7 @@ namespace paludis
{
if (t1 < t2)
return -1;
- else if (t1 > t2)
+ else if (t2 < t1)
return 1;
else
return 0;
diff --git a/ruby/dep_list.cc b/ruby/dep_list.cc
index faf1bbc..da30531 100644
--- a/ruby/dep_list.cc
+++ b/ruby/dep_list.cc
@@ -1035,6 +1035,7 @@ namespace
}
}
+#if CIARANM_DISABLED_THIS
/*
* call-seq:
* destinations -> Array
@@ -1052,6 +1053,7 @@ namespace
rb_ary_push(result, repository_to_value(*i));
return result;
}
+#endif
VALUE
dep_list_override_masks_init(VALUE self)
@@ -1502,7 +1504,9 @@ namespace
rb_define_method(c_dep_list_entry, "metadata", RUBY_FUNC_CAST(&dep_list_entry_metadata), 0);
rb_define_method(c_dep_list_entry, "state", RUBY_FUNC_CAST(&dep_list_entry_state), 0);
rb_define_method(c_dep_list_entry, "tags", RUBY_FUNC_CAST(&dep_list_entry_tags), 0);
+#if CIARANM_DISABLED_THIS
rb_define_method(c_dep_list_entry, "destinations", RUBY_FUNC_CAST(&dep_list_entry_destinations), 0);
+#endif
/*
* Document-class: DepListOverrideMasks
diff --git a/ruby/dep_list_TEST.rb b/ruby/dep_list_TEST.rb
index 8c10677..afa98a0 100644
--- a/ruby/dep_list_TEST.rb
+++ b/ruby/dep_list_TEST.rb
@@ -248,7 +248,7 @@ module Paludis
dep_list_entry = dle
{
:package => PackageDatabaseEntry, :metadata => VersionMetadata,
- :state=> Integer, :tags => Array, :destinations => Array
+ :state=> Integer, :tags => Array
}.each_pair do |method, returns|
assert_respond_to dep_list_entry, method
assert_kind_of returns, dep_list_entry.send(method)
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 669e2ad..b37b181 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -207,7 +207,7 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
std::string repo;
if (d.destinations && ! d.destinations->empty())
- repo = "::" + stringify((*d.destinations->begin())->name());
+ repo = "::" + stringify((d.destinations->begin()->destination)->name());
std::tr1::shared_ptr<PackageDatabaseEntryCollection> existing_repo(environment()->package_database()->
query(query::Matches(PackageDepAtom(stringify(d.package.name) + repo)), qo_order_by_version));
@@ -788,16 +788,16 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
case normal_entry:
output_no_endl(render_as_update_mode(" ["));
- for (DestinationsCollection::Iterator dest(d.destinations->begin()), dest_end(d.destinations->end()) ;
- dest != dest_end ; ++dest)
+ for (SortedCollection<DepListEntryDestination>::Iterator dest(d.destinations->begin()),
+ dest_end(d.destinations->end()) ; dest != dest_end ; ++dest)
{
if (need_comma)
output_no_endl(render_as_update_mode(", "));
std::string destination_str;
std::tr1::shared_ptr<const DestinationsCollection> default_destinations(environment()->default_destinations());
- if (default_destinations->end() == default_destinations->find(*dest))
- destination_str = " ::" + stringify((*dest)->name());
+ if (default_destinations->end() == default_destinations->find(dest->destination))
+ destination_str = " ::" + stringify(dest->destination->name());
if (existing_repo->empty())
{