aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-23 17:32:50 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-23 17:32:50 +0000
commit43974f5c23dc769d9d9306f845b451665cc99ab3 (patch)
tree97946e7adb1a6a22a0bcc87e1d65485dc161ac82
parentc71a047dc16253cb5f9c6110f6596803f7eb2959 (diff)
downloadpaludis-43974f5c23dc769d9d9306f845b451665cc99ab3.tar.gz
paludis-43974f5c23dc769d9d9306f845b451665cc99ab3.tar.xz
Make the Repository arch flags interface more useful.
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc6
-rw-r--r--paludis/repositories/fake/fake_repository_base.hh2
-rw-r--r--paludis/repositories/portage/portage_repository.cc30
-rw-r--r--paludis/repositories/portage/portage_repository.hh2
-rw-r--r--paludis/repositories/vdb/vdb_repository.cc12
-rw-r--r--paludis/repositories/vdb/vdb_repository.hh2
-rw-r--r--paludis/repository.hh15
7 files changed, 34 insertions, 35 deletions
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index 725e193..371e30b 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -209,10 +209,10 @@ FakeRepositoryBase::do_query_use_force(const UseFlagName &, const PackageDatabas
return false;
}
-bool
-FakeRepositoryBase::do_is_arch_flag(const UseFlagName &) const
+UseFlagNameCollection::ConstPointer
+FakeRepositoryBase::do_arch_flags() const
{
- return false;
+ return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
}
bool
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index d4a6ab0..aff3e2c 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -77,7 +77,7 @@ namespace paludis
virtual bool do_query_use_force(const UseFlagName &, const PackageDatabaseEntry *) const;
- virtual bool do_is_arch_flag(const UseFlagName &) const;
+ virtual UseFlagNameCollection::ConstPointer do_arch_flags() const;
virtual bool do_is_expand_flag(const UseFlagName &) const;
virtual bool do_is_expand_hidden_flag(const UseFlagName &) const;
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index 320781c..c29a64a 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -71,9 +71,6 @@ using namespace paludis;
namespace paludis
{
- /// Set of use flags.
- typedef MakeHashedSet<UseFlagName>::Type UseFlagSet;
-
/// Map for versions.
typedef MakeHashedMap<QualifiedPackageName, VersionSpecCollection::Pointer>::Type VersionsMap;
@@ -135,10 +132,7 @@ namespace paludis
mutable bool has_virtuals;
/// Arch flags
- mutable UseFlagSet arch_list;
-
- /// Do we have arch_list?
- mutable bool has_arch_list;
+ mutable UseFlagNameCollection::Pointer arch_flags;
/// Do we have mirrors?
mutable bool has_mirrors;
@@ -186,8 +180,7 @@ namespace paludis
has_category_names(false),
has_repo_mask(false),
has_virtuals(false),
- has_arch_list(false),
- has_mirrors(false),
+ arch_flags(0),
profile_ptr(0),
news_ptr(new PortageRepositoryNews(params.environment, repo, p)),
sets_ptr(new PortageRepositorySets(params.environment, repo, p)),
@@ -223,8 +216,7 @@ namespace paludis
repo_mask.clear();
has_repo_mask = false;
has_virtuals = false;
- arch_list.clear();
- has_arch_list = false;
+ arch_flags.assign(0);
has_mirrors = false;
mirrors.clear();
}
@@ -610,21 +602,19 @@ PortageRepository::do_query_use_force(const UseFlagName & u, const PackageDataba
return _imp->profile_ptr->use_forced(u, e);
}
-bool
-PortageRepository::do_is_arch_flag(const UseFlagName & u) const
+UseFlagNameCollection::ConstPointer
+PortageRepository::do_arch_flags() const
{
- if (! _imp->has_arch_list)
+ if (! _imp->arch_flags)
{
- Context context("When checking arch list for '" + stringify(u) + "':");
+ Context context("When loading arch list:");
LineConfigFile archs(_imp->params.location / "profiles" / "arch.list");
- std::copy(archs.begin(), archs.end(), create_inserter<UseFlagName>(
- std::inserter(_imp->arch_list, _imp->arch_list.begin())));
-
- _imp->has_arch_list = true;
+ _imp->arch_flags.assign(new UseFlagNameCollection::Concrete);
+ std::copy(archs.begin(), archs.end(), create_inserter<UseFlagName>(_imp->arch_flags->inserter()));
}
- return _imp->arch_list.end() != _imp->arch_list.find(u);
+ return _imp->arch_flags;
}
bool
diff --git a/paludis/repositories/portage/portage_repository.hh b/paludis/repositories/portage/portage_repository.hh
index 195632f..dce7b85 100644
--- a/paludis/repositories/portage/portage_repository.hh
+++ b/paludis/repositories/portage/portage_repository.hh
@@ -100,7 +100,7 @@ namespace paludis
virtual bool do_query_use_force(const UseFlagName &, const PackageDatabaseEntry *) const;
- virtual bool do_is_arch_flag(const UseFlagName &) const;
+ virtual UseFlagNameCollection::ConstPointer do_arch_flags() const;
virtual bool do_is_expand_flag(const UseFlagName &) const;
diff --git a/paludis/repositories/vdb/vdb_repository.cc b/paludis/repositories/vdb/vdb_repository.cc
index 7897b98..cc1f992 100644
--- a/paludis/repositories/vdb/vdb_repository.cc
+++ b/paludis/repositories/vdb/vdb_repository.cc
@@ -767,12 +767,6 @@ VDBRepositoryKeyReadError::VDBRepositoryKeyReadError(
}
bool
-VDBRepository::do_is_arch_flag(const UseFlagName &) const
-{
- return false;
-}
-
-bool
VDBRepository::do_is_expand_flag(const UseFlagName &) const
{
return false;
@@ -1109,3 +1103,9 @@ VDBRepository::provided_package_version_metadata(const RepositoryProvidesEntry &
return result;
}
+UseFlagNameCollection::ConstPointer
+VDBRepository::do_arch_flags() const
+{
+ return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
+}
+
diff --git a/paludis/repositories/vdb/vdb_repository.hh b/paludis/repositories/vdb/vdb_repository.hh
index f0f2555..603563a 100644
--- a/paludis/repositories/vdb/vdb_repository.hh
+++ b/paludis/repositories/vdb/vdb_repository.hh
@@ -84,7 +84,7 @@ namespace paludis
virtual bool do_query_use_force(const UseFlagName &, const PackageDatabaseEntry *) const;
- virtual bool do_is_arch_flag(const UseFlagName &) const;
+ virtual UseFlagNameCollection::ConstPointer do_arch_flags() const;
virtual bool do_is_expand_flag(const UseFlagName &) const;
virtual bool do_is_expand_hidden_flag(const UseFlagName &) const;
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 939af7a..9ceab86 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -382,9 +382,9 @@ namespace paludis
virtual bool do_query_use_force(const UseFlagName &, const PackageDatabaseEntry *) const = 0;
/**
- * Override in descendents: is this an arch flag?
+ * Override in descendents: fetch all arch flags.
*/
- virtual bool do_is_arch_flag(const UseFlagName &) const = 0;
+ virtual UseFlagNameCollection::ConstPointer do_arch_flags() const = 0;
/**
* Override in descendents: is this an expand flag?
@@ -439,7 +439,16 @@ namespace paludis
*/
bool is_arch_flag(const UseFlagName & u) const
{
- return do_is_arch_flag(u);
+ UseFlagNameCollection::ConstPointer uu(do_arch_flags());
+ return uu->end() != uu->find(u);
+ }
+
+ /**
+ * Fetch all arch flags.
+ */
+ UseFlagNameCollection::ConstPointer arch_flags() const
+ {
+ return do_arch_flags();
}
/**