aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-24 04:00:21 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-24 04:00:21 +0000
commit440320262bbf63701a9fbe9b5dab51a91fd0078d (patch)
tree511df0a19b00d6fcc01f95aa29002bbee557ce05
parentedc933d9af3d9b7ddcc36411cda54179ba54a3d3 (diff)
downloadpaludis-440320262bbf63701a9fbe9b5dab51a91fd0078d.tar.gz
paludis-440320262bbf63701a9fbe9b5dab51a91fd0078d.tar.xz
Make the cache location an optional config parameter for portage repositories
-rw-r--r--paludis/default_config.cc7
-rw-r--r--paludis/default_config.hh4
-rw-r--r--paludis/default_environment.cc2
-rw-r--r--paludis/portage_repository.cc19
-rw-r--r--paludis/portage_repository.hh3
5 files changed, 24 insertions, 11 deletions
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index 842ddf7..f751a0f 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -98,7 +98,12 @@ DefaultConfig::DefaultConfig()
}
_repos.push_back(RepositoryConfigEntry(k.get("location"),
- k.get("profile"), k.get("format"), importance));
+ k.get("profile"),
+ (k.get("cache").empty() ?
+ FSEntry(k.get("location")) / "metadata" / "cache" :
+ FSEntry(k.get("cache"))),
+ k.get("format"),
+ importance));
}
if (_repos.empty())
diff --git a/paludis/default_config.hh b/paludis/default_config.hh
index 417cb07..ce25fce 100644
--- a/paludis/default_config.hh
+++ b/paludis/default_config.hh
@@ -58,6 +58,7 @@ namespace paludis
{
rce_location, ///< Our location, for example on disk
rce_profile, ///< Our profile's location
+ rce_cache, ///< Our cache location
rce_format, ///< Our format, for example 'portage'
rce_importance ///< Our importance, higher being more important
};
@@ -68,9 +69,10 @@ namespace paludis
struct RepositoryConfigEntryTag :
SmartRecordTag<comparison_mode::FullComparisonTag,
comparison_method::SmartRecordCompareByKeyTag<rce_importance> >,
- SmartRecordKeys<RepositoryConfigEntryKeys, 4>,
+ SmartRecordKeys<RepositoryConfigEntryKeys, 5>,
SmartRecordKey<rce_location, FSEntry>,
SmartRecordKey<rce_profile, FSEntry>,
+ SmartRecordKey<rce_cache, FSEntry>,
SmartRecordKey<rce_format, std::string>,
SmartRecordKey<rce_importance, unsigned>
{
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index 58d732f..fd798e0 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -41,7 +41,7 @@ DefaultEnvironment::DefaultEnvironment() :
if (r->get<rce_format>() != "portage")
throw DefaultConfigError("Unknown repository format '" + r->get<rce_format>() + "'");
Repository::Pointer repo(new PortageRepository(package_database().raw_pointer(),
- r->get<rce_location>(), r->get<rce_profile>()));
+ r->get<rce_location>(), r->get<rce_profile>(), r->get<rce_cache>()));
package_database()->add_repository(repo);
}
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index b11af14..f13df72 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -58,6 +58,9 @@ namespace paludis
/// Our profile.
FSEntry profile;
+ /// Our cache.
+ FSEntry cache;
+
/// Have we loaded our category names?
mutable bool has_category_names;
@@ -94,7 +97,8 @@ namespace paludis
mutable bool has_profile;
/// Constructor.
- Implementation(const PackageDatabase * const d, const FSEntry & l, const FSEntry & p);
+ Implementation(const PackageDatabase * const d, const FSEntry & l, const FSEntry & p,
+ const FSEntry & c);
/// Destructor.
~Implementation();
@@ -105,10 +109,11 @@ namespace paludis
}
Implementation<PortageRepository>::Implementation(const PackageDatabase * const d,
- const FSEntry & l, const FSEntry & p) :
+ const FSEntry & l, const FSEntry & p, const FSEntry & c) :
db(d),
location(l),
profile(p),
+ cache(c),
has_category_names(false),
has_repo_mask(false),
has_profile(false)
@@ -190,13 +195,15 @@ Implementation<PortageRepository>::add_profile(const FSEntry & f) const
}
PortageRepository::PortageRepository(const PackageDatabase * const d,
- const FSEntry & location, const FSEntry & profile) :
+ const FSEntry & location, const FSEntry & profile,
+ const FSEntry & cache) :
Repository(PortageRepository::fetch_repo_name(location)),
PrivateImplementationPattern<PortageRepository>(new Implementation<PortageRepository>(
- d, location, profile))
+ d, location, profile, cache))
{
_info.insert(std::make_pair("location", location));
_info.insert(std::make_pair("profile", profile));
+ _info.insert(std::make_pair("cache", cache));
_info.insert(std::make_pair("format", "portage"));
}
@@ -419,9 +426,7 @@ PortageRepository::do_version_metadata(
VersionMetadata::Pointer result(new VersionMetadata);
- FSEntry cache_file(_implementation->location);
- cache_file /= "metadata";
- cache_file /= "cache";
+ FSEntry cache_file(_implementation->cache);
cache_file /= stringify(c);
cache_file /= stringify(p) + "-" + stringify(v);
diff --git a/paludis/portage_repository.hh b/paludis/portage_repository.hh
index c6add2f..8face69 100644
--- a/paludis/portage_repository.hh
+++ b/paludis/portage_repository.hh
@@ -85,7 +85,8 @@ namespace paludis
* Constructor.
*/
PortageRepository(const PackageDatabase * const db,
- const FSEntry & location, const FSEntry & profile);
+ const FSEntry & location, const FSEntry & profile,
+ const FSEntry & cache);
/**
* Destructor.