aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-13 16:32:40 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-15 16:37:34 +0100
commitfcf18aac53a5d16328220a75508feea90fa267c6 (patch)
tree25ad6e087eaf41076e20671bead0f0462d51bc8f
parent893010bb06327d80f3cddf2a3f4de496520e74e4 (diff)
downloadpaludis-fcf18aac53a5d16328220a75508feea90fa267c6.tar.gz
paludis-fcf18aac53a5d16328220a75508feea90fa267c6.tar.xz
Don't bother loading empty restricts
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc10
-rw-r--r--paludis/repositories/e/ebuild_id.cc9
2 files changed, 13 insertions, 6 deletions
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index ca18675..30afac1 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -379,9 +379,13 @@ EInstalledRepositoryID::need_keys_added() const
if (! vars->restrictions()->name().empty())
if ((_imp->dir / vars->restrictions()->name()).stat().exists())
{
- _imp->keys->restrictions = std::make_shared<EPlainTextSpecKey>(_imp->environment, vars->restrictions(),
- eapi(), file_contents(_imp->dir / vars->restrictions()->name()), mkt_internal, is_installed());
- add_metadata_key(_imp->keys->restrictions);
+ std::string v(file_contents(_imp->dir / vars->restrictions()->name()));
+ if (! v.empty())
+ {
+ _imp->keys->restrictions = std::make_shared<EPlainTextSpecKey>(_imp->environment, vars->restrictions(),
+ eapi(), v, mkt_internal, is_installed());
+ add_metadata_key(_imp->keys->restrictions);
+ }
}
if (! vars->properties()->name().empty())
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 81db23f..b48a9b6 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1015,9 +1015,12 @@ EbuildID::load_license(const std::shared_ptr<const EAPIMetadataVariable> & m, co
void
EbuildID::load_restrict(const std::shared_ptr<const EAPIMetadataVariable> & m, const std::string & v) const
{
- Lock l(_imp->mutex);
- _imp->restrictions = std::make_shared<EPlainTextSpecKey>(_imp->environment, m, eapi(), v, mkt_internal, is_installed());
- add_metadata_key(_imp->restrictions);
+ if (! v.empty())
+ {
+ Lock l(_imp->mutex);
+ _imp->restrictions = std::make_shared<EPlainTextSpecKey>(_imp->environment, m, eapi(), v, mkt_internal, is_installed());
+ add_metadata_key(_imp->restrictions);
+ }
}
void