aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-12 12:22:59 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-12 12:22:59 +0000
commitaf016c31d4c835b541157e6f5619b58d366c0efe (patch)
tree459ea87de3db6183df3a9b4262c72be1476f8ee7
parent2972c11c9247f6d31a83b20a7b746099a0f01e09 (diff)
downloadpaludis-af016c31d4c835b541157e6f5619b58d366c0efe.tar.gz
paludis-af016c31d4c835b541157e6f5619b58d366c0efe.tar.xz
Add PortageRepository->set_profile_by_arch
-rw-r--r--paludis/repositories/portage/portage_repository.cc24
-rw-r--r--paludis/repositories/portage/portage_repository.hh1
2 files changed, 25 insertions, 0 deletions
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index 42a8efb..fdbfbc6 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -1108,6 +1108,8 @@ PortageRepository::find_profile(const FSEntry & location) const
void
PortageRepository::set_profile(const ProfilesIterator & iter)
{
+ Context context("When setting profile by iterator:");
+
_imp->profile_ptr = iter->profile;
try
@@ -1120,6 +1122,28 @@ PortageRepository::set_profile(const ProfilesIterator & iter)
}
}
+void
+PortageRepository::set_profile_by_arch(const UseFlagName & arch)
+{
+ Context context("When setting profile by arch '" + stringify(arch) + "':");
+
+ for (ProfilesIterator p(begin_profiles()), p_end(end_profiles()) ; p != p_end ; ++p)
+ if (p->arch == stringify(arch) && p->status == "stable")
+ {
+ set_profile(p);
+ return;
+ }
+
+ for (ProfilesIterator p(begin_profiles()), p_end(end_profiles()) ; p != p_end ; ++p)
+ if (p->arch == stringify(arch))
+ {
+ set_profile(p);
+ return;
+ }
+
+ throw ConfigurationError("Cannot find a profile appropriate for '" + stringify(arch) + "'");
+}
+
std::string
PortageRepository::do_describe_use_flag(const UseFlagName & f,
const PackageDatabaseEntry * const e) const
diff --git a/paludis/repositories/portage/portage_repository.hh b/paludis/repositories/portage/portage_repository.hh
index b3ccdc5..c17262d 100644
--- a/paludis/repositories/portage/portage_repository.hh
+++ b/paludis/repositories/portage/portage_repository.hh
@@ -181,6 +181,7 @@ namespace paludis
ProfilesIterator find_profile(const FSEntry & location) const;
void set_profile(const ProfilesIterator & iter);
+ void set_profile_by_arch(const UseFlagName &);
///\}
};