aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-28 09:32:50 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-28 09:32:50 +0100
commit14cc30c06d3b3cba2819205aa9e43ef13ff0588f (patch)
tree11e88ad0100fde4cd4f6d9363b1760f872429c28
parent219d98ec313f033e8979876189e0cc35838f2880 (diff)
downloadpaludis-14cc30c06d3b3cba2819205aa9e43ef13ff0588f.tar.gz
paludis-14cc30c06d3b3cba2819205aa9e43ef13ff0588f.tar.xz
Make */*::foo-> fast again
-rw-r--r--paludis/repositories/e/ebuild_id.cc24
-rw-r--r--paludis/repositories/e/ebuild_id.hh2
2 files changed, 24 insertions, 2 deletions
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 542b42e..88be9dd 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -814,8 +814,13 @@ EbuildID::installed_time_key() const
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
EbuildID::from_repositories_key() const
{
- need_keys_added();
- return _imp->generated_from;
+ if (might_be_binary())
+ {
+ need_keys_added();
+ return _imp->generated_from;
+ }
+ else
+ return make_null_shared_ptr();
}
const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
@@ -1539,3 +1544,18 @@ EbuildID::purge_invalid_cache() const
}
}
+bool
+EbuildID::might_be_binary() const
+{
+ auto path(stringify(_imp->ebuild));
+ auto dot_pos(path.rfind('.'));
+
+ if (std::string::npos != dot_pos)
+ {
+ auto extension(path.substr(dot_pos + 1));
+ return 0 == extension.compare(0, 4, "pbin");
+ }
+ else
+ return false;
+}
+
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index e6cd418..2bd96f6 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -166,6 +166,8 @@ namespace paludis
virtual void add_build_options(const std::shared_ptr<Choices> &) const;
virtual void purge_invalid_cache() const;
+
+ bool might_be_binary() const;
};
}
}