aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-03 13:12:15 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-03 13:12:15 +0100
commit71342f5adab47f6dd1b695ddf917fbb54b964193 (patch)
tree0bb93a135fcfeb7efc51b6786e89e0a7982812ec
parent37d9cd6f1689f0f004302cceb198fd9b18373264 (diff)
downloadpaludis-71342f5adab47f6dd1b695ddf917fbb54b964193.tar.gz
paludis-71342f5adab47f6dd1b695ddf917fbb54b964193.tar.xz
Use created binaries when installing to multiple places
-rw-r--r--paludis/resolver/decision.cc22
-rw-r--r--paludis/resolver/decision.hh5
-rw-r--r--paludis/resolver/orderer.cc26
-rw-r--r--src/clients/cave/cmd_display_resolution.cc9
4 files changed, 58 insertions, 4 deletions
diff --git a/paludis/resolver/decision.cc b/paludis/resolver/decision.cc
index 59f903d..00f4081 100644
--- a/paludis/resolver/decision.cc
+++ b/paludis/resolver/decision.cc
@@ -23,6 +23,7 @@
#include <paludis/resolver/resolvent.hh>
#include <paludis/resolver/required_confirmations.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/sequence.hh>
@@ -142,6 +143,12 @@ ChangesToMakeDecision::deserialise(Deserialisation & d)
}
}
+ {
+ const std::tr1::shared_ptr<Deserialisation> dn(v.find_remove_member("if_via_new_binary_in"));
+ if (! dn->null())
+ result->set_via_new_binary_in(RepositoryName(dn->string_value()));
+ }
+
return result;
}
@@ -345,6 +352,7 @@ namespace paludis
const bool taken;
std::tr1::shared_ptr<const Destination> destination;
std::tr1::shared_ptr<RequiredConfirmations> required_confirmations;
+ std::tr1::shared_ptr<RepositoryName> if_via_new_binary_in;
Implementation(
const Resolvent & l,
@@ -448,6 +456,18 @@ ChangesToMakeDecision::taken() const
return _imp->taken;
}
+const std::tr1::shared_ptr<const RepositoryName>
+ChangesToMakeDecision::if_via_new_binary_in() const
+{
+ return _imp->if_via_new_binary_in;
+}
+
+void
+ChangesToMakeDecision::set_via_new_binary_in(const RepositoryName & n)
+{
+ _imp->if_via_new_binary_in = make_shared_copy(n);
+}
+
void
ChangesToMakeDecision::serialise(Serialiser & s) const
{
@@ -457,6 +477,8 @@ ChangesToMakeDecision::serialise(Serialiser & s) const
.member(SerialiserFlags<>(), "best", best())
.member(SerialiserFlags<>(), "change_type", stringify(change_type()))
.member(SerialiserFlags<serialise::might_be_null>(), "destination", destination())
+ .member(SerialiserFlags<serialise::might_be_null>(), "if_via_new_binary_in", if_via_new_binary_in() ?
+ make_shared_copy(stringify(*if_via_new_binary_in())) : make_null_shared_ptr())
.member(SerialiserFlags<>(), "taken", taken())
.member(SerialiserFlags<serialise::might_be_null, serialise::container>(), "required_confirmations_if_any", required_confirmations_if_any())
;
diff --git a/paludis/resolver/decision.hh b/paludis/resolver/decision.hh
index 6a386c1..dbff331 100644
--- a/paludis/resolver/decision.hh
+++ b/paludis/resolver/decision.hh
@@ -167,6 +167,11 @@ namespace paludis
const std::tr1::shared_ptr<const PackageID> origin_id() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ const std::tr1::shared_ptr<const RepositoryName> if_via_new_binary_in() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void set_via_new_binary_in(const RepositoryName &);
+
virtual bool best() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual ChangeType change_type() const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index 5a97f6c..9d592e2 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -513,6 +513,10 @@ Orderer::_add_binary_cleverness(const std::tr1::shared_ptr<const Resolution> & r
if (resolution->resolvent().destination_type() != dt_create_binary)
return;
+ const ChangesToMakeDecision * changes_decision(simple_visitor_cast<const ChangesToMakeDecision>(*resolution->decision()));
+ if (! changes_decision)
+ return;
+
for (EnumIterator<DestinationType> t, t_end(last_dt) ; t != t_end ; ++t)
{
if (*t == dt_create_binary)
@@ -521,10 +525,16 @@ Orderer::_add_binary_cleverness(const std::tr1::shared_ptr<const Resolution> & r
Resolvent non_binary_resolvent(resolution->resolvent());
non_binary_resolvent.destination_type() = *t;
- if (_imp->resolved->resolutions_by_resolvent()->end() ==
- _imp->resolved->resolutions_by_resolvent()->find(non_binary_resolvent))
+ ResolutionsByResolvent::ConstIterator non_binary_resolution(_imp->resolved->resolutions_by_resolvent()->find(non_binary_resolvent));
+ if (_imp->resolved->resolutions_by_resolvent()->end() == non_binary_resolution)
+ continue;
+
+ ChangesToMakeDecision * non_binary_changes_decision(simple_visitor_cast<ChangesToMakeDecision>(*(*non_binary_resolution)->decision()));
+ if (! non_binary_changes_decision)
continue;
+ non_binary_changes_decision->set_via_new_binary_in(changes_decision->destination()->repository());
+
NAGIndex from(make_named_values<NAGIndex>(
n::resolvent() = non_binary_resolvent,
n::role() = nir_done
@@ -735,6 +745,16 @@ Orderer::_check_self_deps_and_schedule(
namespace
{
+ PackageDepSpec make_origin_spec(const ChangesToMakeDecision & changes_to_make_decision)
+ {
+ PartiallyMadePackageDepSpec result(changes_to_make_decision.origin_id()->uniquely_identifying_spec());
+
+ if (changes_to_make_decision.if_via_new_binary_in())
+ result.in_repository(*changes_to_make_decision.if_via_new_binary_in());
+
+ return result;
+ }
+
struct ExtraScheduler
{
const std::tr1::shared_ptr<const Resolved> resolved;
@@ -791,7 +811,7 @@ namespace
JobNumber install_job_n(resolved->job_lists()->execute_job_list()->append(make_shared_ptr(new InstallJob(
requirements,
- changes_to_make_decision.origin_id()->uniquely_identifying_spec(),
+ make_origin_spec(changes_to_make_decision),
changes_to_make_decision.destination()->repository(),
changes_to_make_decision.resolvent().destination_type(),
replacing
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index ce51099..c97b6d8 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -400,7 +400,10 @@ namespace
cout << " The decision made was:" << endl;
else
cout << " The decision made was not to:" << endl;
- cout << " Use origin ID " << *d.origin_id() << endl;
+ cout << " Use origin ID " << *d.origin_id();
+ if (d.if_via_new_binary_in())
+ cout << " via binary created in " << *d.if_via_new_binary_in();
+ cout << endl;
cout << " Install to repository " << d.destination()->repository() << endl;
for (PackageIDSequence::ConstIterator i(d.destination()->replacing()->begin()), i_end(d.destination()->replacing()->end()) ;
i != i_end ; ++i)
@@ -831,6 +834,10 @@ namespace
cout << c::normal() << " " << decision.origin_id()->canonical_form(idcf_version) <<
" to " << decision.destination()->repository();
+ if (decision.if_via_new_binary_in())
+ cout << c::normal() << " via binary created in " << c::bold_normal()
+ << *decision.if_via_new_binary_in() << c::normal();
+
if (! decision.destination()->replacing()->empty())
{
cout << " replacing ";