aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/traditional_layout.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories/e/traditional_layout.cc')
-rw-r--r--paludis/repositories/e/traditional_layout.cc47
1 files changed, 41 insertions, 6 deletions
diff --git a/paludis/repositories/e/traditional_layout.cc b/paludis/repositories/e/traditional_layout.cc
index 362920402..a0f717de7 100644
--- a/paludis/repositories/e/traditional_layout.cc
+++ b/paludis/repositories/e/traditional_layout.cc
@@ -21,10 +21,9 @@
#include <paludis/repositories/e/traditional_layout.hh>
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/file_suffixes.hh>
+#include <paludis/repositories/e/repository_mask_store.hh>
#include <paludis/util/config_file.hh>
-#include <paludis/package_id.hh>
-#include <paludis/package_database.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/log.hh>
@@ -41,8 +40,14 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_iterator.hh>
+#include <paludis/util/active_object_ptr.hh>
+#include <paludis/util/deferred_construction_ptr.hh>
+
+#include <paludis/package_id.hh>
+#include <paludis/package_database.hh>
#include <paludis/choice.hh>
#include <paludis/literal_metadata_key.hh>
+
#include <functional>
#include <unordered_map>
#include <algorithm>
@@ -55,6 +60,18 @@ typedef std::unordered_map<CategoryNamePart, bool, Hash<CategoryNamePart> > Cate
typedef std::unordered_map<QualifiedPackageName, bool, Hash<QualifiedPackageName> > PackagesMap;
typedef std::unordered_map<QualifiedPackageName, std::shared_ptr<PackageIDSequence>, Hash<QualifiedPackageName> > IDMap;
+namespace
+{
+ std::shared_ptr<RepositoryMaskStore> make_mask_store(
+ const Environment * const env,
+ const RepositoryName & repo_name,
+ const std::shared_ptr<const FSPathSequence> & f,
+ const EAPIForFileFunction & e)
+ {
+ return std::make_shared<RepositoryMaskStore>(env, repo_name, f, e);
+ }
+}
+
namespace paludis
{
template<>
@@ -80,7 +97,12 @@ namespace paludis
std::shared_ptr<FSPathSequence> info_variables_files;
std::shared_ptr<UseDescFileInfoSequence> use_desc_files;
- Imp(const ERepository * const r, const FSPath & t) :
+ ActiveObjectPtr<DeferredConstructionPtr<std::shared_ptr<RepositoryMaskStore> > > repository_mask_store;
+
+ Imp(
+ const Environment * const env,
+ const ERepository * const r,
+ const FSPath & t) :
repository(r),
tree_root(t),
has_category_names(false),
@@ -90,16 +112,22 @@ namespace paludis
mirror_files(std::make_shared<FSPathSequence>()),
info_packages_files(std::make_shared<FSPathSequence>()),
info_variables_files(std::make_shared<FSPathSequence>()),
- use_desc_files(std::make_shared<UseDescFileInfoSequence>())
+ use_desc_files(std::make_shared<UseDescFileInfoSequence>()),
+ repository_mask_store(DeferredConstructionPtr<std::shared_ptr<RepositoryMaskStore> > (
+ std::bind(&make_mask_store, env, r->name(),
+ repository_mask_files, EAPIForFileFunction(std::bind(std::mem_fn(&ERepository::eapi_for_file), r, std::placeholders::_1)))))
{
}
};
}
-TraditionalLayout::TraditionalLayout(const ERepository * const repo, const FSPath & tree_root,
+TraditionalLayout::TraditionalLayout(
+ const Environment * const env,
+ const ERepository * const repo,
+ const FSPath & tree_root,
const std::shared_ptr<const FSPathSequence> & f) :
Layout(f),
- _imp(repo, tree_root)
+ _imp(env, repo, tree_root)
{
if (master_repositories_locations())
{
@@ -658,3 +686,10 @@ TraditionalLayout::e_updates_location_key() const
return make_null_shared_ptr();
}
+std::shared_ptr<const MasksInfo>
+TraditionalLayout::repository_masks(const std::shared_ptr<const PackageID> & id) const
+{
+ return _imp->repository_mask_store->query(id);
+}
+
+