aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-18 15:34:02 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-18 15:34:02 +0100
commitf62e137848dd2c829a1d5f874ae5d4f2197e7ac6 (patch)
tree95123c53656fb9028c8c42070e7e853941782768
parentd6d26953211434db2042652e227136214d81b224 (diff)
downloadpaludis-f62e137848dd2c829a1d5f874ae5d4f2197e7ac6.tar.gz
paludis-f62e137848dd2c829a1d5f874ae5d4f2197e7ac6.tar.xz
Support multiple master repositories.
No way of actually configuring them yet, mind...
-rw-r--r--paludis/repositories/e/e_repository.cc98
-rw-r--r--paludis/repositories/e/e_repository_params.cc6
-rw-r--r--paludis/repositories/e/e_repository_params.hh4
-rw-r--r--paludis/repositories/e/e_repository_params.sr2
-rw-r--r--paludis/repositories/e/e_repository_profile.cc2
-rw-r--r--paludis/repositories/e/ebuild_entries.cc27
-rw-r--r--paludis/repositories/e/ebuild_id.cc5
-rw-r--r--paludis/repositories/e/exheres_layout.cc96
-rw-r--r--paludis/repositories/e/exheres_layout.hh4
-rw-r--r--paludis/repositories/e/layout.cc14
-rw-r--r--paludis/repositories/e/layout.hh8
-rw-r--r--paludis/repositories/e/qa/categories.cc4
-rw-r--r--paludis/repositories/e/qa/visibility.cc35
-rw-r--r--paludis/repositories/e/traditional_layout.cc88
-rw-r--r--paludis/repositories/e/traditional_layout.hh4
15 files changed, 259 insertions, 138 deletions
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 9faf41b..ceebd1c 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -112,6 +112,41 @@ typedef std::tr1::unordered_multimap<std::string, std::string, Hash<std::string>
typedef std::tr1::unordered_map<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepSpec>, Hash<QualifiedPackageName> > VirtualsMap;
typedef std::list<RepositoryEInterface::ProfilesDescLine> ProfilesDesc;
+namespace
+{
+ std::tr1::shared_ptr<FSEntrySequence> get_master_locations(
+ const std::tr1::shared_ptr<const ERepositorySequence> & r)
+ {
+ std::tr1::shared_ptr<FSEntrySequence> result;
+
+ if (r)
+ {
+ result.reset(new FSEntrySequence);
+ for (ERepositorySequence::ConstIterator e(r->begin()), e_end(r->end()) ;
+ e != e_end ; ++e)
+ result->push_back((*e)->params().location);
+ }
+
+ return result;
+ }
+
+ std::tr1::shared_ptr<Sequence<std::string> > get_master_names(
+ const std::tr1::shared_ptr<const ERepositorySequence> & r)
+ {
+ std::tr1::shared_ptr<Sequence<std::string> > result;
+
+ if (r)
+ {
+ result.reset(new Sequence<std::string>);
+ for (ERepositorySequence::ConstIterator e(r->begin()), e_end(r->end()) ;
+ e != e_end ; ++e)
+ result->push_back(stringify((*e)->name()));
+ }
+
+ return result;
+ }
+}
+
namespace paludis
{
/**
@@ -186,7 +221,7 @@ namespace paludis
std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_key;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_options_key;
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > builddir_key;
- std::tr1::shared_ptr<const MetadataValueKey<std::string> > master_repository_key;
+ std::tr1::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > master_repositories_key;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > eapi_when_unknown_key;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > eapi_when_unspecified_key;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > profile_eapi_key;
@@ -209,9 +244,8 @@ namespace paludis
has_profiles_desc(false),
sets_ptr(new ERepositorySets(params.environment, r, p)),
entries_ptr(erepository::ERepositoryEntriesFactory::get_instance()->create(params.entry_format, params.environment, r, p)),
- layout(erepository::LayoutFactory::get_instance()->create(params.layout, r, params.location, entries_ptr, params.master_repository ?
- make_shared_ptr(new FSEntry(params.master_repository->params().location)) :
- std::tr1::shared_ptr<FSEntry>())),
+ layout(erepository::LayoutFactory::get_instance()->create(params.layout, r, params.location, entries_ptr, get_master_locations(
+ params.master_repositories))),
format_key(new LiteralMetadataValueKey<std::string> ("format", "format",
mkt_significant, params.entry_format)),
layout_key(new LiteralMetadataValueKey<std::string> ("layout", "layout",
@@ -248,10 +282,10 @@ namespace paludis
"sync_options", "sync_options", mkt_normal, params.sync_options)),
builddir_key(new LiteralMetadataValueKey<FSEntry> (
"builddir", "builddir", mkt_normal, params.builddir)),
- master_repository_key(params.master_repository ?
- std::tr1::shared_ptr<MetadataValueKey<std::string> >(new LiteralMetadataValueKey<std::string> (
- "master_repository", "master_repository", mkt_normal, stringify(params.master_repository->name()))) :
- std::tr1::shared_ptr<MetadataValueKey<std::string> >()),
+ master_repositories_key(params.master_repositories ?
+ std::tr1::shared_ptr<MetadataCollectionKey<Sequence<std::string> > >(new LiteralMetadataStringSequenceKey(
+ "master_repository", "master_repository", mkt_normal, get_master_names(params.master_repositories))) :
+ std::tr1::shared_ptr<MetadataCollectionKey<Sequence<std::string> > >()),
eapi_when_unknown_key(new LiteralMetadataValueKey<std::string> (
"eapi_when_unknown", "eapi_when_unknown", mkt_normal, params.eapi_when_unknown)),
eapi_when_unspecified_key(new LiteralMetadataValueKey<std::string> (
@@ -469,8 +503,8 @@ ERepository::_add_metadata_keys() const
add_metadata_key(_imp->eapi_when_unknown_key);
add_metadata_key(_imp->eapi_when_unspecified_key);
add_metadata_key(_imp->profile_eapi_key);
- if (_imp->master_repository_key)
- add_metadata_key(_imp->master_repository_key);
+ if (_imp->master_repositories_key)
+ add_metadata_key(_imp->master_repositories_key);
add_metadata_key(_imp->use_manifest_key);
if (_imp->info_pkgs_key)
add_metadata_key(_imp->info_pkgs_key);
@@ -1471,16 +1505,15 @@ ERepository::repository_factory_create(
&KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation)
: 0);
- std::tr1::shared_ptr<const RepositoryName> master_repository_name;
- std::tr1::shared_ptr<const ERepository> master_repository;
+ std::tr1::shared_ptr<ERepositorySequence> master_repositories;
if (! f("master_repository").empty())
{
Context context_local("When finding configuration information for master_repository '"
+ stringify(f("master_repository")) + "':");
- master_repository_name.reset(new RepositoryName(f("master_repository")));
- std::tr1::shared_ptr<const Repository> master_repository_uncasted(
- env->package_database()->fetch_repository(*master_repository_name));
+ RepositoryName master_repository_name(f("master_repository"));
+ std::tr1::shared_ptr<Repository> master_repository_uncasted(
+ env->package_database()->fetch_repository(master_repository_name));
std::string format("unknown");
if (master_repository_uncasted->format_key())
@@ -1490,20 +1523,22 @@ ERepository::repository_factory_create(
throw ERepositoryConfigurationError("Master repository format is '" +
stringify(format) + "', not 'ebuild'");
- master_repository = std::tr1::static_pointer_cast<const ERepository>(master_repository_uncasted);
- if (master_repository->params().master_repository)
- throw ERepositoryConfigurationError("Requested master repository has a master_repository of '" +
- stringify(master_repository->params().master_repository->name()) + "', so it cannot "
+ std::tr1::shared_ptr<ERepository> master_repository(std::tr1::static_pointer_cast<ERepository>(master_repository_uncasted));
+ if (master_repository->params().master_repositories && ! master_repository->params().master_repositories->empty())
+ throw ERepositoryConfigurationError("Requested master repository has master repositories itself, so it cannot "
"be used as a master repository");
+
+ master_repositories.reset(new ERepositorySequence);
+ master_repositories->push_back(master_repository);
}
std::tr1::shared_ptr<FSEntrySequence> profiles(new FSEntrySequence);
tokenise_whitespace(f("profiles"), create_inserter<FSEntry>(std::back_inserter(*profiles)));
if (profiles->empty())
{
- if (master_repository)
- std::copy(master_repository->params().profiles->begin(),
- master_repository->params().profiles->end(), profiles->back_inserter());
+ if (master_repositories)
+ std::copy((*master_repositories->begin())->params().profiles->begin(),
+ (*master_repositories->begin())->params().profiles->end(), profiles->back_inserter());
else
throw ERepositoryConfigurationError("No profiles have been specified");
}
@@ -1512,17 +1547,20 @@ ERepository::repository_factory_create(
tokenise_whitespace(f("eclassdirs"), create_inserter<FSEntry>(std::back_inserter(*eclassdirs)));
if (eclassdirs->empty())
{
- if (master_repository)
- std::copy(master_repository->params().eclassdirs->begin(),
- master_repository->params().eclassdirs->end(), eclassdirs->back_inserter());
+ if (master_repositories)
+ {
+ for (ERepositorySequence::ConstIterator e(master_repositories->begin()),
+ e_end(master_repositories->end()) ; e != e_end ; ++e)
+ std::copy((*e)->params().eclassdirs->begin(), (*e)->params().eclassdirs->end(), eclassdirs->back_inserter());
+ }
eclassdirs->push_back(location + "/eclass");
}
std::string distdir(f("distdir"));
if (distdir.empty())
{
- if (master_repository)
- distdir = stringify(master_repository->params().distdir);
+ if (master_repositories)
+ distdir = stringify((*master_repositories->begin())->params().distdir);
else
{
distdir = (*DistributionData::get_instance()->distribution_from_string(
@@ -1633,8 +1671,8 @@ ERepository::repository_factory_create(
builddir = f("buildroot");
if (builddir.empty())
{
- if (master_repository)
- builddir = stringify(master_repository->params().builddir);
+ if (master_repositories)
+ builddir = stringify((*master_repositories->begin())->params().builddir);
else
builddir = (*DistributionData::get_instance()->distribution_from_string(
env->distribution())).default_ebuild_builddir();
@@ -1695,7 +1733,7 @@ ERepository::repository_factory_create(
.newsdir(newsdir)
.sync(sync)
.sync_options(sync_options)
- .master_repository(master_repository)
+ .master_repositories(master_repositories)
.write_bin_uri_prefix("")
.eapi_when_unknown(eapi_when_unknown)
.eapi_when_unspecified(eapi_when_unspecified)
diff --git a/paludis/repositories/e/e_repository_params.cc b/paludis/repositories/e/e_repository_params.cc
index 8640fce..ec1dd47 100644
--- a/paludis/repositories/e/e_repository_params.cc
+++ b/paludis/repositories/e/e_repository_params.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 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
@@ -20,6 +20,8 @@
#include "e_repository_params.hh"
#include <paludis/util/stringify.hh>
#include <paludis/util/exception.hh>
+#include <paludis/util/sequence-impl.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <ostream>
#include <istream>
#include <string>
@@ -30,3 +32,5 @@ using namespace paludis::erepository;
#include <paludis/repositories/e/e_repository_params-se.cc>
#include <paludis/repositories/e/e_repository_params-sr.cc>
+template class Sequence<std::tr1::shared_ptr<const ERepository> >;
+template class WrappedForwardIterator<Sequence<std::tr1::shared_ptr<const ERepository> >::ConstIteratorTag, const std::tr1::shared_ptr<const ERepository> >;
diff --git a/paludis/repositories/e/e_repository_params.hh b/paludis/repositories/e/e_repository_params.hh
index 8ba4c91..982f0da 100644
--- a/paludis/repositories/e/e_repository_params.hh
+++ b/paludis/repositories/e/e_repository_params.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008 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
@@ -35,6 +35,8 @@ namespace paludis
class PackageDatabase;
class ERepository;
+ typedef Sequence<std::tr1::shared_ptr<const ERepository> > ERepositorySequence;
+
namespace erepository
{
#include <paludis/repositories/e/e_repository_params-se.hh>
diff --git a/paludis/repositories/e/e_repository_params.sr b/paludis/repositories/e/e_repository_params.sr
index e067349..77a1203 100644
--- a/paludis/repositories/e/e_repository_params.sr
+++ b/paludis/repositories/e/e_repository_params.sr
@@ -22,7 +22,7 @@ make_class_ERepositoryParams()
key sync std::string
key sync_options std::string
key builddir FSEntry
- key master_repository "std::tr1::shared_ptr<const ERepository>"
+ key master_repositories "std::tr1::shared_ptr<const ERepositorySequence>"
key write_bin_uri_prefix std::string
key eapi_when_unknown std::string
key eapi_when_unspecified std::string
diff --git a/paludis/repositories/e/e_repository_profile.cc b/paludis/repositories/e/e_repository_profile.cc
index f214a1b..4c0480a 100644
--- a/paludis/repositories/e/e_repository_profile.cc
+++ b/paludis/repositories/e/e_repository_profile.cc
@@ -459,7 +459,7 @@ Implementation<ERepositoryProfile>::make_vars_from_file_vars()
{
try
{
- if (! repository->params().master_repository)
+ if (! repository->params().master_repositories)
for (erepository::ProfileFile<LineConfigFile>::ConstIterator i(packages_file.begin()),
i_end(packages_file.end()) ; i != i_end ; ++i)
{
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 82616f4..9ed8c96 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -427,8 +427,11 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
if (id->fetches_key())
{
- std::string mirrors_name(_imp->e_repository->params().master_repository ?
- stringify(_imp->e_repository->params().master_repository->name()) :
+ /* always use mirror://gentoo/, where gentoo is the name of our first master repository,
+ * or our name if there's no master. */
+ std::string mirrors_name(
+ (_imp->e_repository->params().master_repositories && ! _imp->e_repository->params().master_repositories->empty()) ?
+ stringify((*_imp->e_repository->params().master_repositories->begin())->name()) :
stringify(_imp->e_repository->name()));
FetchVisitor f(_imp->params.environment, id, *id->eapi(),
_imp->e_repository->params().distdir, o.fetch_unneeded(), fetch_userpriv_ok, mirrors_name,
@@ -465,7 +468,9 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
value_for<n::exlibsdirs>(exlibsdirs),
value_for<n::files_dir>(_imp->e_repository->layout()->package_directory(id->name()) / "files"),
value_for<n::package_id>(id),
- value_for<n::portdir>(_imp->params.master_repository ? _imp->params.master_repository->params().location : _imp->params.location),
+ value_for<n::portdir>(
+ (_imp->params.master_repositories && ! _imp->params.master_repositories->empty()) ?
+ (*_imp->params.master_repositories->begin())->params().location : _imp->params.location),
value_for<n::sandbox>(phase->option("sandbox")),
value_for<n::userpriv>(phase->option("userpriv") && userpriv_ok)
));
@@ -694,7 +699,9 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
value_for<n::exlibsdirs>(exlibsdirs),
value_for<n::files_dir>(_imp->e_repository->layout()->package_directory(id->name()) / "files"),
value_for<n::package_id>(id),
- value_for<n::portdir>(_imp->params.master_repository ? _imp->params.master_repository->params().location : _imp->params.location),
+ value_for<n::portdir>(
+ (_imp->params.master_repositories && ! _imp->params.master_repositories->empty()) ?
+ (*_imp->params.master_repositories->begin())->params().location : _imp->params.location),
value_for<n::sandbox>(phase->option("sandbox")),
value_for<n::userpriv>(phase->option("userpriv") && userpriv_ok)
));
@@ -772,7 +779,9 @@ EbuildEntries::info(const std::tr1::shared_ptr<const ERepositoryID> & id,
value_for<n::exlibsdirs>(exlibsdirs),
value_for<n::files_dir>(_imp->e_repository->layout()->package_directory(id->name()) / "files"),
value_for<n::package_id>(id),
- value_for<n::portdir>(_imp->params.master_repository ? _imp->params.master_repository->params().location : _imp->params.location),
+ value_for<n::portdir>(
+ (_imp->params.master_repositories && ! _imp->params.master_repositories->empty()) ?
+ (*_imp->params.master_repositories->begin())->params().location : _imp->params.location),
value_for<n::sandbox>(phase->option("sandbox")),
value_for<n::userpriv>(phase->option("userpriv") && userpriv_ok)
));
@@ -836,7 +845,9 @@ EbuildEntries::get_environment_variable(const std::tr1::shared_ptr<const EReposi
value_for<n::exlibsdirs>(exlibsdirs),
value_for<n::files_dir>(_imp->e_repository->layout()->package_directory(id->name()) / "files"),
value_for<n::package_id>(id),
- value_for<n::portdir>(_imp->params.master_repository ? _imp->params.master_repository->params().location : _imp->params.location),
+ value_for<n::portdir>(
+ (_imp->params.master_repositories && ! _imp->params.master_repositories->empty()) ?
+ (*_imp->params.master_repositories->begin())->params().location : _imp->params.location),
value_for<n::sandbox>(phases.begin_phases()->option("sandbox")),
value_for<n::userpriv>(phases.begin_phases()->option("userpriv") && userpriv_ok)
),
@@ -964,7 +975,9 @@ EbuildEntries::pretend(const std::tr1::shared_ptr<const ERepositoryID> & id,
value_for<n::exlibsdirs>(exlibsdirs),
value_for<n::files_dir>(_imp->e_repository->layout()->package_directory(id->name()) / "files"),
value_for<n::package_id>(id),
- value_for<n::portdir>(_imp->params.master_repository ? _imp->params.master_repository->params().location : _imp->params.location),
+ value_for<n::portdir>(
+ (_imp->params.master_repositories && ! _imp->params.master_repositories->empty()) ?
+ (*_imp->params.master_repositories->begin())->params().location : _imp->params.location),
value_for<n::sandbox>(phase->option("sandbox")),
value_for<n::userpriv>(phase->option("userpriv") && userpriv_ok)
));
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 511e52e..0cbef27 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -232,8 +232,9 @@ EbuildID::need_keys_added() const
value_for<n::exlibsdirs>(_imp->repository->layout()->exlibsdirs(name())),
value_for<n::files_dir>(_imp->repository->layout()->package_directory(name()) / "files"),
value_for<n::package_id>(shared_from_this()),
- value_for<n::portdir>(_imp->repository->params().master_repository ?
- _imp->repository->params().master_repository->params().location : _imp->repository->params().location),
+ value_for<n::portdir>(
+ (_imp->repository->params().master_repositories && ! _imp->repository->params().master_repositories->empty()) ?
+ (*_imp->repository->params().master_repositories->begin())->params().location : _imp->repository->params().location),
value_for<n::sandbox>(phases.begin_phases()->option("sandbox")),
value_for<n::userpriv>(phases.begin_phases()->option("userpriv"))
));
diff --git a/paludis/repositories/e/exheres_layout.cc b/paludis/repositories/e/exheres_layout.cc
index d1bf01e..9cbe39b 100644
--- a/paludis/repositories/e/exheres_layout.cc
+++ b/paludis/repositories/e/exheres_layout.cc
@@ -98,32 +98,38 @@ namespace paludis
}
ExheresLayout::ExheresLayout(const ERepository * const r, const FSEntry & tree_root,
- std::tr1::shared_ptr<const ERepositoryEntries> e,
- std::tr1::shared_ptr<const FSEntry> f) :
+ const std::tr1::shared_ptr<const ERepositoryEntries> & e,
+ const std::tr1::shared_ptr<const FSEntrySequence> & f) :
Layout(f),
PrivateImplementationPattern<ExheresLayout>(new Implementation<ExheresLayout>(r, tree_root, e))
{
- if (master_repository_location())
+ if (master_repositories_locations())
{
- _imp->arch_list_files->push_back(*master_repository_location() / "metadata" / "arch.conf");
- _imp->repository_mask_files->push_back(*master_repository_location() / "metadata" / "repository_mask.conf");
- _imp->profiles_desc_files->push_back(*master_repository_location() / "metadata" / "profiles_desc.conf");
- _imp->mirror_files->push_back(*master_repository_location() / "metadata" / "mirrors.conf");
- _imp->info_variables_files->push_back(*master_repository_location() / "metadata" / "info" / "variables.conf");
-
- FSEntry descs(*master_repository_location() / "metadata" / "options" / "descriptions");
- if (descs.is_directory_or_symlink_to_directory())
+ for (FSEntrySequence::ConstIterator l(master_repositories_locations()->begin()), l_end(master_repositories_locations()->end()) ;
+ l != l_end ; ++l)
{
- for (DirIterator d(descs), d_end ; d != d_end ; ++d)
+ /* don't also follow our masters' masters. Otherwise things like masters = arbor x11 will
+ * get weird... */
+ _imp->arch_list_files->push_back(*l / "metadata" / "arch.conf");
+ _imp->repository_mask_files->push_back(*l / "metadata" / "repository_mask.conf");
+ _imp->profiles_desc_files->push_back(*l / "metadata" / "profiles_desc.conf");
+ _imp->mirror_files->push_back(*l / "metadata" / "mirrors.conf");
+ _imp->info_variables_files->push_back(*l / "metadata" / "info" / "variables.conf");
+
+ FSEntry descs(*l / "metadata" / "options" / "descriptions");
+ if (descs.is_directory_or_symlink_to_directory())
{
- if (! is_file_with_extension(*d, ".conf", IsFileWithOptions()))
- continue;
-
- std::string p(strip_trailing_string(strip_trailing_string(d->basename(), ".conf"), ".local"));
- if (p == "options")
- _imp->use_desc_files->push_back(std::make_pair(*d, ""));
- else
- _imp->use_desc_files->push_back(std::make_pair(*d, p));
+ for (DirIterator d(descs), d_end ; d != d_end ; ++d)
+ {
+ if (! is_file_with_extension(*d, ".conf", IsFileWithOptions()))
+ continue;
+
+ std::string p(strip_trailing_string(strip_trailing_string(d->basename(), ".conf"), ".local"));
+ if (p == "options")
+ _imp->use_desc_files->push_back(std::make_pair(*d, ""));
+ else
+ _imp->use_desc_files->push_back(std::make_pair(*d, p));
+ }
}
}
}
@@ -177,8 +183,10 @@ ExheresLayout::need_category_names() const
bool found_one(false);
std::list<FSEntry> cats_list;
- if (_imp->repository->params().master_repository)
- cats_list.push_back(_imp->repository->params().master_repository->layout()->categories_file());
+ if (_imp->repository->params().master_repositories)
+ for (ERepositorySequence::ConstIterator e(_imp->repository->params().master_repositories->begin()),
+ e_end(_imp->repository->params().master_repositories->end()) ; e != e_end ; ++e)
+ cats_list.push_back((*e)->layout()->categories_file());
cats_list.push_back(categories_file());
for (std::list<FSEntry>::const_iterator i(cats_list.begin()), i_end(cats_list.end()) ;
@@ -465,8 +473,8 @@ ExheresLayout::use_desc_files() const
FSEntry
ExheresLayout::profiles_base_dir() const
{
- if (master_repository_location())
- return *master_repository_location() / "profiles";
+ if (master_repositories_locations() && ! master_repositories_locations()->empty())
+ return *master_repositories_locations()->begin() / "profiles";
else
return _imp->tree_root / "profiles";
}
@@ -493,10 +501,14 @@ ExheresLayout::exlibsdirs_global() const
{
std::tr1::shared_ptr<FSEntrySequence> result(new FSEntrySequence);
- if (_imp->repository->params().master_repository)
+ if (_imp->repository->params().master_repositories)
{
- std::tr1::shared_ptr<const FSEntrySequence> master(_imp->repository->params().master_repository->layout()->exlibsdirs_global());
- std::copy(master->begin(), master->end(), result->back_inserter());
+ for (ERepositorySequence::ConstIterator e(_imp->repository->params().master_repositories->begin()),
+ e_end(_imp->repository->params().master_repositories->end()) ; e != e_end ; ++e)
+ {
+ std::tr1::shared_ptr<const FSEntrySequence> master((*e)->layout()->exlibsdirs_global());
+ std::copy(master->begin(), master->end(), result->back_inserter());
+ }
}
result->push_back(_imp->tree_root / "exlibs");
@@ -508,10 +520,14 @@ ExheresLayout::exlibsdirs_category(const CategoryNamePart & c) const
{
std::tr1::shared_ptr<FSEntrySequence> result(new FSEntrySequence);
- if (_imp->repository->params().master_repository)
+ if (_imp->repository->params().master_repositories)
{
- std::tr1::shared_ptr<const FSEntrySequence> master(_imp->repository->params().master_repository->layout()->exlibsdirs_category(c));
- std::copy(master->begin(), master->end(), result->back_inserter());
+ for (ERepositorySequence::ConstIterator e(_imp->repository->params().master_repositories->begin()),
+ e_end(_imp->repository->params().master_repositories->end()) ; e != e_end ; ++e)
+ {
+ std::tr1::shared_ptr<const FSEntrySequence> master((*e)->layout()->exlibsdirs_category(c));
+ std::copy(master->begin(), master->end(), result->back_inserter());
+ }
}
result->push_back(category_directory(c) / "exlibs");
@@ -523,10 +539,14 @@ ExheresLayout::exlibsdirs_package(const QualifiedPackageName & q) const
{
std::tr1::shared_ptr<FSEntrySequence> result(new FSEntrySequence);
- if (_imp->repository->params().master_repository)
+ if (_imp->repository->params().master_repositories)
{
- std::tr1::shared_ptr<const FSEntrySequence> master(_imp->repository->params().master_repository->layout()->exlibsdirs_package(q));
- std::copy(master->begin(), master->end(), result->back_inserter());
+ for (ERepositorySequence::ConstIterator e(_imp->repository->params().master_repositories->begin()),
+ e_end(_imp->repository->params().master_repositories->end()) ; e != e_end ; ++e)
+ {
+ std::tr1::shared_ptr<const FSEntrySequence> master((*e)->layout()->exlibsdirs_package(q));
+ std::copy(master->begin(), master->end(), result->back_inserter());
+ }
}
result->push_back(package_directory(q));
@@ -538,10 +558,14 @@ ExheresLayout::licenses_dirs() const
{
std::tr1::shared_ptr<FSEntrySequence> result(new FSEntrySequence);
- if (_imp->repository->params().master_repository)
+ if (_imp->repository->params().master_repositories)
{
- std::tr1::shared_ptr<const FSEntrySequence> master(_imp->repository->params().master_repository->layout()->licenses_dirs());
- std::copy(master->begin(), master->end(), result->back_inserter());
+ for (ERepositorySequence::ConstIterator e(_imp->repository->params().master_repositories->begin()),
+ e_end(_imp->repository->params().master_repositories->end()) ; e != e_end ; ++e)
+ {
+ std::tr1::shared_ptr<const FSEntrySequence> master((*e)->layout()->licenses_dirs());
+ std::copy(master->begin(), master->end(), result->back_inserter());
+ }
}
result->push_back(_imp->tree_root / "licences");
diff --git a/paludis/repositories/e/exheres_layout.hh b/paludis/repositories/e/exheres_layout.hh
index 329007a..e8f9498 100644
--- a/paludis/repositories/e/exheres_layout.hh
+++ b/paludis/repositories/e/exheres_layout.hh
@@ -49,8 +49,8 @@ namespace paludis
///\{
ExheresLayout(const ERepository * const, const FSEntry &,
- std::tr1::shared_ptr<const ERepositoryEntries>,
- std::tr1::shared_ptr<const FSEntry>);
+ const std::tr1::shared_ptr<const ERepositoryEntries> &,
+ const std::tr1::shared_ptr<const FSEntrySequence> &);
virtual ~ExheresLayout();
diff --git a/paludis/repositories/e/layout.cc b/paludis/repositories/e/layout.cc
index 9e25875..70facab 100644
--- a/paludis/repositories/e/layout.cc
+++ b/paludis/repositories/e/layout.cc
@@ -32,8 +32,8 @@ template class InstantiationPolicy<LayoutFactory, instantiation_method::Singleto
template class Map<FSEntry, std::string>;
-Layout::Layout(std::tr1::shared_ptr<const FSEntry> l) :
- _master_repository_location(l)
+Layout::Layout(const std::tr1::shared_ptr<const FSEntrySequence> & l) :
+ _master_repositories_locations(l)
{
}
@@ -41,10 +41,10 @@ Layout::~Layout()
{
}
-std::tr1::shared_ptr<const FSEntry>
-Layout::master_repository_location() const
+const std::tr1::shared_ptr<const FSEntrySequence>
+Layout::master_repositories_locations() const
{
- return _master_repository_location;
+ return _master_repositories_locations;
}
FSEntry
@@ -59,7 +59,7 @@ namespace
std::tr1::shared_ptr<Layout>
make_layout(const ERepository * const n, const FSEntry & b,
std::tr1::shared_ptr<const ERepositoryEntries> e,
- std::tr1::shared_ptr<const FSEntry> f)
+ std::tr1::shared_ptr<const FSEntrySequence> f)
{
return std::tr1::shared_ptr<Layout>(new T_(n, b, e, f));
}
@@ -75,7 +75,7 @@ LayoutFactory::create(
const ERepository * const r,
const FSEntry & f,
const std::tr1::shared_ptr<const ERepositoryEntries> & e,
- const std::tr1::shared_ptr<const FSEntry> & ff) const
+ const std::tr1::shared_ptr<const FSEntrySequence> & ff) const
{
if (s == "traditional")
return make_layout<TraditionalLayout>(r, f, e, ff);
diff --git a/paludis/repositories/e/layout.hh b/paludis/repositories/e/layout.hh
index 93d63df..5abf771 100644
--- a/paludis/repositories/e/layout.hh
+++ b/paludis/repositories/e/layout.hh
@@ -48,13 +48,13 @@ namespace paludis
class PALUDIS_VISIBLE Layout
{
private:
- std::tr1::shared_ptr<const FSEntry> _master_repository_location;
+ const std::tr1::shared_ptr<const FSEntrySequence> _master_repositories_locations;
protected:
///\name Basic operations
///\{
- Layout(std::tr1::shared_ptr<const FSEntry> master_repository_location);
+ Layout(const std::tr1::shared_ptr<const FSEntrySequence> & master_repositories_locations);
///\}
@@ -69,7 +69,7 @@ namespace paludis
///\name Configuration information
///\{
- std::tr1::shared_ptr<const FSEntry> master_repository_location() const;
+ const std::tr1::shared_ptr<const FSEntrySequence> master_repositories_locations() const;
///\}
@@ -174,7 +174,7 @@ namespace paludis
const ERepository * const,
const FSEntry &,
const std::tr1::shared_ptr<const ERepositoryEntries> &,
- const std::tr1::shared_ptr<const FSEntry> &)
+ const std::tr1::shared_ptr<const FSEntrySequence> &)
const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/e/qa/categories.cc b/paludis/repositories/e/qa/categories.cc
index 915e573..81c2e52 100644
--- a/paludis/repositories/e/qa/categories.cc
+++ b/paludis/repositories/e/qa/categories.cc
@@ -26,6 +26,7 @@
#include <paludis/util/log.hh>
#include <paludis/util/options.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/sequence.hh>
#include <set>
@@ -46,7 +47,8 @@ paludis::erepository::categories_check(
{
if (! cats.is_regular_file_or_symlink_to_regular_file())
{
- if (cats.exists() || ! repo->params().master_repository)
+ /* if the categories file exists but is not regular, or if we don't have a master */
+ if (cats.exists() || ! (repo->params().master_repositories && ! repo->params().master_repositories->empty()))
reporter.message(QAMessage(cats, qaml_severe, name, "Categories file is not a regular file"));
}
else
diff --git a/paludis/repositories/e/qa/visibility.cc b/paludis/repositories/e/qa/visibility.cc
index 33fd739..8bd62d4 100644
--- a/paludis/repositories/e/qa/visibility.cc
+++ b/paludis/repositories/e/qa/visibility.cc
@@ -165,18 +165,33 @@ namespace
if (repo->repository_masked(**i) || (*profile).profile()->profile_masked(**i) || ! (*i)->keywords_key())
continue;
}
- else if ((*i)->repository() == repo->params().master_repository)
- {
- if (repo->params().master_repository->repository_masked(**i) ||
- (*profile).profile()->profile_masked(**i) || ! (*i)->keywords_key())
- continue;
- }
else
{
- Log::get_instance()->message("e.qa.visibility_check.no_masks", ll_warning, lc_context)
- << "Probably a bug: don't know how to get masks for '"
- << **i << "' from '" << orig_p << "' -> '" << *p << "'";
- continue;
+ bool found_repo(false), repo_masked(false);
+ if (repo->params().master_repositories)
+ {
+ for (ERepositorySequence::ConstIterator e(repo->params().master_repositories->begin()),
+ e_end(repo->params().master_repositories->end()) ; e != e_end ; ++e)
+ {
+ if ((*i)->repository()->name() == (*e)->name())
+ if ((*e)->repository_masked(**i))
+ {
+ repo_masked = true;
+ break;
+ }
+ }
+ }
+
+ if (repo_masked)
+ continue;
+
+ if (! found_repo)
+ {
+ Log::get_instance()->message("e.qa.visibility_check.no_masks", ll_warning, lc_context)
+ << "Probably a bug: don't know how to get masks for '"
+ << **i << "' from '" << orig_p << "' -> '" << *p << "'";
+ continue;
+ }
}
std::set<KeywordName> overlap;
diff --git a/paludis/repositories/e/traditional_layout.cc b/paludis/repositories/e/traditional_layout.cc
index 9d1373d..947492f 100644
--- a/paludis/repositories/e/traditional_layout.cc
+++ b/paludis/repositories/e/traditional_layout.cc
@@ -97,29 +97,33 @@ namespace paludis
}
TraditionalLayout::TraditionalLayout(const ERepository * const repo, const FSEntry & tree_root,
- std::tr1::shared_ptr<const ERepositoryEntries> e,
- std::tr1::shared_ptr<const FSEntry> f) :
+ const std::tr1::shared_ptr<const ERepositoryEntries> & e,
+ const std::tr1::shared_ptr<const FSEntrySequence> & f) :
Layout(f),
PrivateImplementationPattern<TraditionalLayout>(new Implementation<TraditionalLayout>(repo, tree_root, e))
{
- if (master_repository_location())
+ if (master_repositories_locations())
{
- _imp->arch_list_files->push_back(*master_repository_location() / "profiles" / "arch.list");
- _imp->repository_mask_files->push_back(*master_repository_location() / "profiles" / "package.mask");
- _imp->profiles_desc_files->push_back(*master_repository_location() / "profiles" / "profiles.desc");
- _imp->mirror_files->push_back(*master_repository_location() / "profiles" / "thirdpartymirrors");
- _imp->info_variables_files->push_back(*master_repository_location() / "profiles" / "info_vars");
-
- _imp->use_desc_files->push_back(std::make_pair(*master_repository_location() / "profiles" / "use.desc", ""));
- _imp->use_desc_files->push_back(std::make_pair(*master_repository_location() / "profiles" / "use.local.desc", ""));
- FSEntry descs(*master_repository_location() / "profiles" / "desc");
- if (descs.is_directory_or_symlink_to_directory())
+ for (FSEntrySequence::ConstIterator l(master_repositories_locations()->begin()), l_end(master_repositories_locations()->end()) ;
+ l != l_end ; ++l)
{
- for (DirIterator d(descs), d_end ; d != d_end ; ++d)
+ _imp->arch_list_files->push_back(*l / "profiles" / "arch.list");
+ _imp->repository_mask_files->push_back(*l / "profiles" / "package.mask");
+ _imp->profiles_desc_files->push_back(*l / "profiles" / "profiles.desc");
+ _imp->mirror_files->push_back(*l / "profiles" / "thirdpartymirrors");
+ _imp->info_variables_files->push_back(*l / "profiles" / "info_vars");
+
+ _imp->use_desc_files->push_back(std::make_pair(*l / "profiles" / "use.desc", ""));
+ _imp->use_desc_files->push_back(std::make_pair(*l / "profiles" / "use.local.desc", ""));
+ FSEntry descs(*l / "profiles" / "desc");
+ if (descs.is_directory_or_symlink_to_directory())
{
- if (! is_file_with_extension(*d, ".desc", IsFileWithOptions()))
- continue;
- _imp->use_desc_files->push_back(std::make_pair(*d, strip_trailing_string(d->basename(), ".desc")));
+ for (DirIterator d(descs), d_end ; d != d_end ; ++d)
+ {
+ if (! is_file_with_extension(*d, ".desc", IsFileWithOptions()))
+ continue;
+ _imp->use_desc_files->push_back(std::make_pair(*d, strip_trailing_string(d->basename(), ".desc")));
+ }
}
}
}
@@ -170,8 +174,10 @@ TraditionalLayout::need_category_names() const
bool found_one(false);
std::list<FSEntry> cats_list;
- if (_imp->repository->params().master_repository)
- cats_list.push_back(_imp->repository->params().master_repository->layout()->categories_file());
+ if (_imp->repository->params().master_repositories)
+ for (ERepositorySequence::ConstIterator e(_imp->repository->params().master_repositories->begin()),
+ e_end(_imp->repository->params().master_repositories->end()) ; e != e_end ; ++e)
+ cats_list.push_back((*e)->layout()->categories_file());
cats_list.push_back(categories_file());
for (std::list<FSEntry>::const_iterator i(cats_list.begin()), i_end(cats_list.end()) ;
@@ -477,8 +483,8 @@ TraditionalLayout::use_desc_files() const
FSEntry
TraditionalLayout::profiles_base_dir() const
{
- if (master_repository_location())
- return *master_repository_location() / "profiles";
+ if (master_repositories_locations() && ! master_repositories_locations()->empty())
+ return *master_repositories_locations()->begin() / "profiles";
else
return _imp->tree_root / "profiles";
}
@@ -505,10 +511,14 @@ TraditionalLayout::exlibsdirs_global() const
{
std::tr1::shared_ptr<FSEntrySequence> result(new FSEntrySequence);
- if (_imp->repository->params().master_repository)
+ if (_imp->repository->params().master_repositories)
{
- std::tr1::shared_ptr<const FSEntrySequence> master(_imp->repository->params().master_repository->layout()->exlibsdirs_global());
- std::copy(master->begin(), master->end(), result->back_inserter());
+ for (ERepositorySequence::ConstIterator e(_imp->repository->params().master_repositories->begin()),
+ e_end(_imp->repository->params().master_repositories->end()) ; e != e_end ; ++e)
+ {
+ std::tr1::shared_ptr<const FSEntrySequence> master((*e)->layout()->exlibsdirs_global());
+ std::copy(master->begin(), master->end(), result->back_inserter());
+ }
}
result->push_back(_imp->tree_root / "exlibs");
@@ -520,10 +530,14 @@ TraditionalLayout::exlibsdirs_category(const CategoryNamePart & c) const
{
std::tr1::shared_ptr<FSEntrySequence> result(new FSEntrySequence);
- if (_imp->repository->params().master_repository)
+ if (_imp->repository->params().master_repositories)
{
- std::tr1::shared_ptr<const FSEntrySequence> master(_imp->repository->params().master_repository->layout()->exlibsdirs_category(c));
- std::copy(master->begin(), master->end(), result->back_inserter());
+ for (ERepositorySequence::ConstIterator e(_imp->repository->params().master_repositories->begin()),
+ e_end(_imp->repository->params().master_repositories->end()) ; e != e_end ; ++e)
+ {
+ std::tr1::shared_ptr<const FSEntrySequence> master((*e)->layout()->exlibsdirs_category(c));
+ std::copy(master->begin(), master->end(), result->back_inserter());
+ }
}
result->push_back(category_directory(c) / "exlibs");
@@ -535,10 +549,14 @@ TraditionalLayout::exlibsdirs_package(const QualifiedPackageName & q) const
{
std::tr1::shared_ptr<FSEntrySequence> result(new FSEntrySequence);
- if (_imp->repository->params().master_repository)
+ if (_imp->repository->params().master_repositories)
{
- std::tr1::shared_ptr<const FSEntrySequence> master(_imp->repository->params().master_repository->layout()->exlibsdirs_package(q));
- std::copy(master->begin(), master->end(), result->back_inserter());
+ for (ERepositorySequence::ConstIterator e(_imp->repository->params().master_repositories->begin()),
+ e_end(_imp->repository->params().master_repositories->end()) ; e != e_end ; ++e)
+ {
+ std::tr1::shared_ptr<const FSEntrySequence> master((*e)->layout()->exlibsdirs_package(q));
+ std::copy(master->begin(), master->end(), result->back_inserter());
+ }
}
result->push_back(package_directory(q));
@@ -550,10 +568,14 @@ TraditionalLayout::licenses_dirs() const
{
std::tr1::shared_ptr<FSEntrySequence> result(new FSEntrySequence);
- if (_imp->repository->params().master_repository)
+ if (_imp->repository->params().master_repositories)
{
- std::tr1::shared_ptr<const FSEntrySequence> master(_imp->repository->params().master_repository->layout()->licenses_dirs());
- std::copy(master->begin(), master->end(), result->back_inserter());
+ for (ERepositorySequence::ConstIterator e(_imp->repository->params().master_repositories->begin()),
+ e_end(_imp->repository->params().master_repositories->end()) ; e != e_end ; ++e)
+ {
+ std::tr1::shared_ptr<const FSEntrySequence> master((*e)->layout()->licenses_dirs());
+ std::copy(master->begin(), master->end(), result->back_inserter());
+ }
}
result->push_back(_imp->tree_root / "licenses");
diff --git a/paludis/repositories/e/traditional_layout.hh b/paludis/repositories/e/traditional_layout.hh
index 796f1dc..f2bb2df 100644
--- a/paludis/repositories/e/traditional_layout.hh
+++ b/paludis/repositories/e/traditional_layout.hh
@@ -50,8 +50,8 @@ namespace paludis
///\{
TraditionalLayout(const ERepository * const, const FSEntry &,
- std::tr1::shared_ptr<const ERepositoryEntries>,
- std::tr1::shared_ptr<const FSEntry>);
+ const std::tr1::shared_ptr<const ERepositoryEntries> &,
+ const std::tr1::shared_ptr<const FSEntrySequence> &);
virtual ~TraditionalLayout();