aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-13 16:33:45 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-15 16:37:35 +0100
commite2e29a928e6d9f70ad62fc58dff28e83568b3a1c (patch)
tree13da4e12093e63d034af6446140502f497c10ec6
parentfcf18aac53a5d16328220a75508feea90fa267c6 (diff)
downloadpaludis-e2e29a928e6d9f70ad62fc58dff28e83568b3a1c.tar.gz
paludis-e2e29a928e6d9f70ad62fc58dff28e83568b3a1c.tar.xz
Don't bother loading empty properties
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc10
-rw-r--r--paludis/repositories/e/ebuild_id.cc9
-rw-r--r--ruby/package_id_TEST.rb2
3 files changed, 14 insertions, 7 deletions
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 30afac1..ca614ea 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -391,9 +391,13 @@ EInstalledRepositoryID::need_keys_added() const
if (! vars->properties()->name().empty())
if ((_imp->dir / vars->properties()->name()).stat().exists())
{
- _imp->keys->properties = std::make_shared<EPlainTextSpecKey>(_imp->environment, vars->properties(),
- eapi(), file_contents(_imp->dir / vars->properties()->name()), mkt_internal, is_installed());
- add_metadata_key(_imp->keys->properties);
+ std::string v(file_contents(_imp->dir / vars->properties()->name()));
+ if (! v.empty())
+ {
+ _imp->keys->properties = std::make_shared<EPlainTextSpecKey>(_imp->environment, vars->properties(),
+ eapi(), v, mkt_internal, is_installed());
+ add_metadata_key(_imp->keys->properties);
+ }
}
if (! vars->src_uri()->name().empty())
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index b48a9b6..17da030 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1026,9 +1026,12 @@ EbuildID::load_restrict(const std::shared_ptr<const EAPIMetadataVariable> & m, c
void
EbuildID::load_properties(const std::shared_ptr<const EAPIMetadataVariable> & m, const std::string & v) const
{
- Lock l(_imp->mutex);
- _imp->properties = std::make_shared<EPlainTextSpecKey>(_imp->environment, m, eapi(), v, mkt_internal, is_installed());
- add_metadata_key(_imp->properties);
+ if (! v.empty())
+ {
+ Lock l(_imp->mutex);
+ _imp->properties = std::make_shared<EPlainTextSpecKey>(_imp->environment, m, eapi(), v, mkt_internal, is_installed());
+ add_metadata_key(_imp->properties);
+ }
}
void
diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb
index 94dd74d..2c2e8d9 100644
--- a/ruby/package_id_TEST.rb
+++ b/ruby/package_id_TEST.rb
@@ -158,7 +158,7 @@ module Paludis
def test_each_metadata
keys = { "DESCRIPTION" => 1, "INHERITED" => 1, "KEYWORDS" => 1, "EAPI" => 1,
"DEPEND" => 1, "RDEPEND" => 1, "PDEPEND" => 1, "LICENSE" => 1, "PROVIDE" => 1,
- "RESTRICT" => 1, "SRC_URI" => 1, "HOMEPAGE" => 1, "EBUILD" => 1, "PROPERTIES" => 1, "IUSE" => 1,
+ "RESTRICT" => 1, "SRC_URI" => 1, "HOMEPAGE" => 1, "EBUILD" => 1, "IUSE" => 1,
"PALUDIS_CHOICES" => 1, "DEFINED_PHASES" => 1, "SLOT" => 1 }
pid_testrepo.each_metadata do | key |
assert keys.has_key?(key.raw_name), "no key #{key.raw_name} -> #{key.parse_value}"