aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-19 14:34:08 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-19 14:34:08 +0000
commitf2121cec89e5bcce11b10fe664d996b19c3ff86e (patch)
treec76db8bef8d5821ef7b79fa10873fdcfbd0732c5
parentbde811c776eee1b37d9bcaee8aa9074df8c34ebd (diff)
downloadpaludis-f2121cec89e5bcce11b10fe664d996b19c3ff86e.tar.gz
paludis-f2121cec89e5bcce11b10fe664d996b19c3ff86e.tar.xz
Move mask stores into layouts
-rw-r--r--paludis/repositories/e/e_repository.cc33
-rw-r--r--paludis/repositories/e/e_repository.hh2
-rw-r--r--paludis/repositories/e/ebuild_id.cc2
-rw-r--r--paludis/repositories/e/exheres_layout.cc40
-rw-r--r--paludis/repositories/e/exheres_layout.hh7
-rw-r--r--paludis/repositories/e/layout.cc11
-rw-r--r--paludis/repositories/e/layout.hh6
-rw-r--r--paludis/repositories/e/repository_mask_store.cc11
-rw-r--r--paludis/repositories/e/repository_mask_store.hh4
-rw-r--r--paludis/repositories/e/traditional_layout.cc47
-rw-r--r--paludis/repositories/e/traditional_layout.hh9
11 files changed, 109 insertions, 63 deletions
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 1b107b1..b5d502d 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -21,7 +21,6 @@
#include <paludis/repositories/e/aa_visitor.hh>
#include <paludis/repositories/e/e_key.hh>
#include <paludis/repositories/e/e_repository.hh>
-#include <paludis/repositories/e/e_repository_mask_file.hh>
#include <paludis/repositories/e/profile.hh>
#include <paludis/repositories/e/profile_file.hh>
#include <paludis/repositories/e/traditional_profile.hh>
@@ -43,7 +42,6 @@
#include <paludis/repositories/e/check_userpriv.hh>
#include <paludis/repositories/e/make_use.hh>
#include <paludis/repositories/e/a_finder.hh>
-#include <paludis/repositories/e/repository_mask_store.hh>
#include <paludis/repositories/e/file_suffixes.hh>
#include <paludis/about.hh>
@@ -64,11 +62,9 @@
#include <paludis/syncer.hh>
#include <paludis/util/accept_visitor.hh>
-#include <paludis/util/active_object_ptr.hh>
#include <paludis/util/cookie.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/create_iterator-impl.hh>
-#include <paludis/util/deferred_construction_ptr.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/extract_host_from_url.hh>
#include <paludis/util/fs_stat.hh>
@@ -183,21 +179,6 @@ namespace
return result;
}
- std::shared_ptr<RepositoryMaskStore> make_mask_store(
- const Environment * const env,
- const RepositoryName & repo_name,
- const FetchRepositoryMaskFilesFunction & f,
- const EAPIForFileFunction & e)
- {
- return std::make_shared<RepositoryMaskStore>(env, repo_name, f, e);
- }
-
- std::shared_ptr<const FSPathSequence> fetch_repository_mask_files(
- const std::shared_ptr<const Layout> & layout)
- {
- return layout->repository_mask_files();
- }
-
bool is_arch_flag_func(const ERepository * const r, const UnprefixedChoiceName & p)
{
return r->arch_flags()->end() != r->arch_flags()->find(p);
@@ -242,8 +223,6 @@ namespace paludis
mutable std::shared_ptr<ERepositorySets> sets_ptr;
const std::shared_ptr<Layout> layout;
- ActiveObjectPtr<DeferredConstructionPtr<std::shared_ptr<RepositoryMaskStore> > > repository_mask_store;
-
mutable EAPIForFileMap eapi_for_file_map;
Imp(ERepository * const, const ERepositoryParams &, std::shared_ptr<Mutexes> = std::make_shared<Mutexes>());
@@ -299,12 +278,8 @@ namespace paludis
names_cache(std::make_shared<RepositoryNameCache>(p.names_cache(), r)),
has_mirrors(false),
sets_ptr(std::make_shared<ERepositorySets>(params.environment(), r, p)),
- layout(LayoutFactory::get_instance()->create(params.layout(), r, params.location(), get_master_locations(
+ layout(LayoutFactory::get_instance()->create(params.layout(), params.environment(), r, params.location(), get_master_locations(
params.master_repositories()))),
- repository_mask_store(DeferredConstructionPtr<std::shared_ptr<RepositoryMaskStore> > (
- std::bind(&make_mask_store, params.environment(), r->name(),
- FetchRepositoryMaskFilesFunction(std::bind(fetch_repository_mask_files, layout)),
- EAPIForFileFunction(std::bind(std::mem_fn(&ERepository::eapi_for_file), r, std::placeholders::_1))))),
format_key(std::make_shared<LiteralMetadataValueKey<std::string> >("format", "format",
mkt_significant, params.entry_format())),
layout_key(std::make_shared<LiteralMetadataValueKey<std::string> >("layout", "layout",
@@ -636,12 +611,6 @@ ERepository::package_ids(const QualifiedPackageName & n, const RepositoryContent
return _imp->layout->package_ids(n);
}
-std::shared_ptr<const MasksInfo>
-ERepository::repository_masks(const std::shared_ptr<const PackageID> & id) const
-{
- return _imp->repository_mask_store->query(id);
-}
-
const std::shared_ptr<const Set<UnprefixedChoiceName> >
ERepository::arch_flags() const
{
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index 22e4561..e800f84 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -159,8 +159,6 @@ namespace paludis
const std::shared_ptr<const erepository::Layout> layout() const;
const std::shared_ptr<const erepository::Profile> profile() const;
- std::shared_ptr<const erepository::MasksInfo> repository_masks(const std::shared_ptr<const PackageID> &) const;
-
void regenerate_cache() const;
/* Keys */
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 09ff33f..775edec 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -561,7 +561,7 @@ EbuildID::need_masks_added() const
}
{
- auto repo_masks(e_repo->repository_masks(shared_from_this()));
+ auto repo_masks(e_repo->layout()->repository_masks(shared_from_this()));
for (auto r(repo_masks->begin()), r_end(repo_masks->end()) ;
r != r_end ; ++r)
diff --git a/paludis/repositories/e/exheres_layout.cc b/paludis/repositories/e/exheres_layout.cc
index edd1681..17f51ed 100644
--- a/paludis/repositories/e/exheres_layout.cc
+++ b/paludis/repositories/e/exheres_layout.cc
@@ -21,10 +21,11 @@
#include <paludis/repositories/e/e_repository_exceptions.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/active_object_ptr.hh>
+#include <paludis/util/deferred_construction_ptr.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/log.hh>
@@ -41,8 +42,12 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/fs_iterator.hh>
#include <paludis/util/fs_stat.hh>
+
#include <paludis/choice.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/package_id.hh>
+#include <paludis/package_database.hh>
+
#include <unordered_map>
#include <functional>
#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,9 @@ namespace paludis
std::shared_ptr<FSPathSequence> info_packages_files;
std::shared_ptr<UseDescFileInfoSequence> use_desc_files;
- Imp(const ERepository * const n, const FSPath & t) :
+ ActiveObjectPtr<DeferredConstructionPtr<std::shared_ptr<RepositoryMaskStore> > > repository_mask_store;
+
+ Imp(const Environment * const env, const ERepository * const n, const FSPath & t) :
repository(n),
tree_root(t),
has_category_names(false),
@@ -90,16 +109,19 @@ namespace paludis
mirror_files(std::make_shared<FSPathSequence>()),
info_variables_files(std::make_shared<FSPathSequence>()),
info_packages_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, n->name(),
+ repository_mask_files, EAPIForFileFunction(std::bind(std::mem_fn(&ERepository::eapi_for_file), n, std::placeholders::_1)))))
{
}
};
}
-ExheresLayout::ExheresLayout(const ERepository * const r, const FSPath & tree_root,
+ExheresLayout::ExheresLayout(const Environment * const e, const ERepository * const r, const FSPath & tree_root,
const std::shared_ptr<const FSPathSequence> & f) :
Layout(f),
- _imp(r, tree_root)
+ _imp(e, r, tree_root)
{
if (master_repositories_locations())
{
@@ -642,3 +664,9 @@ ExheresLayout::e_updates_location_key() const
return make_null_shared_ptr();
}
+std::shared_ptr<const MasksInfo>
+ExheresLayout::repository_masks(const std::shared_ptr<const PackageID> & id) const
+{
+ return _imp->repository_mask_store->query(id);
+}
+
diff --git a/paludis/repositories/e/exheres_layout.hh b/paludis/repositories/e/exheres_layout.hh
index 836de83..57139e5 100644
--- a/paludis/repositories/e/exheres_layout.hh
+++ b/paludis/repositories/e/exheres_layout.hh
@@ -47,7 +47,9 @@ namespace paludis
///\name Basic operations
///\{
- ExheresLayout(const ERepository * const, const FSPath &,
+ ExheresLayout(
+ const Environment * const,
+ const ERepository * const, const FSPath &,
const std::shared_ptr<const FSPathSequence> &);
virtual ~ExheresLayout();
@@ -129,6 +131,9 @@ namespace paludis
virtual std::shared_ptr<MetadataValueKey<FSPath> > e_updates_location_key() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::shared_ptr<const MasksInfo> repository_masks(const std::shared_ptr<const PackageID> &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/e/layout.cc b/paludis/repositories/e/layout.cc
index 0804893..57a59d3 100644
--- a/paludis/repositories/e/layout.cc
+++ b/paludis/repositories/e/layout.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
* Copyright (c) 2006 Danny van Dyk
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -56,10 +56,10 @@ namespace
{
template <typename T_>
std::shared_ptr<Layout>
- make_layout(const ERepository * const n, const FSPath & b,
+ make_layout(const Environment * const e, const ERepository * const n, const FSPath & b,
std::shared_ptr<const FSPathSequence> f)
{
- return std::make_shared<T_>(n, b, f);
+ return std::make_shared<T_>(e, n, b, f);
}
}
@@ -70,14 +70,15 @@ LayoutFactory::LayoutFactory()
const std::shared_ptr<Layout>
LayoutFactory::create(
const std::string & s,
+ const Environment * const e,
const ERepository * const r,
const FSPath & f,
const std::shared_ptr<const FSPathSequence> & ff) const
{
if (s == "traditional")
- return make_layout<TraditionalLayout>(r, f, ff);
+ return make_layout<TraditionalLayout>(e, r, f, ff);
if (s == "exheres")
- return make_layout<ExheresLayout>(r, f, ff);
+ return make_layout<ExheresLayout>(e, r, f, ff);
throw ConfigurationError("Unrecognised layout '" + s + "'");
}
diff --git a/paludis/repositories/e/layout.hh b/paludis/repositories/e/layout.hh
index b60ae47..1e6c109 100644
--- a/paludis/repositories/e/layout.hh
+++ b/paludis/repositories/e/layout.hh
@@ -30,7 +30,9 @@
#include <paludis/util/map-fwd.hh>
#include <paludis/util/singleton.hh>
#include <paludis/repositories/e/use_desc.hh>
+#include <paludis/repositories/e/mask_info.hh>
#include <paludis/metadata_key-fwd.hh>
+#include <paludis/environment-fwd.hh>
#include <memory>
namespace paludis
@@ -155,6 +157,9 @@ namespace paludis
virtual FSPath sync_filter_file() const;
+ virtual std::shared_ptr<const MasksInfo> repository_masks(const std::shared_ptr<const PackageID> &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
///\}
};
@@ -174,6 +179,7 @@ namespace paludis
public:
const std::shared_ptr<Layout> create(
const std::string &,
+ const Environment * const env,
const ERepository * const,
const FSPath &,
const std::shared_ptr<const FSPathSequence> &)
diff --git a/paludis/repositories/e/repository_mask_store.cc b/paludis/repositories/e/repository_mask_store.cc
index 8260365..8b3a683 100644
--- a/paludis/repositories/e/repository_mask_store.cc
+++ b/paludis/repositories/e/repository_mask_store.cc
@@ -49,15 +49,15 @@ namespace paludis
{
const Environment * const env;
RepositoryName repo_name;
- FetchRepositoryMaskFilesFunction fetch_repository_mask_files;
+ const std::shared_ptr<const FSPathSequence> files;
EAPIForFileFunction eapi_for_file;
RepositoryMaskMap repo_mask;
- Imp(const Environment * const e, const RepositoryName & r, const FetchRepositoryMaskFilesFunction & f, const EAPIForFileFunction & n) :
+ Imp(const Environment * const e, const RepositoryName & r, const std::shared_ptr<const FSPathSequence> & f, const EAPIForFileFunction & n) :
env(e),
repo_name(r),
- fetch_repository_mask_files(f),
+ files(f),
eapi_for_file(n)
{
}
@@ -67,7 +67,7 @@ namespace paludis
RepositoryMaskStore::RepositoryMaskStore(
const Environment * const e,
const RepositoryName & r,
- const FetchRepositoryMaskFilesFunction & f,
+ const std::shared_ptr<const FSPathSequence> & f,
const EAPIForFileFunction & n) :
_imp(e, r, f, n)
{
@@ -85,9 +85,8 @@ RepositoryMaskStore::_populate()
using namespace std::placeholders;
- auto repository_mask_files(_imp->fetch_repository_mask_files());
ProfileFile<MaskFile> repository_mask_file(_imp->eapi_for_file);
- std::for_each(repository_mask_files->begin(), repository_mask_files->end(),
+ std::for_each(_imp->files->begin(), _imp->files->end(),
std::bind(&ProfileFile<MaskFile>::add_file, std::ref(repository_mask_file), _1));
for (ProfileFile<MaskFile>::ConstIterator
diff --git a/paludis/repositories/e/repository_mask_store.hh b/paludis/repositories/e/repository_mask_store.hh
index 4c8eb71..d792242 100644
--- a/paludis/repositories/e/repository_mask_store.hh
+++ b/paludis/repositories/e/repository_mask_store.hh
@@ -38,8 +38,6 @@ namespace paludis
{
namespace erepository
{
- typedef std::function<const std::shared_ptr<const FSPathSequence> & ()> FetchRepositoryMaskFilesFunction;
-
class PALUDIS_VISIBLE RepositoryMaskStore
{
private:
@@ -51,7 +49,7 @@ namespace paludis
RepositoryMaskStore(
const Environment * const,
const RepositoryName &,
- const FetchRepositoryMaskFilesFunction &,
+ const std::shared_ptr<const FSPathSequence> &,
const EAPIForFileFunction &);
~RepositoryMaskStore();
diff --git a/paludis/repositories/e/traditional_layout.cc b/paludis/repositories/e/traditional_layout.cc
index 3629204..a0f717d 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);
+}
+
+
diff --git a/paludis/repositories/e/traditional_layout.hh b/paludis/repositories/e/traditional_layout.hh
index 7647c4a..99e1c04 100644
--- a/paludis/repositories/e/traditional_layout.hh
+++ b/paludis/repositories/e/traditional_layout.hh
@@ -23,6 +23,7 @@
#include <paludis/repositories/e/layout.hh>
#include <paludis/util/pimp.hh>
+#include <paludis/environment-fwd.hh>
namespace paludis
{
@@ -48,7 +49,10 @@ namespace paludis
///\name Basic operations
///\{
- TraditionalLayout(const ERepository * const, const FSPath &,
+ TraditionalLayout(
+ const Environment * const env,
+ const ERepository * const,
+ const FSPath &,
const std::shared_ptr<const FSPathSequence> &);
virtual ~TraditionalLayout();
@@ -133,6 +137,9 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual FSPath sync_filter_file() const;
+
+ virtual std::shared_ptr<const MasksInfo> repository_masks(const std::shared_ptr<const PackageID> &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}