aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-03-29 23:41:36 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-03-29 23:41:36 +0000
commit903ec5234dc88ef5e876f4476caa4c5ffed5bdb2 (patch)
tree113aa27e914604ed170d955893ffd5c3185cb0a4
parent4392e14471d0a7ecbcc6b54ff2e72b442424469d (diff)
downloadpaludis-903ec5234dc88ef5e876f4476caa4c5ffed5bdb2.tar.gz
paludis-903ec5234dc88ef5e876f4476caa4c5ffed5bdb2.tar.xz
Prepare for future changes.
-rw-r--r--paludis/repository_name_cache.cc21
-rw-r--r--paludis/repository_name_cache.hh8
2 files changed, 15 insertions, 14 deletions
diff --git a/paludis/repository_name_cache.cc b/paludis/repository_name_cache.cc
index 58499c0..049365f 100644
--- a/paludis/repository_name_cache.cc
+++ b/paludis/repository_name_cache.cc
@@ -44,6 +44,7 @@ namespace paludis
{
mutable Mutex mutex;
+ mutable bool usable;
mutable FSEntry location;
const Repository * const repo;
@@ -51,6 +52,7 @@ namespace paludis
mutable bool checked_name_cache_map;
Implementation(const FSEntry & l, const Repository * const r) :
+ usable(l != FSEntry("/var/empty")),
location(l == FSEntry("/var/empty") ? l : l / stringify(r->name())),
repo(r),
checked_name_cache_map(false)
@@ -63,8 +65,7 @@ RepositoryNameCache::RepositoryNameCache(
const FSEntry & location,
const Repository * const repo) :
PrivateImplementationPattern<RepositoryNameCache>(new Implementation<RepositoryNameCache>(
- location, repo)),
- _usable(_imp->location != FSEntry("/var/empty"))
+ location, repo))
{
}
@@ -77,7 +78,7 @@ RepositoryNameCache::category_names_containing_package(const PackageNamePart & p
{
Lock l(_imp->mutex);
- if (! usable())
+ if (! _imp->usable)
return tr1::shared_ptr<const CategoryNamePartSet>();
Context context("When using name cache at '" + stringify(_imp->location) + "':");
@@ -103,7 +104,7 @@ RepositoryNameCache::category_names_containing_package(const PackageNamePart & p
Log::get_instance()->message(ll_warning, lc_context, "Names cache for '" + stringify(_imp->repo->name())
+ "' has version string '" + line + "', which is not supported. Was it generated using "
"a different Paludis version?");
- _usable = false;
+ _imp->usable = false;
return tr1::shared_ptr<const CategoryNamePartSet>();
}
std::getline(vvf, line);
@@ -112,7 +113,7 @@ RepositoryNameCache::category_names_containing_package(const PackageNamePart & p
Log::get_instance()->message(ll_warning, lc_context, "Names cache for '" + stringify(_imp->repo->name())
+ "' was generated for repository '" + line + "', so it cannot be used. You must not "
"have multiple name caches at the same location.");
- _usable = false;
+ _imp->usable = false;
return tr1::shared_ptr<const CategoryNamePartSet>();
}
_imp->checked_name_cache_map = true;
@@ -125,7 +126,7 @@ RepositoryNameCache::category_names_containing_package(const PackageNamePart & p
"older than 0.18.0. The names cache now automatically appends the repository name to the "
"directory. You probably want to manually remove '" + stringify(_imp->location.dirname()) +
"' and then regenerate the cache.");
- _usable = false;
+ _imp->usable = false;
return tr1::shared_ptr<const CategoryNamePartSet>();
}
else
@@ -133,7 +134,7 @@ RepositoryNameCache::category_names_containing_package(const PackageNamePart & p
Log::get_instance()->message(ll_warning, lc_context, "Names cache for '" + stringify(_imp->repo->name())
+ "' has no version information, so cannot be used. Either it was generated using "
"an older Paludis version or it has not yet been generated.");
- _usable = false;
+ _imp->usable = false;
return tr1::shared_ptr<const CategoryNamePartSet>();
}
}
@@ -211,3 +212,9 @@ RepositoryNameCache::regenerate_cache() const
+ stringify(_imp->location) + "'");
}
+bool
+RepositoryNameCache::usable() const
+{
+ return _imp->usable;
+}
+
diff --git a/paludis/repository_name_cache.hh b/paludis/repository_name_cache.hh
index c4ed067..3bc646c 100644
--- a/paludis/repository_name_cache.hh
+++ b/paludis/repository_name_cache.hh
@@ -50,9 +50,6 @@ namespace paludis
class PALUDIS_VISIBLE RepositoryNameCache :
private PrivateImplementationPattern<RepositoryNameCache>
{
- private:
- mutable bool _usable;
-
public:
///\name Basic operations
///\{
@@ -85,10 +82,7 @@ namespace paludis
* Initially this will be true. After the first query the value may
* change to false (the query will return a zero pointer too).
*/
- bool usable() const PALUDIS_ATTRIBUTE((nothrow))
- {
- return _usable;
- }
+ bool usable() const PALUDIS_ATTRIBUTE((nothrow));
/**
* Implement cache regeneration.