aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-23 13:44:31 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-23 13:44:31 +0000
commitee5032373994997fac9678329908eda15347ce82 (patch)
treea0e8279ad0da48e19e8fb88d0c473ebeaa9bb8f2
parent69ad7328b35018a6a4f98da84265402f3bbd2cba (diff)
downloadpaludis-ee5032373994997fac9678329908eda15347ce82.tar.gz
paludis-ee5032373994997fac9678329908eda15347ce82.tar.xz
Write cache under a subdirectory named for the repository. Support write cache in NoConfigEnvironment, QAEnvironment. Add --write-cache-dir to qualudis and adjutrix.
-rw-r--r--paludis/environment/no_config/no_config_environment.cc4
-rw-r--r--paludis/environment/no_config/no_config_environment.sr1
-rw-r--r--paludis/qa/qa_environment.cc12
-rw-r--r--paludis/qa/qa_environment.hh6
-rw-r--r--paludis/repositories/portage/ebuild_entries.cc1
-rw-r--r--paludis/repositories/portage/ebuild_flat_metadata_cache.cc1
-rw-r--r--src/adjutrix/adjutrix.cc4
-rw-r--r--src/adjutrix/command_line.cc7
-rw-r--r--src/adjutrix/command_line.hh8
-rw-r--r--src/qualudis/qualudis.cc11
-rw-r--r--src/qualudis/qualudis_command_line.cc7
-rw-r--r--src/qualudis/qualudis_command_line.hh9
12 files changed, 58 insertions, 13 deletions
diff --git a/paludis/environment/no_config/no_config_environment.cc b/paludis/environment/no_config/no_config_environment.cc
index 7dbc3ab..313f630 100644
--- a/paludis/environment/no_config/no_config_environment.cc
+++ b/paludis/environment/no_config/no_config_environment.cc
@@ -37,6 +37,7 @@ namespace paludis
InternalCounted<Implementation<NoConfigEnvironment> >
{
const FSEntry top_level_dir;
+ const FSEntry write_cache;
bool accept_unstable;
bool is_vdb;
std::set<KeywordName> accepted_keywords;
@@ -108,6 +109,7 @@ namespace
Implementation<NoConfigEnvironment>::Implementation(
Environment * const env, const NoConfigEnvironmentParams & params) :
top_level_dir(params.repository_dir),
+ write_cache(params.write_cache),
accept_unstable(params.accept_unstable),
is_vdb(is_vdb_repository(params.repository_dir, params.repository_type)),
vdb_db(is_vdb ? new PackageDatabase(env) : 0)
@@ -162,6 +164,7 @@ Implementation<NoConfigEnvironment>::Implementation(
keys->insert("format", "portage");
keys->insert("location", stringify(params.repository_dir));
keys->insert("profiles", stringify(p->path));
+ keys->insert("write_cache", stringify(params.write_cache));
p->db->add_repository(RepositoryMaker::get_instance()->find_maker("portage")(env,
p->db.raw_pointer(), keys));
@@ -251,6 +254,7 @@ NoConfigEnvironment::set_profile(const FSEntry & location)
keys->insert("format", "portage");
keys->insert("location", stringify(_imp->top_level_dir));
keys->insert("profiles", stringify(location));
+ keys->insert("write_cache", stringify(_imp->write_cache));
PortageRepository::Pointer p(RepositoryMaker::get_instance()->find_maker("portage")(this,
db.raw_pointer(), keys));
diff --git a/paludis/environment/no_config/no_config_environment.sr b/paludis/environment/no_config/no_config_environment.sr
index 4a2fb3c..ff86654 100644
--- a/paludis/environment/no_config/no_config_environment.sr
+++ b/paludis/environment/no_config/no_config_environment.sr
@@ -4,6 +4,7 @@
make_class_NoConfigEnvironmentParams()
{
key repository_dir "FSEntry"
+ key write_cache "FSEntry"
key accept_unstable bool
key repository_type NoConfigEnvironmentRepositoryType
allow_named_args
diff --git a/paludis/qa/qa_environment.cc b/paludis/qa/qa_environment.cc
index 4f42b31..a2ba5cf 100644
--- a/paludis/qa/qa_environment.cc
+++ b/paludis/qa/qa_environment.cc
@@ -43,7 +43,7 @@ namespace paludis
{
std::vector<PackageDatabasesEntry> package_databases;
- Implementation(const FSEntry & base, const Environment * const env)
+ Implementation(const FSEntry & base, const FSEntry & write_cache, const Environment * const env)
{
Context context("When creating package databases from profiles.desc under '"
+ stringify(base / "profiles") + "':");
@@ -73,6 +73,7 @@ namespace paludis
keys->insert("location", stringify(base));
keys->insert("cache", "/var/empty");
keys->insert("profiles", stringify(base / "profiles" / tokens.at(1)));
+ keys->insert("write_cache", stringify(write_cache));
db->add_repository(RepositoryMaker::get_instance()->find_maker("portage")(env,
db.raw_pointer(), keys));
@@ -95,8 +96,9 @@ namespace paludis
};
}
-QAEnvironmentBase::QAEnvironmentBase(const FSEntry & b, const Environment * const env) :
- PrivateImplementationPattern<QAEnvironmentBase>(new Implementation<QAEnvironmentBase>(b, env))
+QAEnvironmentBase::QAEnvironmentBase(const FSEntry & b,
+ const FSEntry & w, const Environment * const env) :
+ PrivateImplementationPattern<QAEnvironmentBase>(new Implementation<QAEnvironmentBase>(b, w, env))
{
}
@@ -104,8 +106,8 @@ QAEnvironmentBase::~QAEnvironmentBase()
{
}
-QAEnvironment::QAEnvironment(const FSEntry & base) :
- QAEnvironmentBase(base, this),
+QAEnvironment::QAEnvironment(const FSEntry & base, const FSEntry & write_cache) :
+ QAEnvironmentBase(base, write_cache, this),
Environment(_imp->package_databases.begin()->package_database)
{
}
diff --git a/paludis/qa/qa_environment.hh b/paludis/qa/qa_environment.hh
index 44e43ca..b2aa381 100644
--- a/paludis/qa/qa_environment.hh
+++ b/paludis/qa/qa_environment.hh
@@ -44,7 +44,8 @@ namespace paludis
friend class QAEnvironment;
protected:
- QAEnvironmentBase(const FSEntry & base, const Environment * const env);
+ QAEnvironmentBase(const FSEntry & base, const FSEntry & write_cache,
+ const Environment * const env);
~QAEnvironmentBase();
};
@@ -57,7 +58,8 @@ namespace paludis
public Environment
{
public:
- QAEnvironment(const FSEntry & base);
+ QAEnvironment(const FSEntry & base,
+ const FSEntry & write_cache = FSEntry("/var/empty"));
~QAEnvironment();
diff --git a/paludis/repositories/portage/ebuild_entries.cc b/paludis/repositories/portage/ebuild_entries.cc
index 4acb081..5beaa96 100644
--- a/paludis/repositories/portage/ebuild_entries.cc
+++ b/paludis/repositories/portage/ebuild_entries.cc
@@ -99,6 +99,7 @@ EbuildEntries::generate_version_metadata(const QualifiedPackageName & q,
cache_file /= stringify(q.package) + "-" + stringify(v);
FSEntry write_cache_file(_imp->params.write_cache);
+ write_cache_file /= stringify(_imp->portage_repository->name());
write_cache_file /= stringify(q.category);
write_cache_file /= stringify(q.package) + "-" + stringify(v);
diff --git a/paludis/repositories/portage/ebuild_flat_metadata_cache.cc b/paludis/repositories/portage/ebuild_flat_metadata_cache.cc
index 050a926..a377e64 100644
--- a/paludis/repositories/portage/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/portage/ebuild_flat_metadata_cache.cc
@@ -115,6 +115,7 @@ EbuildFlatMetadataCache::save(VersionMetadata::ConstPointer v)
{
Context context("When saving version metadata to '" + stringify(_filename) + "':");
+ _filename.dirname().dirname().mkdir();
_filename.dirname().mkdir();
std::ofstream cache(stringify(_filename).c_str());
diff --git a/src/adjutrix/adjutrix.cc b/src/adjutrix/adjutrix.cc
index 4aebee8..4fbfd54 100644
--- a/src/adjutrix/adjutrix.cc
+++ b/src/adjutrix/adjutrix.cc
@@ -145,8 +145,12 @@ main(int argc, char *argv[])
))
throw DoHelp("you should specify exactly one action");
+ if (! CommandLine::get_instance()->a_write_cache_dir.specified())
+ CommandLine::get_instance()->a_write_cache_dir.set_argument("/var/empty");
+
NoConfigEnvironment env(NoConfigEnvironmentParams::create()
.repository_dir(get_location_and_add_filters())
+ .write_cache(CommandLine::get_instance()->a_write_cache_dir.argument())
.accept_unstable(CommandLine::get_instance()->a_unstable.specified())
.repository_type(
(CommandLine::get_instance()->a_reverse_deps.specified()) ? ncer_auto : ncer_portage
diff --git a/src/adjutrix/command_line.cc b/src/adjutrix/command_line.cc
index 6f1276e..2aea616 100644
--- a/src/adjutrix/command_line.cc
+++ b/src/adjutrix/command_line.cc
@@ -82,7 +82,12 @@ CommandLine::CommandLine() :
a_profile(&profile_args, "profile", 'p',
"Display results for this profile path, rather than all profiles (may be specified multiple times)"),
a_unstable(&profile_args, "unstable", 'U',
- "Accept ~arch as well as arch")
+ "Accept ~arch as well as arch"),
+
+ configuration_options(this, "Configuration options",
+ "Options that control general configuration."),
+ a_write_cache_dir(&configuration_options, "write-cache-dir", '\0',
+ "Use a subdirectory named for the repository name under the specified directory for repository write cache")
{
add_usage_line("--find-stable-candidates arch [ --repository-dir /path ] "
"[ --category app-misc --category sys-apps ... ] "
diff --git a/src/adjutrix/command_line.hh b/src/adjutrix/command_line.hh
index 7414728..8efd519 100644
--- a/src/adjutrix/command_line.hh
+++ b/src/adjutrix/command_line.hh
@@ -108,6 +108,14 @@ class CommandLine :
///\}
+ ///\name Configuration options
+ ///\{
+
+ paludis::args::ArgsGroup configuration_options;
+
+ paludis::args::StringArg a_write_cache_dir;
+
+ ///\}
};
/**
diff --git a/src/qualudis/qualudis.cc b/src/qualudis/qualudis.cc
index 2006ee6..0d4a168 100644
--- a/src/qualudis/qualudis.cc
+++ b/src/qualudis/qualudis.cc
@@ -407,7 +407,7 @@ namespace
set_entry_heading("QA checks for top level directory " + stringify(dir) + ":");
- qa::QAEnvironment env(dir);
+ qa::QAEnvironment env(dir, QualudisCommandLine::get_instance()->a_write_cache_dir.argument());
bool ok(true);
for (DirIterator d(dir) ; d != DirIterator() ; ++d)
@@ -435,14 +435,14 @@ namespace
if (dir.basename() == "eclass" && dir.is_directory())
{
- qa::QAEnvironment env(dir.dirname());
+ qa::QAEnvironment env(dir.dirname(), QualudisCommandLine::get_instance()->a_write_cache_dir.argument());
return do_check_eclass_dir(dir, env);
}
else if (std::count_if(DirIterator(dir), DirIterator(), IsFileWithExtension(
dir.basename() + "-", ".ebuild")))
{
- qa::QAEnvironment env(dir.dirname().dirname());
+ qa::QAEnvironment env(dir.dirname().dirname(), QualudisCommandLine::get_instance()->a_write_cache_dir.argument());
return do_check_package_dir(dir, env);
}
@@ -451,7 +451,7 @@ namespace
else if ((dir.dirname() / "profiles").is_directory())
{
- qa::QAEnvironment env(dir.dirname());
+ qa::QAEnvironment env(dir.dirname(), QualudisCommandLine::get_instance()->a_write_cache_dir.argument());
return do_check_category_dir(dir, env);
}
@@ -535,6 +535,9 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;
}
+ if (! QualudisCommandLine::get_instance()->a_write_cache_dir.specified())
+ QualudisCommandLine::get_instance()->a_write_cache_dir.set_argument("/var/empty");
+
if (! QualudisCommandLine::get_instance()->empty())
{
QualudisCommandLine *c1 = QualudisCommandLine::get_instance();
diff --git a/src/qualudis/qualudis_command_line.cc b/src/qualudis/qualudis_command_line.cc
index 0363ecb..3e7694a 100644
--- a/src/qualudis/qualudis_command_line.cc
+++ b/src/qualudis/qualudis_command_line.cc
@@ -50,7 +50,12 @@ QualudisCommandLine::QualudisCommandLine() :
("fatal", "Show only fatals"),
"info"),
- message_level(paludis::qa::qal_info)
+ message_level(paludis::qa::qal_info),
+
+ configuration_options(this, "Configuration options",
+ "Options that control general configuration."),
+ a_write_cache_dir(&configuration_options, "write-cache-dir", '\0',
+ "Use a subdirectory named for the repository name under the specified directory for repository write cache")
{
add_usage_line("[ options ] [ directories ... ]");
add_environment_variable("QUALUDIS_OPTIONS", "Default command-line options.");
diff --git a/src/qualudis/qualudis_command_line.hh b/src/qualudis/qualudis_command_line.hh
index e16f3d2..630f8ca 100644
--- a/src/qualudis/qualudis_command_line.hh
+++ b/src/qualudis/qualudis_command_line.hh
@@ -71,6 +71,15 @@ class QualudisCommandLine :
paludis::qa::QALevel message_level;
///\}
+
+ ///\name Configuration options
+ ///\{
+
+ paludis::args::ArgsGroup configuration_options;
+
+ paludis::args::StringArg a_write_cache_dir;
+
+ ///\}
};