aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-30 16:10:44 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-30 16:10:44 +0000
commit0bda72d513de1c3a9d36e0bd4b38d61569ebcbb4 (patch)
tree2a59f607f84a5b8e7f79227d07589ef36ace413f
parent460bf0dc5f2da9d4d5de6b66a6597477d7b3bd26 (diff)
downloadpaludis-0bda72d513de1c3a9d36e0bd4b38d61569ebcbb4.tar.gz
paludis-0bda72d513de1c3a9d36e0bd4b38d61569ebcbb4.tar.xz
r3682@snowflake: ciaranm | 2007-06-30 17:10:26 +0100
More idle actions
-rw-r--r--paludis/repositories/e/e_key.cc45
-rw-r--r--paludis/repositories/e/e_key.hh6
-rw-r--r--paludis/repositories/e/ebuild_id.cc6
3 files changed, 57 insertions, 0 deletions
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 76924ec..381ba76 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -120,6 +120,7 @@ namespace paludis
{
const tr1::shared_ptr<const PackageID> id;
const std::string string_value;
+ mutable Mutex value_mutex;
mutable tr1::shared_ptr<const LicenseSpecTree::ConstItem> value;
Implementation(const tr1::shared_ptr<const PackageID> & i, const std::string & v) :
@@ -145,6 +146,7 @@ ELicenseKey::~ELicenseKey()
const tr1::shared_ptr<const LicenseSpecTree::ConstItem>
ELicenseKey::value() const
{
+ Lock l(_imp->value_mutex);
if (_imp->value)
return _imp->value;
@@ -153,6 +155,17 @@ ELicenseKey::value() const
return _imp->value;
}
+void
+ELicenseKey::idle_load() const
+{
+ TryLock l(_imp->value_mutex);
+ if (l() && ! _imp->value)
+ {
+ Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "' as idle action:");
+ _imp->value = PortageDepParser::parse_license(_imp->string_value, *_imp->id->eapi());
+ }
+}
+
namespace paludis
{
template <>
@@ -280,6 +293,7 @@ namespace paludis
{
const tr1::shared_ptr<const PackageID> id;
const std::string string_value;
+ mutable Mutex value_mutex;
mutable tr1::shared_ptr<IUseFlagCollection> value;
Implementation(const tr1::shared_ptr<const PackageID> & i, const std::string & v) :
@@ -305,6 +319,7 @@ EIUseKey::~EIUseKey()
const tr1::shared_ptr<const IUseFlagCollection>
EIUseKey::value() const
{
+ Lock l(_imp->value_mutex);
if (_imp->value)
return _imp->value;
@@ -319,6 +334,22 @@ EIUseKey::value() const
return _imp->value;
}
+void
+EIUseKey::idle_load() const
+{
+ TryLock l(_imp->value_mutex);
+ if (l() && ! _imp->value)
+ {
+ Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "' as idle action:");
+ _imp->value.reset(new IUseFlagCollection::Concrete);
+ std::list<std::string> tokens;
+ WhitespaceTokeniser::get_instance()->tokenise(_imp->string_value, std::back_inserter(tokens));
+ for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
+ t != t_end ; ++t)
+ _imp->value->insert(IUseFlag(*t, _imp->id->eapi()->supported->iuse_flag_parse_mode));
+ }
+}
+
namespace paludis
{
template <>
@@ -326,6 +357,7 @@ namespace paludis
{
const tr1::shared_ptr<const PackageID> id;
const std::string string_value;
+ mutable Mutex value_mutex;
mutable tr1::shared_ptr<KeywordNameCollection> value;
Implementation(const tr1::shared_ptr<const PackageID> & i, const std::string & v) :
@@ -351,6 +383,7 @@ EKeywordsKey::~EKeywordsKey()
const tr1::shared_ptr<const KeywordNameCollection>
EKeywordsKey::value() const
{
+ Lock l(_imp->value_mutex);
if (_imp->value)
return _imp->value;
@@ -360,6 +393,18 @@ EKeywordsKey::value() const
return _imp->value;
}
+void
+EKeywordsKey::idle_load() const
+{
+ TryLock l(_imp->value_mutex);
+ if (l() && ! _imp->value)
+ {
+ _imp->value.reset(new KeywordNameCollection::Concrete);
+ Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "' as idle action:");
+ WhitespaceTokeniser::get_instance()->tokenise(_imp->string_value, create_inserter<KeywordName>(_imp->value->inserter()));
+ }
+}
+
namespace paludis
{
template <>
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index 6c3d457..f839aeb 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -124,6 +124,8 @@ namespace paludis
virtual const tr1::shared_ptr<const LicenseSpecTree::ConstItem> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void idle_load() const;
};
class EIUseKey :
@@ -140,6 +142,8 @@ namespace paludis
const tr1::shared_ptr<const IUseFlagCollection> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void idle_load() const;
};
class EKeywordsKey :
@@ -156,6 +160,8 @@ namespace paludis
const tr1::shared_ptr<const KeywordNameCollection> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void idle_load() const;
};
class EUseKey :
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 25a5009..91723a7 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -570,6 +570,12 @@ EbuildID::_idle_load() const throw ()
_imp->run_dependencies->idle_load();
if (_imp->post_dependencies)
_imp->post_dependencies->idle_load();
+ if (_imp->license)
+ _imp->license->idle_load();
+ if (_imp->keywords)
+ _imp->keywords->idle_load();
+ if (_imp->iuse)
+ _imp->iuse->idle_load();
}
catch (...)
{