aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-19 18:01:02 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-19 18:01:02 +0000
commit8ebef6bfd4c1be0e21efc5ed51babb48a89556bd (patch)
treefadb1fbb06596f84fd729a111702f2df07152a73
parent99d62760803ecf23cc3fc6d012c2b8a95f75bcc5 (diff)
downloadpaludis-8ebef6bfd4c1be0e21efc5ed51babb48a89556bd.tar.gz
paludis-8ebef6bfd4c1be0e21efc5ed51babb48a89556bd.tar.xz
Multiple destinations per dep list entry
-rw-r--r--paludis/dep_list/dep_list.cc24
-rw-r--r--paludis/dep_list/dep_list.sr2
-rw-r--r--paludis/environment.hh8
-rw-r--r--paludis/repositories/cran/cran_repository.cc55
-rw-r--r--paludis/repositories/gentoo/ebin_entries.cc78
-rw-r--r--paludis/repositories/gentoo/ebuild_entries.cc79
-rw-r--r--paludis/repositories/gentoo/portage_repository.cc6
-rw-r--r--paludis/repository.hh9
-rw-r--r--paludis/repository.sr2
-rw-r--r--paludis/tasks/install_task.cc36
-rw-r--r--ruby/dep_list.cc9
-rw-r--r--ruby/dep_list_TEST.rb2
-rw-r--r--src/output/console_install_task.cc95
13 files changed, 249 insertions, 156 deletions
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index 1bc091d..5cad3d4 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -1103,6 +1103,12 @@ 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);
+ if (! metadata->virtual_interface)
+ our_merge_entry_destinations->insert(find_destination(p, destinations));
+
MergeList::iterator our_merge_entry_position(
_imp->merge_list.insert(_imp->merge_list_insert_position,
DepListEntry::create()
@@ -1111,8 +1117,7 @@ DepList::add_package(const PackageDatabaseEntry & p, std::tr1::shared_ptr<const
.generation(_imp->merge_list_generation)
.state(dle_no_deps)
.tags(std::tr1::shared_ptr<DepListEntryTags>(new DepListEntryTags::Concrete))
- .destination(metadata->virtual_interface ?
- std::tr1::shared_ptr<Repository>() : find_destination(p, destinations))
+ .destinations(our_merge_entry_destinations)
.associated_entry(0)
.kind(metadata->virtual_interface ? dlk_virtual : dlk_package))),
our_merge_entry_post_position(our_merge_entry_position);
@@ -1170,7 +1175,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))
- .destination(std::tr1::shared_ptr<Repository>())
+ .destinations(std::tr1::shared_ptr<DestinationsCollection>(
+ new DestinationsCollection::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));
@@ -1241,7 +1247,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))
- .destination(std::tr1::shared_ptr<Repository>())
+ .destinations(std::tr1::shared_ptr<DestinationsCollection>(
+ new DestinationsCollection::Concrete))
.associated_entry(&*_imp->current_merge_list_entry)
.kind(kind)));
@@ -1268,6 +1275,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));
+
MergeList::iterator our_merge_entry_position(
_imp->merge_list.insert(_imp->merge_list_insert_position,
DepListEntry::create()
@@ -1277,7 +1288,7 @@ DepList::add_suggested_package(const PackageDatabaseEntry & p,
.generation(_imp->merge_list_generation)
.state(dle_has_all_deps)
.tags(std::tr1::shared_ptr<DepListEntryTags>(new DepListEntryTags::Concrete))
- .destination(find_destination(p, destinations))
+ .destinations(our_merge_entry_destinations)
.associated_entry(&*_imp->current_merge_list_entry)
.kind(dlk_suggested)));
@@ -1360,7 +1371,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)
- .destination(std::tr1::shared_ptr<Repository>())
+ .destinations(std::tr1::shared_ptr<DestinationsCollection>(
+ new DestinationsCollection::Concrete))
.associated_entry(0)
.kind(dlk_already_installed)));
_imp->merge_list_index.insert(std::make_pair(p.name, our_merge_entry));
diff --git a/paludis/dep_list/dep_list.sr b/paludis/dep_list/dep_list.sr
index c275cd1..82b581f 100644
--- a/paludis/dep_list/dep_list.sr
+++ b/paludis/dep_list/dep_list.sr
@@ -53,7 +53,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 destination "std::tr1::shared_ptr<Repository>"
+ key destinations "std::tr1::shared_ptr<const DestinationsCollection>"
key generation long
key state DepListEntryState
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 2e5f3e5..ab019ec 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -45,14 +45,6 @@ namespace paludis
const std::pair<const std::string, std::string> > EnvironmentMirrorIterator;
/**
- * A set of destinations.
- *
- * \ingroup grpdepresolver
- * \ingroup grpenvironment
- */
- typedef SortedCollection<std::tr1::shared_ptr<Repository> > DestinationsCollection;
-
- /**
* Represents the data for an Environment hook call.
*
* \ingroup grpenvironment
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index 8601e41..fda39af 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -468,6 +468,21 @@ CRANRepositoryConfigurationError::CRANRepositoryConfigurationError(
{
}
+namespace
+{
+ FSEntry
+ get_root(std::tr1::shared_ptr<const DestinationsCollection> destinations)
+ {
+ if (destinations)
+ for (DestinationsCollection::Iterator d(destinations->begin()), d_end(destinations->end()) ;
+ d != d_end ; ++d)
+ if ((*d)->installed_interface)
+ return (*d)->installed_interface->root();
+
+ return FSEntry("/");
+ }
+}
+
void
CRANRepository::do_install(const QualifiedPackageName &q, const VersionSpec &vn,
const InstallOptions &o) const
@@ -517,8 +532,7 @@ CRANRepository::do_install(const QualifiedPackageName &q, const VersionSpec &vn,
.with_setenv("PALUDIS_EBUILD_DIR", std::string(LIBEXECDIR "/paludis/"))
.with_setenv("PALUDIS_EBUILD_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
.with_setenv("PALUDIS_BASHRC_FILES", _imp->env->bashrc_files())
- .with_setenv("ROOT", o.destination->installed_interface ?
- stringify(o.destination->installed_interface->root()) : "/")
+ .with_setenv("ROOT", stringify(get_root(o.destinations)))
.with_setenv("WORKDIR", workdir);
@@ -526,7 +540,36 @@ CRANRepository::do_install(const QualifiedPackageName &q, const VersionSpec &vn,
throw PackageInstallActionError("Couldn't install '" + stringify(q) + "-" + stringify(vn) + "' to '" +
image + "'");
- cmd = Command(LIBEXECDIR "/paludis/cran.bash merge clean")
+ if (! o.destinations)
+ throw PackageInstallActionError("Can't merge '" + stringify(q) + "-" + stringify(vn) +
+ "' because no destinations were provided.");
+
+ for (DestinationsCollection::Iterator d(o.destinations->begin()),
+ d_end(o.destinations->end()) ; d != d_end ; ++d)
+ {
+ if (! (*d)->destination_interface)
+ throw PackageInstallActionError("Couldn't install '" + stringify(q) + "-" + stringify(vn) + "' to '" +
+ stringify((*d)->name()) + "' because it does not provide destination_interface");
+
+ cmd = Command(LIBEXECDIR "/paludis/cran.bash merge")
+ .with_setenv("IMAGE", image)
+ .with_setenv("PN", p)
+ .with_setenv("PV", stringify(vn))
+ .with_setenv("PALUDIS_CRAN_LIBRARY", stringify(_imp->library))
+ .with_setenv("PALUDIS_EBUILD_DIR", std::string(LIBEXECDIR "/paludis/"))
+ .with_setenv("PALUDIS_EBUILD_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
+ .with_setenv("PALUDIS_BASHRC_FILES", _imp->env->bashrc_files())
+ .with_setenv("ROOT", (*d)->installed_interface ?
+ stringify((*d)->installed_interface->root()) : "/")
+ .with_setenv("WORKDIR", workdir)
+ .with_setenv("REPOSITORY", stringify(name()));
+
+ if (0 != run_command(cmd))
+ throw PackageInstallActionError("Couldn't merge '" + stringify(q) + "-" + stringify(vn) + "' to '" +
+ stringify((*d)->name()) + "'");
+ }
+
+ cmd = Command(LIBEXECDIR "/paludis/cran.bash clean")
.with_setenv("IMAGE", image)
.with_setenv("PN", p)
.with_setenv("PV", stringify(vn))
@@ -534,14 +577,12 @@ CRANRepository::do_install(const QualifiedPackageName &q, const VersionSpec &vn,
.with_setenv("PALUDIS_EBUILD_DIR", std::string(LIBEXECDIR "/paludis/"))
.with_setenv("PALUDIS_EBUILD_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
.with_setenv("PALUDIS_BASHRC_FILES", _imp->env->bashrc_files())
- .with_setenv("ROOT", o.destination->installed_interface ?
- stringify(o.destination->installed_interface->root()) : "/")
+ .with_setenv("ROOT", stringify(get_root(o.destinations)))
.with_setenv("WORKDIR", workdir)
.with_setenv("REPOSITORY", stringify(name()));
if (0 != run_command(cmd))
- throw PackageInstallActionError("Couldn't merge '" + stringify(q) + "-" + stringify(vn) + "' to '" +
- stringify(o.destination->name()) + "'");
+ throw PackageInstallActionError("Couldn't clean '" + stringify(q) + "-" + stringify(vn) + "'");
return;
}
diff --git a/paludis/repositories/gentoo/ebin_entries.cc b/paludis/repositories/gentoo/ebin_entries.cc
index 9ad59c4..e388cb8 100644
--- a/paludis/repositories/gentoo/ebin_entries.cc
+++ b/paludis/repositories/gentoo/ebin_entries.cc
@@ -97,6 +97,21 @@ EbinEntries::generate_version_metadata(const QualifiedPackageName & q,
return result;
}
+namespace
+{
+ FSEntry
+ get_root(std::tr1::shared_ptr<const DestinationsCollection> destinations)
+ {
+ if (destinations)
+ for (DestinationsCollection::Iterator d(destinations->begin()), d_end(destinations->end()) ;
+ d != d_end ; ++d)
+ if ((*d)->installed_interface)
+ return (*d)->installed_interface->root();
+
+ return FSEntry("/");
+ }
+}
+
void
EbinEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
const InstallOptions & o, std::tr1::shared_ptr<const PortageRepositoryProfile>) const
@@ -208,8 +223,7 @@ EbinEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
EbinFetchCommandParams::create()
.b(binaries)
.flat_bin_uri(flat_bin_uri)
- .root(o.destination && o.destination->installed_interface ?
- stringify(o.destination->installed_interface->root()) : "/")
+ .root(stringify(get_root(o.destinations)))
.safe_resume(o.safe_resume));
fetch_cmd();
@@ -217,20 +231,14 @@ EbinEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
if (o.fetch_only)
return;
- if (! o.destination)
+ if (! o.destinations)
throw PackageInstallActionError("Can't install '" + stringify(q) + "-"
+ stringify(v) + "' because no destination was provided");
- if (! o.destination->destination_interface)
- throw PackageInstallActionError("Can't install '" + stringify(q) + "-"
- + stringify(v) + "' to destination '" + stringify(o.destination->name())
- + "' because destination does not provide destination_interface");
-
EbinInstallCommandParams install_params(
EbinInstallCommandParams::create()
.b(binaries)
- .root(o.destination && o.destination->installed_interface ?
- stringify(o.destination->installed_interface->root()) : "/")
+ .root(stringify(get_root(o.destinations)))
.debug_build(o.debug_build)
.phase(ebin_ip_unpack)
.disable_cfgpro(o.no_config_protect)
@@ -243,27 +251,41 @@ EbinEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
EbinInstallCommand build_cmd(command_params, install_params);
build_cmd();
- if (o.destination->destination_interface->want_pre_post_phases())
+
+ for (DestinationsCollection::Iterator d(o.destinations->begin()),
+ d_end(o.destinations->end()) ; d != d_end ; ++d)
{
- install_params.phase = ebin_ip_preinstall;
- EbinInstallCommand preinst_cmd(command_params, install_params);
- preinst_cmd();
- }
+ if (! (*d)->destination_interface)
+ throw PackageInstallActionError("Can't install '" + stringify(q) + "-"
+ + stringify(v) + "' to destination '" + stringify((*d)->name())
+ + "' because destination does not provide destination_interface");
+
+ if ((*d)->destination_interface->want_pre_post_phases())
+ {
+ install_params.phase = ebin_ip_preinstall;
+ install_params.root = (*d)->installed_interface ?
+ stringify((*d)->installed_interface->root()) : "/";
+ EbinInstallCommand preinst_cmd(command_params, install_params);
+ preinst_cmd();
+ }
- o.destination->destination_interface->merge(
- MergeOptions::create()
- .package(PackageDatabaseEntry(q, v, _imp->portage_repository->name()))
- .image_dir(command_params.buildroot / stringify(q.category) / (stringify(q.package) + "-"
- + stringify(v)) / "image")
- .environment_file(command_params.buildroot / stringify(q.category) / (stringify(q.package) + "-"
- + stringify(v)) / "temp" / "loadsaveenv")
- );
+ (*d)->destination_interface->merge(
+ MergeOptions::create()
+ .package(PackageDatabaseEntry(q, v, _imp->portage_repository->name()))
+ .image_dir(command_params.buildroot / stringify(q.category) / (stringify(q.package) + "-"
+ + stringify(v)) / "image")
+ .environment_file(command_params.buildroot / stringify(q.category) / (stringify(q.package) + "-"
+ + stringify(v)) / "temp" / "loadsaveenv")
+ );
- if (o.destination->destination_interface->want_pre_post_phases())
- {
- install_params.phase = ebin_ip_postinstall;
- EbinInstallCommand postinst_cmd(command_params, install_params);
- postinst_cmd();
+ if ((*d)->destination_interface->want_pre_post_phases())
+ {
+ install_params.phase = ebin_ip_postinstall;
+ install_params.root = (*d)->installed_interface ?
+ stringify((*d)->installed_interface->root()) : "/";
+ EbinInstallCommand postinst_cmd(command_params, install_params);
+ postinst_cmd();
+ }
}
install_params.phase = ebin_ip_tidyup;
diff --git a/paludis/repositories/gentoo/ebuild_entries.cc b/paludis/repositories/gentoo/ebuild_entries.cc
index 7ec8f78..d83e1c1 100644
--- a/paludis/repositories/gentoo/ebuild_entries.cc
+++ b/paludis/repositories/gentoo/ebuild_entries.cc
@@ -225,6 +225,21 @@ namespace
}
+namespace
+{
+ FSEntry
+ get_root(std::tr1::shared_ptr<const DestinationsCollection> destinations)
+ {
+ if (destinations)
+ for (DestinationsCollection::Iterator d(destinations->begin()), d_end(destinations->end()) ;
+ d != d_end ; ++d)
+ if ((*d)->installed_interface)
+ return (*d)->installed_interface->root();
+
+ return FSEntry("/");
+ }
+}
+
void
EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
const InstallOptions & o, std::tr1::shared_ptr<const PortageRepositoryProfile> p) const
@@ -455,8 +470,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
.use_expand(join(p->begin_use_expand(), p->end_use_expand(), " "))
.expand_vars(expand_vars)
.flat_src_uri(flat_src_uri)
- .root(o.destination && o.destination->installed_interface ?
- stringify(o.destination->installed_interface->root()) : "/")
+ .root(stringify(get_root(o.destinations)))
.profiles(_imp->params.profiles)
.no_fetch(fetch_restrict)
.safe_resume(o.safe_resume));
@@ -466,14 +480,9 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
if (o.fetch_only)
return;
- if (! o.destination)
- throw PackageInstallActionError("Can't install '" + stringify(q) + "-"
- + stringify(v) + "' because no destination was provided");
-
- if (! o.destination->destination_interface)
+ if (! o.destinations)
throw PackageInstallActionError("Can't install '" + stringify(q) + "-"
- + stringify(v) + "' to destination '" + stringify(o.destination->name())
- + "' because destination does not provide destination_interface");
+ + stringify(v) + "' because no destinations were provided");
EbuildInstallCommandParams install_params(
EbuildInstallCommandParams::create()
@@ -483,8 +492,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
.aa(all_archives)
.use_expand(join(p->begin_use_expand(), p->end_use_expand(), " "))
.expand_vars(expand_vars)
- .root(o.destination && o.destination->installed_interface ?
- stringify(o.destination->installed_interface->root()) : "/")
+ .root(stringify(get_root(o.destinations)))
.profiles(_imp->params.profiles)
.disable_cfgpro(o.no_config_protect)
.debug_build(o.debug_build)
@@ -497,30 +505,43 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
EbuildInstallCommand build_cmd(command_params, install_params);
build_cmd();
- if (o.destination->destination_interface->want_pre_post_phases())
+ for (DestinationsCollection::Iterator d(o.destinations->begin()),
+ d_end(o.destinations->end()) ; d != d_end ; ++d)
{
- install_params.phase = ebuild_ip_preinstall;
- EbuildInstallCommand preinst_cmd(command_params, install_params);
- preinst_cmd();
- }
+ if (! (*d)->destination_interface)
+ throw PackageInstallActionError("Can't install '" + stringify(q) + "-"
+ + stringify(v) + "' to destination '" + stringify((*d)->name())
+ + "' because destination does not provide destination_interface");
- o.destination->destination_interface->merge(
- MergeOptions::create()
- .package(PackageDatabaseEntry(q, v, _imp->portage_repository->name()))
- .image_dir(command_params.buildroot / stringify(q.category) / (stringify(q.package) + "-"
- + stringify(v)) / "image")
- .environment_file(command_params.buildroot / stringify(q.category) / (stringify(q.package) + "-"
- + stringify(v)) / "temp" / "loadsaveenv")
- );
+ install_params.root = (*d)->installed_interface ?
+ stringify((*d)->installed_interface->root()) : "/";
- if (o.destination->destination_interface->want_pre_post_phases())
- {
- install_params.phase = ebuild_ip_postinstall;
- EbuildInstallCommand postinst_cmd(command_params, install_params);
- postinst_cmd();
+ if ((*d)->destination_interface->want_pre_post_phases())
+ {
+ install_params.phase = ebuild_ip_preinstall;
+ EbuildInstallCommand preinst_cmd(command_params, install_params);
+ preinst_cmd();
+ }
+
+ (*d)->destination_interface->merge(
+ MergeOptions::create()
+ .package(PackageDatabaseEntry(q, v, _imp->portage_repository->name()))
+ .image_dir(command_params.buildroot / stringify(q.category) / (stringify(q.package) + "-"
+ + stringify(v)) / "image")
+ .environment_file(command_params.buildroot / stringify(q.category) / (stringify(q.package) + "-"
+ + stringify(v)) / "temp" / "loadsaveenv")
+ );
+
+ if ((*d)->destination_interface->want_pre_post_phases())
+ {
+ install_params.phase = ebuild_ip_postinstall;
+ EbuildInstallCommand postinst_cmd(command_params, install_params);
+ postinst_cmd();
+ }
}
install_params.phase = ebuild_ip_tidyup;
+ install_params.root = stringify(get_root(o.destinations));
EbuildInstallCommand tidyup_cmd(command_params, install_params);
tidyup_cmd();
}
diff --git a/paludis/repositories/gentoo/portage_repository.cc b/paludis/repositories/gentoo/portage_repository.cc
index 824f6df..edbe7d4 100644
--- a/paludis/repositories/gentoo/portage_repository.cc
+++ b/paludis/repositories/gentoo/portage_repository.cc
@@ -813,12 +813,6 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
const InstallOptions & o) const
{
_imp->need_profiles();
-
- if (o.destination->installed_interface && ! o.destination->installed_interface->root().is_directory())
- throw PackageInstallActionError("Can't install '" + stringify(q) + "-"
- + stringify(v) + "' since root ('" + stringify(
- o.destination->installed_interface->root()) + "') isn't a directory");
-
_imp->entries_ptr->install(q, v, o, _imp->profile_ptr);
}
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 45941d1..5b3a8c3 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -68,6 +68,15 @@ namespace paludis
class RepositoryLicensesInterface;
/**
+ * A set of destinations.
+ *
+ * \ingroup grpdepresolver
+ * \ingroup grpenvironment
+ * \ingroup grprepository
+ */
+ typedef SortedCollection<std::tr1::shared_ptr<Repository> > DestinationsCollection;
+
+ /**
* What debug build option to use when installing a package.
*
* \ingroup grprepository
diff --git a/paludis/repository.sr b/paludis/repository.sr
index 7878ad0..53b9989 100644
--- a/paludis/repository.sr
+++ b/paludis/repository.sr
@@ -7,7 +7,7 @@ make_class_InstallOptions()
key fetch_only bool
key debug_build InstallDebugOption
key safe_resume bool
- key destination "std::tr1::shared_ptr<Repository>"
+ key destinations "std::tr1::shared_ptr<const DestinationsCollection>"
doxygen_comment << "END"
/**
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 785418e..6458480 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -54,7 +54,7 @@ namespace paludis
env(e),
dep_list(e, o),
current_dep_list_entry(dep_list.begin()),
- install_options(false, false, ido_none, false, std::tr1::shared_ptr<Repository>()),
+ install_options(false, false, ido_none, false, std::tr1::shared_ptr<const DestinationsCollection>()),
uninstall_options(false),
targets(new AllDepAtom),
destinations(d),
@@ -227,10 +227,11 @@ InstallTask::execute()
bool any_live_destination(false);
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)
- if (dep->destination && dep->destination->destination_interface &&
- dep->destination->destination_interface->want_pre_post_phases())
- any_live_destination = true;
+ if (dlk_package == dep->kind && dep->destinations)
+ for (DestinationsCollection::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())
+ any_live_destination = true;
_imp->env->perform_hook(Hook("install_all_pre")
("TARGETS", join(_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))
@@ -252,9 +253,11 @@ InstallTask::execute()
continue;
bool live_destination(false);
- if (dep->destination && dep->destination->destination_interface &&
- dep->destination->destination_interface->want_pre_post_phases())
- live_destination = true;
+ if (dep->destinations)
+ for (DestinationsCollection::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())
+ live_destination = true;
++x;
_imp->current_dep_list_entry = dep;
@@ -289,7 +292,7 @@ InstallTask::execute()
try
{
- _imp->install_options.destination = dep->destination;
+ _imp->install_options.destinations = dep->destinations;
installable_interface->install(dep->package.name, dep->package.version, _imp->install_options);
}
catch (const PackageInstallActionError & e)
@@ -328,14 +331,17 @@ InstallTask::execute()
if ((*r)->installed_interface)
((*r).get())->invalidate();
- // look for packages with the same name in the same slot in the destination repo
+ // look for packages with the same name in the same slot in the destination repos
std::tr1::shared_ptr<PackageDatabaseEntryCollection> collision_list;
- if (dep->destination && dep->destination->uninstallable_interface)
- collision_list = _imp->env->package_database()->query(
- PackageDepAtom(stringify(dep->package.name) + ":" + stringify(dep->metadata->slot)
- + "::" + stringify(dep->destination->name())),
- is_installed_only, qo_order_by_version);
+ if (dep->destinations)
+ for (DestinationsCollection::Iterator d(dep->destinations->begin()),
+ d_end(dep->destinations->end()) ; d != d_end ; ++d)
+ if ((*d)->uninstallable_interface)
+ collision_list = _imp->env->package_database()->query(
+ PackageDepAtom(stringify(dep->package.name) + ":" + stringify(dep->metadata->slot)
+ + "::" + stringify((*d)->name())),
+ is_installed_only, qo_order_by_version);
// don't clean the thing we just installed
PackageDatabaseEntryCollection::Concrete clean_list;
diff --git a/ruby/dep_list.cc b/ruby/dep_list.cc
index 5b1e125..61edc45 100644
--- a/ruby/dep_list.cc
+++ b/ruby/dep_list.cc
@@ -1036,14 +1036,6 @@ namespace
}
VALUE
- dep_list_entry_destination(VALUE self)
- {
- DepListEntry * p;
- Data_Get_Struct(self, DepListEntry, p);
- return(repository_to_value(p->destination));
- }
-
- VALUE
dep_list_override_masks_init(VALUE self)
{
return self;
@@ -1492,7 +1484,6 @@ 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);
- rb_define_method(c_dep_list_entry, "destination", RUBY_FUNC_CAST(&dep_list_entry_destination), 0);
/*
* Document-class: DepListOverrideMasks
diff --git a/ruby/dep_list_TEST.rb b/ruby/dep_list_TEST.rb
index ad90240..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, :destination => Repository
+ :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 0f1e9de..669e2ad 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -206,8 +206,8 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
} while (false);
std::string repo;
- if (d.destination)
- repo = "::" + stringify(d.destination->name());
+ if (d.destinations && ! d.destinations->empty())
+ repo = "::" + stringify((*d.destinations->begin())->name());
std::tr1::shared_ptr<PackageDatabaseEntryCollection> existing_repo(environment()->package_database()->
query(query::Matches(PackageDepAtom(stringify(d.package.name) + repo)), qo_order_by_version));
@@ -351,11 +351,6 @@ ConsoleInstallTask::display_clean_all_pre_list_end(const DepListEntry &,
void
ConsoleInstallTask::display_merge_list_post_counts()
{
- if (count<max_count>() != count<new_count>() + count<upgrade_count>()
- + count<downgrade_count>() + count<new_slot_count>() + count<rebuild_count>())
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Max count doesn't add up. This is a bug!");
-
std::ostringstream s;
s << "Total: " << count<max_count>() << render_plural(count<max_count>(), " package",
" packages");
@@ -775,14 +770,7 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> existing_slot_repo,
const DisplayMode m)
{
- std::string destination_str;
- if (d.destination)
- {
- std::tr1::shared_ptr<const DestinationsCollection> default_destinations(environment()->default_destinations());
- if (default_destinations->end() == default_destinations->find(d.destination))
- destination_str = " ::" + stringify(d.destination->name());
- }
-
+ bool need_comma(false);
switch (m)
{
case unimportant_entry:
@@ -798,38 +786,55 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
break;
case normal_entry:
- if (existing_repo->empty())
- {
- output_no_endl(render_as_update_mode(" [N" + destination_str + "]"));
- set_count<new_count>(count<new_count>() + 1);
- set_count<max_count>(count<max_count>() + 1);
- }
- else if (existing_slot_repo->empty())
- {
- output_no_endl(render_as_update_mode(" [S" + destination_str + "]"));
- set_count<new_slot_count>(count<new_slot_count>() + 1);
- set_count<max_count>(count<max_count>() + 1);
- }
- else if (existing_slot_repo->last()->version < d.package.version)
- {
- output_no_endl(render_as_update_mode(" [U " +
- stringify(existing_slot_repo->last()->version) + "" + destination_str + "]"));
- set_count<upgrade_count>(count<upgrade_count>() + 1);
- set_count<max_count>(count<max_count>() + 1);
- }
- else if (existing_slot_repo->last()->version > d.package.version)
- {
- output_no_endl(render_as_update_mode(" [D " +
- stringify(existing_slot_repo->last()->version) + "" + destination_str + "]"));
- set_count<downgrade_count>(count<downgrade_count>() + 1);
- set_count<max_count>(count<max_count>() + 1);
- }
- else
+ output_no_endl(render_as_update_mode(" ["));
+
+ for (DestinationsCollection::Iterator dest(d.destinations->begin()), dest_end(d.destinations->end()) ;
+ dest != dest_end ; ++dest)
{
- output_no_endl(render_as_update_mode(" [R" + destination_str + "]"));
- set_count<rebuild_count>(count<rebuild_count>() + 1);
- set_count<max_count>(count<max_count>() + 1);
+ 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 (existing_repo->empty())
+ {
+ output_no_endl(render_as_update_mode("N" + destination_str));
+ set_count<new_count>(count<new_count>() + 1);
+ set_count<max_count>(count<max_count>() + 1);
+ }
+ else if (existing_slot_repo->empty())
+ {
+ output_no_endl(render_as_update_mode("S" + destination_str));
+ set_count<new_slot_count>(count<new_slot_count>() + 1);
+ set_count<max_count>(count<max_count>() + 1);
+ }
+ else if (existing_slot_repo->last()->version < d.package.version)
+ {
+ output_no_endl(render_as_update_mode("U " +
+ stringify(existing_slot_repo->last()->version) + "" + destination_str));
+ set_count<upgrade_count>(count<upgrade_count>() + 1);
+ set_count<max_count>(count<max_count>() + 1);
+ }
+ else if (existing_slot_repo->last()->version > d.package.version)
+ {
+ output_no_endl(render_as_update_mode("D " +
+ stringify(existing_slot_repo->last()->version) + "" + destination_str));
+ set_count<downgrade_count>(count<downgrade_count>() + 1);
+ set_count<max_count>(count<max_count>() + 1);
+ }
+ else
+ {
+ output_no_endl(render_as_update_mode("R" + destination_str));
+ set_count<rebuild_count>(count<rebuild_count>() + 1);
+ set_count<max_count>(count<max_count>() + 1);
+ }
+
+ need_comma = true;
}
+ output_no_endl(render_as_update_mode("]"));
break;
case error_entry: