aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-26 16:15:48 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-26 16:15:55 +0000
commitf1b121f3054eff3e048ee516b7f9e9aecdd26fad (patch)
tree7778cd974bca954be88932a4a4d5b60871aa6667
parentf0e47a5bbc492e6bc93c52af1fbbfe77c3eeb756 (diff)
downloadpaludis-f1b121f3054eff3e048ee516b7f9e9aecdd26fad.tar.gz
paludis-f1b121f3054eff3e048ee516b7f9e9aecdd26fad.tar.xz
Pass EAPI to mask files
-rw-r--r--paludis/repositories/e/e_repository_mask_file.cc2
-rw-r--r--paludis/repositories/e/e_repository_mask_file.hh4
-rw-r--r--paludis/repositories/e/profile_file.cc22
3 files changed, 24 insertions, 4 deletions
diff --git a/paludis/repositories/e/e_repository_mask_file.cc b/paludis/repositories/e/e_repository_mask_file.cc
index edae90d..af33ac4 100644
--- a/paludis/repositories/e/e_repository_mask_file.cc
+++ b/paludis/repositories/e/e_repository_mask_file.cc
@@ -51,7 +51,7 @@ namespace paludis
};
}
-MaskFile::MaskFile(const FSPath & f, const LineConfigFileOptions & opts) :
+MaskFile::MaskFile(const FSPath & f, const LineConfigFileOptions & opts, const EAPI &) :
_imp()
{
LineConfigFileOptions myopts(opts);
diff --git a/paludis/repositories/e/e_repository_mask_file.hh b/paludis/repositories/e/e_repository_mask_file.hh
index 2c2c110..e74b099 100644
--- a/paludis/repositories/e/e_repository_mask_file.hh
+++ b/paludis/repositories/e/e_repository_mask_file.hh
@@ -30,6 +30,8 @@ namespace paludis
{
namespace erepository
{
+ class EAPI;
+
/**
* A file listing masks in an ERepository.
*
@@ -46,7 +48,7 @@ namespace paludis
///\name Basic operations
///\{
- MaskFile(const FSPath &, const LineConfigFileOptions &);
+ MaskFile(const FSPath &, const LineConfigFileOptions &, const EAPI &);
~MaskFile();
///\}
diff --git a/paludis/repositories/e/profile_file.cc b/paludis/repositories/e/profile_file.cc
index 6303ec9..3b4ed61 100644
--- a/paludis/repositories/e/profile_file.cc
+++ b/paludis/repositories/e/profile_file.cc
@@ -111,6 +111,24 @@ namespace paludis
typedef std::list<std::pair<std::shared_ptr<const EAPI>,
const std::remove_reference<MaskFile::ConstIterator::value_type>::type> >::const_iterator UnderlyingIterator;
};
+
+ template <typename T_>
+ struct MakeFile
+ {
+ static std::shared_ptr<T_> make(const FSPath & p, const LineConfigFileOptions & o, const EAPI & e)
+ {
+ return std::make_shared<T_>(p, o, e);
+ }
+ };
+
+ template <>
+ struct MakeFile<LineConfigFile>
+ {
+ static std::shared_ptr<LineConfigFile> make(const FSPath & p, const LineConfigFileOptions & o, const EAPI &)
+ {
+ return std::make_shared<LineConfigFile>(p, o);
+ }
+ };
}
template <typename F_>
@@ -128,8 +146,8 @@ ProfileFile<F_>::add_file(const FSPath & f)
throw ERepositoryConfigurationError("Can't use profile file '" + stringify(f) +
"' because it uses an unsupported EAPI");
- F_ file(f, { lcfo_disallow_continuations });
- for (typename F_::ConstIterator line(file.begin()), line_end(file.end()) ; line != line_end ; ++line)
+ std::shared_ptr<F_> file(MakeFile<F_>::make(f, { lcfo_disallow_continuations }, *eapi));
+ for (typename F_::ConstIterator line(file->begin()), line_end(file->end()) ; line != line_end ; ++line)
{
const std::string key(FileEntryTraits<const typename std::remove_reference<typename F_::ConstIterator::value_type>::type>::extract_key(*line));
if (0 == key.compare(0, 1, "-", 0, 1))