aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-08 11:39:34 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-08 11:39:34 +0000
commitd92d569336998cb634468c60a171f7d6277f612b (patch)
tree3be3e7bc9ee065bccdcc7200663187a137e2ca4b
parentc5787e23d6f52df06d166079e23c4cf231c3de25 (diff)
downloadpaludis-d92d569336998cb634468c60a171f7d6277f612b.tar.gz
paludis-d92d569336998cb634468c60a171f7d6277f612b.tar.xz
For use.conf, package_mask.conf, package_unmask.conf, licenses.conf, keywords.conf, mirrors.conf: also read from foo.conf.d/*.conf. Remove long-deprecated eclassdir, profile keys for ebuild repository. Add new master_repository key for ebuild repository. Fixes: ticket:74.
-rw-r--r--paludis/environment/default/default_config.cc34
-rw-r--r--paludis/repositories/portage/ebuild_entries.cc12
-rw-r--r--paludis/repositories/portage/make_ebuild_repository.cc68
-rw-r--r--paludis/repositories/portage/portage_repository.cc205
-rw-r--r--paludis/repositories/portage/portage_repository.hh2
-rw-r--r--paludis/repositories/portage/portage_repository_TEST.cc32
-rw-r--r--paludis/repositories/portage/portage_repository_params.hh3
-rw-r--r--paludis/repositories/portage/portage_repository_params.sr1
8 files changed, 253 insertions, 104 deletions
diff --git a/paludis/environment/default/default_config.cc b/paludis/environment/default/default_config.cc
index 40ba3d2..1645a47 100644
--- a/paludis/environment/default/default_config.cc
+++ b/paludis/environment/default/default_config.cc
@@ -326,6 +326,7 @@ DefaultConfig::DefaultConfig() :
filter_inserter(std::back_inserter(repo_files), IsFileWithExtension(".conf")));
}
+ std::list<std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > > later_keys;
for (std::list<FSEntry>::const_iterator repo_file(repo_files.begin()), repo_file_end(repo_files.end()) ;
repo_file != repo_file_end ; ++repo_file)
{
@@ -337,22 +338,33 @@ DefaultConfig::DefaultConfig() :
if (format.empty())
throw DefaultConfigError("Key 'format' not specified or empty");
- int importance(0);
+ int importance(k.get("master_repository").empty() ? 0 : 10);
if (! k.get("importance").empty())
importance = destringify<int>(k.get("importance"));
std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete(k.begin(), k.end()));
+ keys->erase("importance");
+ keys->insert("importance", stringify(importance));
+
keys->erase("repo_file");
keys->insert("repo_file", stringify(*repo_file));
keys->erase("root");
keys->insert("root", root_prefix);
- _imp->repos.push_back(RepositoryConfigEntry(format, importance, keys));
+ if (! k.get("master_repository").empty())
+ later_keys.push_back(keys);
+ else
+ _imp->repos.push_back(RepositoryConfigEntry(format, importance, keys));
}
+ for (std::list<std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > >::const_iterator
+ k(later_keys.begin()), k_end(later_keys.end()) ; k != k_end ; ++k)
+ _imp->repos.push_back(RepositoryConfigEntry((*k)->find("format")->second,
+ destringify<int>((*k)->find("importance")->second), *k));
+
if (_imp->repos.empty())
throw DefaultConfigError("No repositories specified");
@@ -369,6 +381,9 @@ DefaultConfig::DefaultConfig() :
{
std::list<FSEntry> files;
files.push_back(local_config_dir / "keywords.conf");
+ if ((local_config_dir / "keywords.conf.d").exists())
+ std::copy(DirIterator(local_config_dir / "keywords.conf.d"), DirIterator(),
+ filter_inserter(std::back_inserter(files), IsFileWithExtension(".conf")));
for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ;
file != file_end ; ++file)
@@ -415,6 +430,9 @@ DefaultConfig::DefaultConfig() :
{
std::list<FSEntry> files;
files.push_back(local_config_dir / "licenses.conf");
+ if ((local_config_dir / "licenses.conf.d").exists())
+ std::copy(DirIterator(local_config_dir / "licenses.conf.d"), DirIterator(),
+ filter_inserter(std::back_inserter(files), IsFileWithExtension(".conf")));
for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ;
file != file_end ; ++file)
@@ -454,6 +472,9 @@ DefaultConfig::DefaultConfig() :
{
std::list<FSEntry> files;
files.push_back(local_config_dir / "package_mask.conf");
+ if ((local_config_dir / "package_mask.conf.d").exists())
+ std::copy(DirIterator(local_config_dir / "package_mask.conf.d"), DirIterator(),
+ filter_inserter(std::back_inserter(files), IsFileWithExtension(".conf")));
for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ;
file != file_end ; ++file)
@@ -486,6 +507,9 @@ DefaultConfig::DefaultConfig() :
{
std::list<FSEntry> files;
files.push_back(local_config_dir / "package_unmask.conf");
+ if ((local_config_dir / "package_unmask.conf.d").exists())
+ std::copy(DirIterator(local_config_dir / "package_unmask.conf.d"), DirIterator(),
+ filter_inserter(std::back_inserter(files), IsFileWithExtension(".conf")));
for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ;
file != file_end ; ++file)
@@ -518,6 +542,9 @@ DefaultConfig::DefaultConfig() :
{
std::list<FSEntry> files;
files.push_back(local_config_dir / "use.conf");
+ if ((local_config_dir / "use.conf.d").exists())
+ std::copy(DirIterator(local_config_dir / "use.conf.d"), DirIterator(),
+ filter_inserter(std::back_inserter(files), IsFileWithExtension(".conf")));
for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ;
file != file_end ; ++file)
@@ -632,6 +659,9 @@ DefaultConfig::DefaultConfig() :
{
std::list<FSEntry> files;
files.push_back(local_config_dir / "mirrors.conf");
+ if ((local_config_dir / "mirrors.conf.d").exists())
+ std::copy(DirIterator(local_config_dir / "mirrors.conf.d"), DirIterator(),
+ filter_inserter(std::back_inserter(files), IsFileWithExtension(".conf")));
for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ;
file != file_end ; ++file)
diff --git a/paludis/repositories/portage/ebuild_entries.cc b/paludis/repositories/portage/ebuild_entries.cc
index 6d720ca..ca932f4 100644
--- a/paludis/repositories/portage/ebuild_entries.cc
+++ b/paludis/repositories/portage/ebuild_entries.cc
@@ -138,7 +138,8 @@ EbuildEntries::generate_version_metadata(const QualifiedPackageName & q,
.files_dir(_imp->params.location / stringify(q.category) /
stringify(q.package) / "files")
.eclassdirs(_imp->params.eclassdirs)
- .portdir(_imp->params.location)
+ .portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
+ _imp->params.location)
.distdir(_imp->params.distdir)
.buildroot(_imp->params.buildroot));
@@ -441,7 +442,8 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
.files_dir(_imp->params.location / stringify(q.category) /
stringify(q.package) / "files")
.eclassdirs(_imp->params.eclassdirs)
- .portdir(_imp->params.location)
+ .portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
+ _imp->params.location)
.distdir(_imp->params.distdir)
.buildroot(_imp->params.buildroot),
@@ -470,7 +472,8 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
.files_dir(_imp->params.location / stringify(q.category) /
stringify(q.package) / "files")
.eclassdirs(_imp->params.eclassdirs)
- .portdir(_imp->params.location)
+ .portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
+ _imp->params.location)
.distdir(_imp->params.distdir)
.buildroot(_imp->params.buildroot),
@@ -504,7 +507,8 @@ EbuildEntries::get_environment_variable(const QualifiedPackageName & q,
.files_dir(_imp->params.location / stringify(q.category) /
stringify(q.package) / "files")
.eclassdirs(_imp->params.eclassdirs)
- .portdir(_imp->params.location)
+ .portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
+ _imp->params.location)
.distdir(_imp->params.distdir)
.buildroot(_imp->params.buildroot),
diff --git a/paludis/repositories/portage/make_ebuild_repository.cc b/paludis/repositories/portage/make_ebuild_repository.cc
index 87906e5..e8bc4a7 100644
--- a/paludis/repositories/portage/make_ebuild_repository.cc
+++ b/paludis/repositories/portage/make_ebuild_repository.cc
@@ -22,6 +22,7 @@
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/repositories/portage/portage_repository_exceptions.hh>
+#include <paludis/environment.hh>
using namespace paludis;
@@ -39,43 +40,67 @@ paludis::make_ebuild_repository(
if (m->end() == m->find("location") || ((location = m->find("location")->second)).empty())
throw PortageRepositoryConfigurationError("Key 'location' not specified or empty");
+ std::tr1::shared_ptr<const RepositoryName> master_repository_name;
+ std::tr1::shared_ptr<const PortageRepository> master_repository;
+ if (m->end() != m->find("master_repository") && ! m->find("master_repository")->second.empty())
+ {
+ Context context_local("When finding configuration information for master_repository '"
+ + stringify(m->find("master_repository")->second) + "':");
+
+ master_repository_name.reset(new RepositoryName(m->find("master_repository")->second));
+
+ std::tr1::shared_ptr<const Repository> master_repository_uncasted(
+ env->package_database()->fetch_repository(*master_repository_name));
+
+ if (master_repository_uncasted->format() != "ebuild")
+ throw PortageRepositoryConfigurationError("Master repository format is '" +
+ stringify(master_repository_uncasted->format()) + "', not 'ebuild'");
+
+ master_repository = std::tr1::static_pointer_cast<const PortageRepository>(master_repository_uncasted);
+
+ if (master_repository->params().master_repository)
+ throw PortageRepositoryConfigurationError("Requested master repository has a master_repository of '" +
+ stringify(master_repository->params().master_repository->name()) + "', so it cannot "
+ "be used as a master repository");
+ }
+
std::tr1::shared_ptr<FSEntryCollection> profiles(new FSEntryCollection::Concrete);
if (m->end() != m->find("profiles"))
WhitespaceTokeniser::get_instance()->tokenise(m->find("profiles")->second,
create_inserter<FSEntry>(std::back_inserter(*profiles)));
- if (m->end() != m->find("profile") && ! m->find("profile")->second.empty())
+
+ if (profiles->empty())
{
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Key 'profile' in '" + repo_file + "' is deprecated, "
- "use 'profiles = " + m->find("profile")->second + "' instead");
- if (profiles->empty())
- profiles->append(m->find("profile")->second);
+ if (master_repository)
+ std::copy(master_repository->params().profiles->begin(),
+ master_repository->params().profiles->end(), profiles->inserter());
else
- throw PortageRepositoryConfigurationError("Both 'profile' and 'profiles' keys are present");
+ throw PortageRepositoryConfigurationError("No profiles have been specified");
}
- if (profiles->empty())
- throw PortageRepositoryConfigurationError("No profiles have been specified");
std::tr1::shared_ptr<FSEntryCollection> eclassdirs(new FSEntryCollection::Concrete);
+
if (m->end() != m->find("eclassdirs"))
WhitespaceTokeniser::get_instance()->tokenise(m->find("eclassdirs")->second,
create_inserter<FSEntry>(std::back_inserter(*eclassdirs)));
- if (m->end() != m->find("eclassdir") && ! m->find("eclassdir")->second.empty())
- {
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Key 'eclassdir' in '" + repo_file + "' is deprecated, "
- "use 'eclassdirs = " + m->find("eclassdir")->second + "' instead");
- if (eclassdirs->empty())
- eclassdirs->append(m->find("eclassdir")->second);
- else
- throw PortageRepositoryConfigurationError("Both 'eclassdir' and 'eclassdirs' keys are present");
- }
+
if (eclassdirs->empty())
+ {
+ if (master_repository)
+ std::copy(master_repository->params().eclassdirs->begin(),
+ master_repository->params().eclassdirs->end(), eclassdirs->inserter());
+
eclassdirs->append(location + "/eclass");
+ }
std::string distdir;
if (m->end() == m->find("distdir") || ((distdir = m->find("distdir")->second)).empty())
- distdir = location + "/distfiles";
+ {
+ if (master_repository)
+ distdir = stringify(master_repository->params().distdir);
+ else
+ distdir = location + "/distfiles";
+ }
std::string setsdir;
if (m->end() == m->find("setsdir") || ((setsdir = m->find("setsdir")->second)).empty())
@@ -112,7 +137,7 @@ paludis::make_ebuild_repository(
std::string sync;
if (m->end() != m->find("sync"))
- sync = m->find("sync")->second;
+ sync = m->find("sync")->second;
std::string sync_options;
if (m->end() != m->find("sync_options"))
@@ -152,6 +177,7 @@ paludis::make_ebuild_repository(
.sync(sync)
.sync_options(sync_options)
.root(root)
+ .master_repository(master_repository)
.buildroot(buildroot)));
}
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index ff093a8..18b7de9 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -163,6 +163,8 @@ namespace paludis
/// Our profile handler.
mutable std::tr1::shared_ptr<PortageRepositoryProfile> profile_ptr;
+ std::list<FSEntry> profiles_dir_locations;
+
/// Our news handler.
mutable std::tr1::shared_ptr<PortageRepositoryNews> news_ptr;
@@ -184,7 +186,7 @@ namespace paludis
std::tr1::shared_ptr<RepositoryNameCache> names_cache;
- mutable std::tr1::shared_ptr<UseDesc> use_desc;
+ mutable std::list<std::tr1::shared_ptr<UseDesc> > use_desc;
PortageRepository * const repo;
};
@@ -205,6 +207,11 @@ namespace paludis
names_cache(new RepositoryNameCache(p.names_cache, r)),
repo(r)
{
+ if (params.master_repository)
+ profiles_dir_locations.push_back(params.master_repository->params().location / "profiles");
+
+ if ((params.location / "profiles").exists())
+ profiles_dir_locations.push_back(params.location / "profiles");
}
Implementation<PortageRepository>::~Implementation()
@@ -229,25 +236,38 @@ namespace paludis
Context context("When loading profiles.desc:");
- LineConfigFile p(params.location / "profiles" / "profiles.desc");
- for (LineConfigFile::Iterator line(p.begin()), line_end(p.end()) ; line != line_end ; ++line)
+ bool found_one(false);
+ for (std::list<FSEntry>::const_iterator p(profiles_dir_locations.begin()),
+ p_end(profiles_dir_locations.end()) ; p != p_end ; ++p)
{
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*line,
- std::back_inserter(tokens));
- if (tokens.size() < 3)
+ if (! (*p / "profiles.desc").exists())
continue;
- FSEntryCollection::Concrete profiles;
- profiles.push_back(params.location / "profiles" / tokens.at(1));
- profiles_desc.push_back(PortageRepositoryProfilesDescLine::create()
- .arch(tokens.at(0))
- .path(*profiles.begin())
- .status(tokens.at(2))
- .profile(std::tr1::shared_ptr<PortageRepositoryProfile>(new PortageRepositoryProfile(
- params.environment, repo->name(), profiles))));
+ found_one = true;
+
+ LineConfigFile f(*p / "profiles.desc");
+ for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ; line != line_end ; ++line)
+ {
+ std::vector<std::string> tokens;
+ WhitespaceTokeniser::get_instance()->tokenise(*line,
+ std::back_inserter(tokens));
+ if (tokens.size() < 3)
+ continue;
+
+ FSEntryCollection::Concrete profiles;
+ profiles.push_back(*p / tokens.at(1));
+ profiles_desc.push_back(PortageRepositoryProfilesDescLine::create()
+ .arch(tokens.at(0))
+ .path(*profiles.begin())
+ .status(tokens.at(2))
+ .profile(std::tr1::shared_ptr<PortageRepositoryProfile>(new PortageRepositoryProfile(
+ params.environment, repo->name(), profiles))));
+ }
}
+ if (! found_one)
+ throw PortageRepositoryConfigurationError("No profiles.desc found");
+
has_profiles_desc = true;
}
}
@@ -296,6 +316,8 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
config_info->add_kv("buildroot", stringify(_imp->params.buildroot));
config_info->add_kv("sync", _imp->params.sync);
config_info->add_kv("sync_options", _imp->params.sync_options);
+ if (_imp->params.master_repository)
+ config_info->add_kv("master_repository", stringify(_imp->params.master_repository->name()));
_info->add_section(config_info);
}
@@ -478,7 +500,35 @@ PortageRepository::need_category_names() const
Log::get_instance()->message(ll_debug, lc_context, "need_category_names");
- if (! (_imp->params.location / "profiles" / "categories").exists())
+ bool found_one(false);
+
+ for (std::list<FSEntry>::const_iterator p(_imp->profiles_dir_locations.begin()),
+ p_end(_imp->profiles_dir_locations.end()) ; p != p_end ; ++p)
+ {
+ if (! (*p / "categories").exists())
+ continue;
+
+ LineConfigFile cats(*p / "categories");
+
+ for (LineConfigFile::Iterator line(cats.begin()), line_end(cats.end()) ;
+ line != line_end ; ++line)
+ {
+ try
+ {
+ _imp->category_names.insert(std::make_pair(CategoryNamePart(*line), false));
+ }
+ catch (const NameError & e)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Skipping line '"
+ + *line + "' in '" + stringify(*p / "categories") + "' due to exception '"
+ + stringify(e.message()) + "' ('" + e.what() + ")");
+ }
+ }
+
+ found_one = true;
+ }
+
+ if (! found_one)
{
Log::get_instance()->message(ll_qa, lc_context, "No categories file for repository at '"
+ stringify(_imp->params.location) + "', faking it");
@@ -501,14 +551,6 @@ PortageRepository::need_category_names() const
}
}
}
- else
- {
- LineConfigFile cats(_imp->params.location / "profiles" / "categories");
-
- for (LineConfigFile::Iterator line(cats.begin()), line_end(cats.end()) ;
- line != line_end ; ++line)
- _imp->category_names.insert(std::make_pair(CategoryNamePart(*line), false));
- }
_imp->has_category_names = true;
}
@@ -613,15 +655,19 @@ PortageRepository::do_query_repository_masks(const QualifiedPackageName & q, con
Context context("When querying repository mask for '" + stringify(q) + "-"
+ stringify(v) + "':");
- FSEntry fff(_imp->params.location / "profiles" / "package.mask");
- if (fff.exists())
+ for (std::list<FSEntry>::const_iterator p(_imp->profiles_dir_locations.begin()),
+ p_end(_imp->profiles_dir_locations.end()) ; p != p_end ; ++p)
{
- LineConfigFile ff(fff);
- for (LineConfigFile::Iterator line(ff.begin()), line_end(ff.end()) ;
- line != line_end ; ++line)
+ FSEntry fff(*p / "package.mask");
+ if (fff.exists())
{
- std::tr1::shared_ptr<const PackageDepAtom> a(new PackageDepAtom(*line));
- _imp->repo_mask[a->package()].push_back(a);
+ LineConfigFile ff(fff);
+ for (LineConfigFile::Iterator line(ff.begin()), line_end(ff.end()) ;
+ line != line_end ; ++line)
+ {
+ std::tr1::shared_ptr<const PackageDepAtom> a(new PackageDepAtom(*line));
+ _imp->repo_mask[a->package()].push_back(a);
+ }
}
}
@@ -678,16 +724,23 @@ PortageRepository::do_arch_flags() const
Context context("When loading arch list:");
_imp->arch_flags.reset(new UseFlagNameCollection::Concrete);
- FSEntry a(_imp->params.location / "profiles" / "arch.list");
- if (a.exists())
+ bool found_one(false);
+ for (std::list<FSEntry>::const_iterator p(_imp->profiles_dir_locations.begin()),
+ p_end(_imp->profiles_dir_locations.end()) ; p != p_end ; ++p)
{
+ FSEntry a(*p / "arch.list");
+ if (! a.exists())
+ continue;
+
LineConfigFile archs(a);
std::copy(archs.begin(), archs.end(), create_inserter<UseFlagName>(_imp->arch_flags->inserter()));
+ found_one = true;
}
- else
+
+ if (! found_one)
{
- Log::get_instance()->message(ll_qa, lc_no_context, "Couldn't open arch.list file in '"
- + stringify(a) + "', arch flags may incorrectly show up as unmasked");
+ Log::get_instance()->message(ll_qa, lc_no_context, "Couldn't find arch.list file for repository '"
+ + stringify(name()) + "', arch flags may incorrectly show up as unmasked");
}
}
@@ -712,27 +765,35 @@ PortageRepository::need_mirrors() const
{
if (! _imp->has_mirrors)
{
- if ((_imp->params.location / "profiles" / "thirdpartymirrors").exists())
+ bool found_one(false);
+ for (std::list<FSEntry>::const_iterator p(_imp->profiles_dir_locations.begin()),
+ p_end(_imp->profiles_dir_locations.end()) ; p != p_end ; ++p)
{
- LineConfigFile mirrors(_imp->params.location / "profiles" / "thirdpartymirrors");
- for (LineConfigFile::Iterator line(mirrors.begin()) ; line != mirrors.end() ; ++line)
+ if ((*p / "thirdpartymirrors").exists())
{
- std::vector<std::string> entries;
- WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(entries));
- if (! entries.empty())
+ LineConfigFile mirrors(*p / "thirdpartymirrors");
+ for (LineConfigFile::Iterator line(mirrors.begin()) ; line != mirrors.end() ; ++line)
{
- /* pick up to five random mirrors only */
- static Random r;
- std::random_shuffle(next(entries.begin()), entries.end(), r);
- if (entries.size() > 6)
- entries.resize(6);
- for (std::vector<std::string>::const_iterator e(next(entries.begin())),
- e_end(entries.end()) ; e != e_end ; ++e)
- _imp->mirrors.insert(std::make_pair(entries.at(0), *e));
+ std::vector<std::string> entries;
+ WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(entries));
+ if (! entries.empty())
+ {
+ /* pick up to five random mirrors only */
+ static Random r;
+ std::random_shuffle(next(entries.begin()), entries.end(), r);
+ if (entries.size() > 6)
+ entries.resize(6);
+ for (std::vector<std::string>::const_iterator e(next(entries.begin())),
+ e_end(entries.end()) ; e != e_end ; ++e)
+ _imp->mirrors.insert(std::make_pair(entries.at(0), *e));
+ }
}
}
+
+ found_one = true;
}
- else
+
+ if (! found_one)
Log::get_instance()->message(ll_warning, lc_no_context,
"No thirdpartymirrors file found in '"
+ stringify(_imp->params.location / "profiles") + "', so mirror:// SRC_URI "
@@ -852,10 +913,14 @@ PortageRepository::info(bool verbose) const
result->add_section(*s);
std::set<std::string> info_pkgs;
- if ((_imp->params.location / "profiles" / "info_pkgs").exists())
+ for (std::list<FSEntry>::const_iterator p(_imp->profiles_dir_locations.begin()),
+ p_end(_imp->profiles_dir_locations.end()) ; p != p_end ; ++p)
{
- LineConfigFile vars(_imp->params.location / "profiles" / "info_pkgs");
- info_pkgs.insert(vars.begin(), vars.end());
+ if ((*p / "info_pkgs").exists())
+ {
+ LineConfigFile vars(*p / "info_pkgs");
+ info_pkgs.insert(vars.begin(), vars.end());
+ }
}
if (! info_pkgs.empty())
@@ -887,10 +952,14 @@ PortageRepository::info(bool verbose) const
}
std::set<std::string> info_vars;
- if ((_imp->params.location / "profiles" / "info_vars").exists())
+ for (std::list<FSEntry>::const_iterator p(_imp->profiles_dir_locations.begin()),
+ p_end(_imp->profiles_dir_locations.end()) ; p != p_end ; ++p)
{
- LineConfigFile vars(_imp->params.location / "profiles" / "info_vars");
- info_vars.insert(vars.begin(), vars.end());
+ if ((*p / "info_vars").exists())
+ {
+ LineConfigFile vars(*p / "info_vars");
+ info_vars.insert(vars.begin(), vars.end());
+ }
}
if (! info_vars.empty() && ! info_pkgs.empty() &&
@@ -1152,9 +1221,25 @@ std::string
PortageRepository::do_describe_use_flag(const UseFlagName & f,
const PackageDatabaseEntry * const e) const
{
- if (! _imp->use_desc)
- _imp->use_desc.reset(new UseDesc(_imp->params.location / "profiles"));
+ if (_imp->use_desc.empty())
+ for (std::list<FSEntry>::const_iterator p(_imp->profiles_dir_locations.begin()),
+ p_end(_imp->profiles_dir_locations.end()) ; p != p_end ; ++p)
+ _imp->use_desc.push_back(std::tr1::shared_ptr<UseDesc>(new UseDesc(*p)));
+
+ std::string result;
+ for (std::list<std::tr1::shared_ptr<UseDesc> >::const_iterator i(_imp->use_desc.begin()),
+ i_end(_imp->use_desc.end()) ; i != i_end ; ++i)
+ {
+ std::string new_result((*i)->describe(f, e));
+ if (! new_result.empty())
+ result = new_result;
+ }
+ return result;
+}
- return _imp->use_desc->describe(f, e);
+const PortageRepositoryParams &
+PortageRepository::params() const
+{
+ return _imp->params;
}
diff --git a/paludis/repositories/portage/portage_repository.hh b/paludis/repositories/portage/portage_repository.hh
index e6326a0..1331388 100644
--- a/paludis/repositories/portage/portage_repository.hh
+++ b/paludis/repositories/portage/portage_repository.hh
@@ -166,6 +166,8 @@ namespace paludis
typedef libwrapiter::ForwardIterator<PortageRepository, std::pair<
const QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > > OurVirtualsIterator;
+ const PortageRepositoryParams & params() const;
+
///\}
///\name Profile setting and querying functions
diff --git a/paludis/repositories/portage/portage_repository_TEST.cc b/paludis/repositories/portage/portage_repository_TEST.cc
index df15892..396db9e 100644
--- a/paludis/repositories/portage/portage_repository_TEST.cc
+++ b/paludis/repositories/portage/portage_repository_TEST.cc
@@ -51,7 +51,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo1");
- keys->insert("profile", "portage_repository_TEST_dir/repo1/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo1/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "test-repo-1");
@@ -74,7 +74,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo2");
- keys->insert("profile", "portage_repository_TEST_dir/repo2/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo2/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "x-repo2");
@@ -97,7 +97,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo3");
- keys->insert("profile", "portage_repository_TEST_dir/repo3/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo3/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "x-repo3");
@@ -120,7 +120,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo1");
- keys->insert("profile", "portage_repository_TEST_dir/repo1/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo1/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -152,7 +152,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo1");
- keys->insert("profile", "portage_repository_TEST_dir/repo1/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo1/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -186,7 +186,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo4");
- keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo4/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -226,7 +226,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo4");
- keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo4/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -270,7 +270,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo4");
- keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo4/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -323,7 +323,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo5");
- keys->insert("profile", "portage_repository_TEST_dir/repo5/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo5/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -357,7 +357,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo4");
- keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo4/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -401,7 +401,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo4");
- keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo4/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -444,7 +444,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo8");
- keys->insert("profile", "portage_repository_TEST_dir/repo8/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo8/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -487,7 +487,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo6");
- keys->insert("profile", "portage_repository_TEST_dir/repo6/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo6/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -528,7 +528,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo7");
- keys->insert("profile", "portage_repository_TEST_dir/repo7/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo7/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -565,7 +565,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo7");
- keys->insert("profile", "portage_repository_TEST_dir/repo7/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo7/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
@@ -596,7 +596,7 @@ namespace test_cases
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo9");
- keys->insert("profile", "portage_repository_TEST_dir/repo9/profiles/profile");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo9/profiles/profile");
std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
diff --git a/paludis/repositories/portage/portage_repository_params.hh b/paludis/repositories/portage/portage_repository_params.hh
index 5381766..058ef4e 100644
--- a/paludis/repositories/portage/portage_repository_params.hh
+++ b/paludis/repositories/portage/portage_repository_params.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
@@ -34,6 +34,7 @@ namespace paludis
{
class Environment;
class PackageDatabase;
+ class PortageRepository;
#include <paludis/repositories/portage/portage_repository_params-sr.hh>
diff --git a/paludis/repositories/portage/portage_repository_params.sr b/paludis/repositories/portage/portage_repository_params.sr
index 8363d64..f3f396c 100644
--- a/paludis/repositories/portage/portage_repository_params.sr
+++ b/paludis/repositories/portage/portage_repository_params.sr
@@ -20,6 +20,7 @@ make_class_PortageRepositoryParams()
key sync_options std::string
key root FSEntry
key buildroot FSEntry
+ key master_repository "std::tr1::shared_ptr<const PortageRepository>"
doxygen_comment << "END"
/**