aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-06-27 23:57:25 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-06-28 22:37:46 +0100
commitec191d1e2b6a0c0eff1cf8a939f49fa319b0aa98 (patch)
treeaa0b5ecac118142a4d53250fb0d7f78a94fb5ab0
parentbcbe58fb705dffdc4b857b95a46388b40e097908 (diff)
downloadpaludis-ec191d1e2b6a0c0eff1cf8a939f49fa319b0aa98.tar.gz
paludis-ec191d1e2b6a0c0eff1cf8a939f49fa319b0aa98.tar.xz
Boring API updates for ConfigFile changes (continued)
-rw-r--r--paludis/distribution.cc2
-rw-r--r--paludis/environments/paludis/paludis_config.cc48
-rw-r--r--paludis/environments/portage/portage_environment.cc82
-rw-r--r--paludis/ndbam.cc3
-rw-r--r--paludis/repositories/cran/description_file.cc15
-rw-r--r--paludis/repositories/cran/description_file.hh2
-rw-r--r--paludis/repositories/e/e_repository.cc10
-rw-r--r--paludis/repositories/e/e_repository_news.cc2
-rw-r--r--paludis/repositories/e/e_repository_profile.cc7
-rw-r--r--paludis/repositories/e/e_repository_profile_file.cc2
-rw-r--r--paludis/repositories/e/eapi.cc18
-rw-r--r--paludis/repositories/e/ebuild.cc5
-rw-r--r--paludis/repositories/e/ebuild_entries.cc2
-rw-r--r--paludis/repositories/e/make_ebuild_repository.cc4
-rw-r--r--paludis/repositories/e/qa/extractors.cc6
-rw-r--r--paludis/repositories/e/traditional_layout.cc2
-rw-r--r--paludis/repositories/e/use_desc.cc2
-rw-r--r--paludis/util/simple_parser.cc11
-rw-r--r--paludis/util/simple_parser.hh1
-rw-r--r--src/clients/reconcilio/broken_linkage_finder/configuration.cc6
-rw-r--r--src/clients/reconcilio/broken_linkage_finder/libtool_linkage_checker.cc3
21 files changed, 175 insertions, 58 deletions
diff --git a/paludis/distribution.cc b/paludis/distribution.cc
index 8e98cb0..5f9cb4a 100644
--- a/paludis/distribution.cc
+++ b/paludis/distribution.cc
@@ -62,7 +62,7 @@ namespace paludis
Context cc("When loading distribution file '" + stringify(*d) + "':");
- KeyValueConfigFile k(*d, KeyValueConfigFileOptions());
+ KeyValueConfigFile k(*d, KeyValueConfigFileOptions(), &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
values.insert(std::make_pair(strip_trailing_string(d->basename(), ".conf"),
make_shared_ptr(new Distribution(Distribution::named_create()
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index 408c434..3e571bd 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -74,6 +74,21 @@ template class WrappedForwardIterator<PaludisConfig::RepositoryConstIteratorTag,
#include <paludis/environments/paludis/use_config_entry-sr.cc>
#include <paludis/environments/paludis/repository_config_entry-sr.cc>
+namespace
+{
+ std::string predefined(
+ const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
+ const KeyValueConfigFile &,
+ const std::string & k)
+ {
+ const Map<std::string, std::string>::ConstIterator i(m->find(k));
+ if (m->end() != i)
+ return i->second;
+ else
+ return "";
+ }
+}
+
namespace paludis
{
/**
@@ -154,7 +169,9 @@ namespace paludis
std::tr1::shared_ptr<FSEntry> world_file;
if ((FSEntry(config_dir) / "environment.conf").exists())
- kv.reset(new KeyValueConfigFile(FSEntry(config_dir) / "environment.conf", KeyValueConfigFileOptions(), KeyValueConfigFile::Defaults(conf_vars)));
+ kv.reset(new KeyValueConfigFile(FSEntry(config_dir) / "environment.conf", KeyValueConfigFileOptions(),
+ std::tr1::bind(&predefined, conf_vars, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &KeyValueConfigFile::no_transformation));
else if ((FSEntry(config_dir) / "environment.bash").exists())
{
std::stringstream s;
@@ -164,7 +181,9 @@ namespace paludis
.with_stderr_prefix("environment.bash> ")
.with_captured_stdout_stream(&s));
int exit_status(run_command(cmd));
- kv.reset(new KeyValueConfigFile(s, KeyValueConfigFileOptions(), KeyValueConfigFile::Defaults(conf_vars)));
+ kv.reset(new KeyValueConfigFile(s, KeyValueConfigFileOptions(),
+ std::tr1::bind(&predefined, conf_vars, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &KeyValueConfigFile::no_transformation));
if (exit_status != 0)
{
@@ -179,7 +198,9 @@ namespace paludis
Log::get_instance()->message("paludis_environment.no_environment_conf", ll_debug, lc_context)
<< "No environment.conf or environment.bash in '" << config_dir << "'";
std::stringstream str;
- kv.reset(new KeyValueConfigFile(str, KeyValueConfigFileOptions(), KeyValueConfigFile::Defaults(conf_vars)));
+ kv.reset(new KeyValueConfigFile(str, KeyValueConfigFileOptions(),
+ std::tr1::bind(&predefined, conf_vars, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &KeyValueConfigFile::no_transformation));
}
if (! kv->get("reduced_username").empty())
@@ -267,10 +288,12 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
{
KeyValueConfigFile* specpath;
if ((local_config_dir / "specpath.conf").exists())
- specpath = new KeyValueConfigFile(local_config_dir / "specpath.conf", KeyValueConfigFileOptions());
+ specpath = new KeyValueConfigFile(local_config_dir / "specpath.conf", KeyValueConfigFileOptions(),
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
else
{
- specpath = new KeyValueConfigFile(local_config_dir / "specpath", KeyValueConfigFileOptions());
+ specpath = new KeyValueConfigFile(local_config_dir / "specpath", KeyValueConfigFileOptions(),
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
Log::get_instance()->message("paludis_environment.paludis_config.specpath.deprecated", ll_warning, lc_no_context)
<< "Using specpath is deprecated, use specpath.conf instead";
}
@@ -332,7 +355,8 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
if ((local_config_dir / "repository_defaults.conf").exists())
{
KeyValueConfigFile defaults_file(local_config_dir / "repository_defaults.conf", KeyValueConfigFileOptions(),
- KeyValueConfigFile::Defaults(conf_vars));
+ std::tr1::bind(&predefined, conf_vars, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &KeyValueConfigFile::no_transformation);
std::copy(defaults_file.begin(), defaults_file.end(), conf_vars->inserter());
}
else if ((local_config_dir / "repository_defaults.bash").exists())
@@ -344,7 +368,9 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
.with_stderr_prefix("repository_defaults.bash> ")
.with_captured_stdout_stream(&s));
int exit_status(run_command(cmd));
- KeyValueConfigFile defaults_file(s, KeyValueConfigFileOptions(), KeyValueConfigFile::Defaults(conf_vars));
+ KeyValueConfigFile defaults_file(s, KeyValueConfigFileOptions(),
+ std::tr1::bind(&predefined, conf_vars, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &KeyValueConfigFile::no_transformation);
std::copy(defaults_file.begin(), defaults_file.end(), conf_vars->inserter());
if (exit_status != 0)
Log::get_instance()->message("paludis_environment.repository_defaults.failure", ll_warning, lc_context)
@@ -384,7 +410,9 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
.with_stderr_prefix(repo_file->basename() + "> ")
.with_captured_stdout_stream(&s));
int exit_status(run_command(cmd));
- kv.reset(new KeyValueConfigFile(s, KeyValueConfigFileOptions(), KeyValueConfigFile::Defaults(conf_vars)));
+ kv.reset(new KeyValueConfigFile(s, KeyValueConfigFileOptions(),
+ std::tr1::bind(&predefined, conf_vars, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &KeyValueConfigFile::no_transformation));
if (exit_status != 0)
{
@@ -394,7 +422,9 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
}
}
else
- kv.reset(new KeyValueConfigFile(*repo_file, KeyValueConfigFileOptions(), KeyValueConfigFile::Defaults(conf_vars)));
+ kv.reset(new KeyValueConfigFile(*repo_file, KeyValueConfigFileOptions(),
+ std::tr1::bind(&predefined, conf_vars, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &KeyValueConfigFile::no_transformation));
if (! kv)
continue;
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 13ae9e4..0f677f8 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -163,26 +163,72 @@ namespace paludis
namespace
{
- bool is_incremental_excluding_use_expand(const std::string & s, const KeyValueConfigFile &)
+ bool is_incremental_excluding_use_expand(const KeyValueConfigFile &, const std::string & s)
{
return (s == "USE" || s == "USE_EXPAND" || s == "USE_EXPAND_HIDDEN" ||
s == "CONFIG_PROTECT" || s == "CONFIG_PROTECT_MASK" || s == "FEATURES"
|| s == "ACCEPT_KEYWORDS");
}
- bool is_incremental(const std::string & s, const KeyValueConfigFile & k)
+ bool is_incremental(const KeyValueConfigFile & k, const std::string & s)
{
- if (is_incremental_excluding_use_expand(s, k))
+ if (is_incremental_excluding_use_expand(k, s))
return true;
std::set<std::string> use_expand;
- tokenise_whitespace(k.get("USE_EXPAND"),
- std::inserter(use_expand, use_expand.begin()));
+ tokenise_whitespace(k.get("USE_EXPAND"), std::inserter(use_expand, use_expand.begin()));
if (use_expand.end() != use_expand.find(s))
return true;
return false;
}
+
+ std::string predefined(const std::tr1::shared_ptr<const KeyValueConfigFile> & k,
+ const KeyValueConfigFile &, const std::string & s)
+ {
+ return k->get(s);
+ }
+
+ std::string make_incremental(const KeyValueConfigFile &, const std::string &, const std::string & before, const std::string & value)
+ {
+ if (before.empty())
+ return value;
+
+ std::list<std::string> values;
+ std::set<std::string> new_values;
+ tokenise_whitespace(before, std::back_inserter(values));
+ tokenise_whitespace(value, std::back_inserter(values));
+
+ for (std::list<std::string>::const_iterator v(values.begin()), v_end(values.end()) ;
+ v != v_end ; ++v)
+ {
+ if (v->empty())
+ continue;
+ else if ("-*" == *v)
+ new_values.clear();
+ else if ('-' == v->at(0))
+ new_values.erase(v->substr(1));
+ else
+ new_values.insert(*v);
+ }
+
+ return join(new_values.begin(), new_values.end(), " ");
+ }
+
+ std::string do_incremental(const KeyValueConfigFile & k, const std::string & var, const std::string & before, const std::string & value)
+ {
+ if (! is_incremental(k, var))
+ return value;
+ return make_incremental(k, var, before, value);
+ }
+
+ std::string do_incremental_excluding_use_expand(
+ const KeyValueConfigFile & k, const std::string & var, const std::string & before, const std::string & value)
+ {
+ if (! is_incremental_excluding_use_expand(k, var))
+ return value;
+ return make_incremental(k, var, before, value);
+ }
}
PortageEnvironment::PortageEnvironment(const std::string & s) :
@@ -198,13 +244,19 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
"functionality. Full support for Portage configuration formats is not "
"guaranteed; issues should be reported via trac.";
- _imp->vars.reset(new KeyValueConfigFile(FSEntry("/dev/null"), KeyValueConfigFileOptions()));
+ _imp->vars.reset(new KeyValueConfigFile(FSEntry("/dev/null"), KeyValueConfigFileOptions(),
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation));
_load_profile((_imp->conf_dir / "make.profile").realpath());
if ((_imp->conf_dir / "make.globals").exists())
- _imp->vars.reset(new KeyValueConfigFile(_imp->conf_dir / "make.globals", KeyValueConfigFileOptions(), _imp->vars, &is_incremental));
+ _imp->vars.reset(new KeyValueConfigFile(_imp->conf_dir / "make.globals", KeyValueConfigFileOptions() +
+ kvcfo_allow_inline_comments,
+ std::tr1::bind(&predefined, _imp->vars, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &do_incremental));
if ((_imp->conf_dir / "make.conf").exists())
- _imp->vars.reset(new KeyValueConfigFile(_imp->conf_dir / "make.conf", KeyValueConfigFileOptions(), _imp->vars,
- &is_incremental_excluding_use_expand));
+ _imp->vars.reset(new KeyValueConfigFile(_imp->conf_dir / "make.conf", KeyValueConfigFileOptions() +
+ kvcfo_allow_inline_comments,
+ std::tr1::bind(&predefined, _imp->vars, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &do_incremental_excluding_use_expand));
/* TODO: load USE etc from env? */
@@ -265,7 +317,7 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
if ((_imp->conf_dir / "portage" / "mirrors").exists())
{
- LineConfigFile m(_imp->conf_dir / "portage" / "mirrors", LineConfigFileOptions());
+ LineConfigFile m(_imp->conf_dir / "portage" / "mirrors", LineConfigFileOptions() + lcfo_allow_inline_comments);
for (LineConfigFile::ConstIterator line(m.begin()), line_end(m.end()) ;
line != line_end ; ++line)
{
@@ -315,7 +367,7 @@ PortageEnvironment::_load_atom_file(const FSEntry & f, I_ i, const std::string &
}
else
{
- LineConfigFile file(f, LineConfigFileOptions());
+ LineConfigFile file(f, LineConfigFileOptions() + lcfo_allow_inline_comments);
for (LineConfigFile::ConstIterator line(file.begin()), line_end(file.end()) ;
line != line_end ; ++line)
{
@@ -368,7 +420,7 @@ PortageEnvironment::_load_lined_file(const FSEntry & f, I_ i)
}
else
{
- LineConfigFile file(f, LineConfigFileOptions());
+ LineConfigFile file(f, LineConfigFileOptions() + lcfo_allow_inline_comments);
for (LineConfigFile::ConstIterator line(file.begin()), line_end(file.end()) ;
line != line_end ; ++line)
*i++ = std::tr1::shared_ptr<PackageDepSpec>(new PackageDepSpec(
@@ -393,7 +445,11 @@ PortageEnvironment::_load_profile(const FSEntry & d)
}
if ((d / "make.defaults").exists())
- _imp->vars.reset(new KeyValueConfigFile(d / "make.defaults", KeyValueConfigFileOptions(), _imp->vars, &is_incremental));
+ _imp->vars.reset(new KeyValueConfigFile(d / "make.defaults", KeyValueConfigFileOptions()
+ + kvcfo_allow_inline_comments,
+ std::tr1::bind(&predefined, _imp->vars, std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &do_incremental));
+
}
void
diff --git a/paludis/ndbam.cc b/paludis/ndbam.cc
index 5578b3e..d00bde0 100644
--- a/paludis/ndbam.cc
+++ b/paludis/ndbam.cc
@@ -108,7 +108,8 @@ NDBAM::NDBAM(const FSEntry & l,
if ((l / "ndbam.conf").exists())
{
Context cc("When reading '" + stringify(l / "ndbam.conf") + "':");
- KeyValueConfigFile k(l / "ndbam.conf", KeyValueConfigFileOptions());
+ KeyValueConfigFile k(l / "ndbam.conf", KeyValueConfigFileOptions(), &KeyValueConfigFile::no_defaults,
+ &KeyValueConfigFile::no_transformation);
if (k.get("ndbam_format") != "1")
throw ConfigurationError("Unsupported NDBAM format '" + k.get("ndbam_format") + "'");
if (! check_format(k.get("repository_format")))
diff --git a/paludis/repositories/cran/description_file.cc b/paludis/repositories/cran/description_file.cc
index aaa1e02..a0ad9df 100644
--- a/paludis/repositories/cran/description_file.cc
+++ b/paludis/repositories/cran/description_file.cc
@@ -22,6 +22,7 @@
#include <paludis/util/log.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/stringify.hh>
+#include <sstream>
#include <istream>
#include <map>
@@ -37,17 +38,17 @@ namespace paludis
};
}
-DescriptionFile::DescriptionFile(const Source & s) :
- ConfigFile(s),
+DescriptionFile::DescriptionFile(const Source & sr) :
PrivateImplementationPattern<DescriptionFile>(new Implementation<DescriptionFile>)
{
- Context c("When parsing CRAN description file '" + s.filename() + "':");
+ Context c("When parsing CRAN description file '" + sr.filename() + "':");
- if (! s.stream())
- throw ConfigFileError(s.filename(), "Cannot read input");
+ std::istringstream s(sr.text());
+ if (! s)
+ throw ConfigFileError(sr.filename(), "Cannot read input");
std::string line, line_full;
- while (std::getline(s.stream(), line))
+ while (std::getline(s, line))
{
/* cran needs to be taken out and shot in the nuts for this... */
line = strip_trailing(line, "\r");
@@ -55,7 +56,7 @@ DescriptionFile::DescriptionFile(const Source & s) :
if ((! line.empty()) && (std::string::npos != std::string(" \t").find_first_of(line.at(0))))
{
if (line_full.empty())
- throw ConfigFileError(s.filename(), "Unexpected continuation");
+ throw ConfigFileError(sr.filename(), "Unexpected continuation");
line_full += " ";
line_full += strip_leading(strip_trailing(line, " \t"), " \t");
diff --git a/paludis/repositories/cran/description_file.hh b/paludis/repositories/cran/description_file.hh
index 1088ffb..f738804 100644
--- a/paludis/repositories/cran/description_file.hh
+++ b/paludis/repositories/cran/description_file.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index e6cc002..f031ece 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -138,7 +138,7 @@ namespace
std::set<std::string> info_pkgs;
if (_f.exists())
{
- LineConfigFile vars(_f, LineConfigFileOptions());
+ LineConfigFile vars(_f, LineConfigFileOptions() + lcfo_allow_inline_comments);
info_pkgs.insert(vars.begin(), vars.end());
}
@@ -389,7 +389,7 @@ namespace paludis
found_one = true;
- LineConfigFile f(*p, LineConfigFileOptions());
+ LineConfigFile f(*p, LineConfigFileOptions() + lcfo_allow_inline_comments);
for (LineConfigFile::ConstIterator line(f.begin()), line_end(f.end()) ; line != line_end ; ++line)
{
std::vector<std::string> tokens;
@@ -445,7 +445,7 @@ namespace
if (! name_file.is_regular_file())
break;
- LineConfigFile f(name_file, LineConfigFileOptions());
+ LineConfigFile f(name_file, LineConfigFileOptions() + lcfo_allow_inline_comments);
if (f.begin() == f.end())
break;
return RepositoryName(*f.begin());
@@ -756,7 +756,7 @@ ERepository::arch_flags() const
if (! p->exists())
continue;
- LineConfigFile archs(*p, LineConfigFileOptions());
+ LineConfigFile archs(*p, LineConfigFileOptions() + lcfo_allow_inline_comments);
std::copy(archs.begin(), archs.end(), create_inserter<UseFlagName>(_imp->arch_flags->inserter()));
found_one = true;
}
@@ -786,7 +786,7 @@ ERepository::need_mirrors() const
{
if (p->exists())
{
- LineConfigFile mirrors(*p, LineConfigFileOptions());
+ LineConfigFile mirrors(*p, LineConfigFileOptions() + lcfo_allow_inline_comments);
for (LineConfigFile::ConstIterator line(mirrors.begin()) ; line != mirrors.end() ; ++line)
{
std::vector<std::string> ee;
diff --git a/paludis/repositories/e/e_repository_news.cc b/paludis/repositories/e/e_repository_news.cc
index a285ff5..d61231c 100644
--- a/paludis/repositories/e/e_repository_news.cc
+++ b/paludis/repositories/e/e_repository_news.cc
@@ -105,7 +105,7 @@ ERepositoryNews::update_news() const
{
Context local_context("When handling news skip file '" + stringify(
_imp->skip_file) + "':");
- LineConfigFile s(_imp->skip_file, LineConfigFileOptions());
+ LineConfigFile s(_imp->skip_file, LineConfigFileOptions() + lcfo_allow_inline_comments);
std::copy(s.begin(), s.end(), std::inserter(skip, skip.end()));
}
diff --git a/paludis/repositories/e/e_repository_profile.cc b/paludis/repositories/e/e_repository_profile.cc
index 7aec5ea..e06841c 100644
--- a/paludis/repositories/e/e_repository_profile.cc
+++ b/paludis/repositories/e/e_repository_profile.cc
@@ -306,7 +306,8 @@ Implementation<ERepositoryProfile>::load_profile_make_defaults(const FSEntry & d
return;
KeyValueConfigFile file(dir / "make.defaults", KeyValueConfigFileOptions() +
- kvcfo_disallow_space_around_equals + kvcfo_disallow_space_inside_unquoted_values);
+ kvcfo_disallow_space_around_equals + kvcfo_disallow_space_inside_unquoted_values + kvcfo_allow_inline_comments,
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
for (KeyValueConfigFile::ConstIterator k(file.begin()), k_end(file.end()) ;
k != k_end ; ++k)
@@ -557,7 +558,7 @@ Implementation<ERepositoryProfile>::load_basic_use_file(const FSEntry & file, Fl
return;
Context context("When loading basic use file '" + stringify(file) + ":");
- LineConfigFile f(file, LineConfigFileOptions());
+ LineConfigFile f(file, LineConfigFileOptions() + lcfo_allow_inline_comments);
for (LineConfigFile::ConstIterator line(f.begin()), line_end(f.end()) ;
line != line_end ; ++line)
{
@@ -596,7 +597,7 @@ Implementation<ERepositoryProfile>::load_spec_use_file(const FSEntry & file, Pac
return;
Context context("When loading specised use file '" + stringify(file) + ":");
- LineConfigFile f(file, LineConfigFileOptions());
+ LineConfigFile f(file, LineConfigFileOptions() + lcfo_allow_inline_comments);
for (LineConfigFile::ConstIterator line(f.begin()), line_end(f.end()) ;
line != line_end ; ++line)
{
diff --git a/paludis/repositories/e/e_repository_profile_file.cc b/paludis/repositories/e/e_repository_profile_file.cc
index 88b95f5..06c08b7 100644
--- a/paludis/repositories/e/e_repository_profile_file.cc
+++ b/paludis/repositories/e/e_repository_profile_file.cc
@@ -97,7 +97,7 @@ ProfileFile<F_>::add_file(const FSEntry & f)
if (! f.exists())
return;
- F_ file(f, LineConfigFileOptions());
+ F_ file(f, LineConfigFileOptions() + lcfo_allow_inline_comments);
for (typename F_::ConstIterator line(file.begin()), line_end(file.end()) ; line != line_end ; ++line)
{
const std::string & key(FileEntryTraits<typename std::tr1::remove_const<typename std::tr1::remove_reference<
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index 568dd74..aa8a4b4 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -48,6 +48,17 @@ using namespace paludis::erepository;
template class InstantiationPolicy<EAPIData, instantiation_method::SingletonTag>;
+namespace
+{
+ std::string predefined(const std::string & d, const KeyValueConfigFile &, const std::string & v)
+ {
+ if (v == "PALUDIS_EAPIS_DIR")
+ return d;
+ else
+ return "";
+ }
+}
+
namespace paludis
{
template<>
@@ -66,10 +77,9 @@ namespace paludis
continue;
Context cc("When loading EAPI file '" + stringify(*d) + "':");
-
- std::tr1::shared_ptr<Map<std::string, std::string> > predefined(new Map<std::string, std::string>);
- predefined->insert("PALUDIS_EAPIS_DIR", stringify(d->dirname()));
- KeyValueConfigFile k(*d, KeyValueConfigFileOptions(), predefined);
+ KeyValueConfigFile k(*d, KeyValueConfigFileOptions(),
+ std::tr1::bind(&predefined, stringify(d->dirname()), std::tr1::placeholders::_1, std::tr1::placeholders::_2),
+ &KeyValueConfigFile::no_transformation);
ELikePackageDepSpecOptions package_dep_spec_parse_options;
{
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 0ac2194..eed8164 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -311,7 +311,8 @@ EbuildMetadataCommand::do_run_command(const Command & cmd)
std::stringstream input_stream(input);
KeyValueConfigFile f(input_stream, KeyValueConfigFileOptions() + kvcfo_disallow_continuations + kvcfo_disallow_comments
+ kvcfo_disallow_space_around_equals + kvcfo_disallow_unquoted_values + kvcfo_disallow_source
- + kvcfo_disallow_variables + kvcfo_preserve_whitespace);
+ + kvcfo_disallow_variables + kvcfo_preserve_whitespace,
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
std::copy(f.begin(), f.end(), keys->inserter());
if (0 == exit_status)
@@ -838,7 +839,7 @@ EbuildInfoCommand::extend_command(const Command & cmd)
std::string info_vars;
if (info_params[k::info_vars()].is_regular_file_or_symlink_to_regular_file())
{
- LineConfigFile info_vars_f(info_params[k::info_vars()], LineConfigFileOptions());
+ LineConfigFile info_vars_f(info_params[k::info_vars()], LineConfigFileOptions() + lcfo_allow_inline_comments);
info_vars = join(info_vars_f.begin(), info_vars_f.end(), " ");
}
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 135b66a..a01006b 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -72,7 +72,7 @@ namespace
Suffixes() :
file(FSEntry(getenv_with_default("PALUDIS_SUFFIXES_FILE", DATADIR "/paludis/ebuild_entries_suffixes.conf")),
- KeyValueConfigFileOptions())
+ KeyValueConfigFileOptions(), &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation)
{
}
diff --git a/paludis/repositories/e/make_ebuild_repository.cc b/paludis/repositories/e/make_ebuild_repository.cc
index d157c01..d7fccbd 100644
--- a/paludis/repositories/e/make_ebuild_repository.cc
+++ b/paludis/repositories/e/make_ebuild_repository.cc
@@ -51,8 +51,8 @@ paludis::make_ebuild_repository(
throw ERepositoryConfigurationError("Key 'location' not specified or empty");
std::tr1::shared_ptr<KeyValueConfigFile> layout_conf((FSEntry(location) / "metadata/layout.conf").exists() ?
- new KeyValueConfigFile(FSEntry(location) / "metadata/layout.conf",
- KeyValueConfigFileOptions())
+ new KeyValueConfigFile(FSEntry(location) / "metadata/layout.conf", KeyValueConfigFileOptions(),
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation)
: 0);
std::tr1::shared_ptr<const RepositoryName> master_repository_name;
diff --git a/paludis/repositories/e/qa/extractors.cc b/paludis/repositories/e/qa/extractors.cc
index c916b59..061faf1 100644
--- a/paludis/repositories/e/qa/extractors.cc
+++ b/paludis/repositories/e/qa/extractors.cc
@@ -52,7 +52,8 @@ namespace
{
try
{
- file.reset(new KeyValueConfigFile(f, KeyValueConfigFileOptions()));
+ file.reset(new KeyValueConfigFile(f, KeyValueConfigFileOptions(),
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation));
}
catch (const InternalError &)
{
@@ -63,7 +64,8 @@ namespace
Log::get_instance()->message("e.metadata_key.extractors.configuration_error", ll_warning, lc_context)
<< "Got error '" << e.message() << "' (" << e.what()
<< ") when loading extractors.conf for QA extractors_check";
- file.reset(new KeyValueConfigFile(std::string(), KeyValueConfigFileOptions()));
+ file.reset(new KeyValueConfigFile(std::string(), KeyValueConfigFileOptions(),
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation));
}
}
};
diff --git a/paludis/repositories/e/traditional_layout.cc b/paludis/repositories/e/traditional_layout.cc
index 92b6c34..c263f99 100644
--- a/paludis/repositories/e/traditional_layout.cc
+++ b/paludis/repositories/e/traditional_layout.cc
@@ -149,7 +149,7 @@ TraditionalLayout::need_category_names() const
if (! i->exists())
continue;
- LineConfigFile cats(*i, LineConfigFileOptions());
+ LineConfigFile cats(*i, LineConfigFileOptions() + lcfo_allow_inline_comments);
for (LineConfigFile::ConstIterator line(cats.begin()), line_end(cats.end()) ;
line != line_end ; ++line)
diff --git a/paludis/repositories/e/use_desc.cc b/paludis/repositories/e/use_desc.cc
index 6af2e13..f846f1c 100644
--- a/paludis/repositories/e/use_desc.cc
+++ b/paludis/repositories/e/use_desc.cc
@@ -44,7 +44,7 @@ namespace paludis
{
if (f.is_regular_file_or_symlink_to_regular_file())
{
- LineConfigFile ff(f, LineConfigFileOptions());
+ LineConfigFile ff(f, LineConfigFileOptions() + lcfo_allow_inline_comments);
for (LineConfigFile::ConstIterator line(ff.begin()), line_end(ff.end()) ;
line != line_end ; ++line)
{
diff --git a/paludis/util/simple_parser.cc b/paludis/util/simple_parser.cc
index c211154..ba2bded 100644
--- a/paludis/util/simple_parser.cc
+++ b/paludis/util/simple_parser.cc
@@ -264,5 +264,16 @@ SimpleParser::text() const
return _imp->text;
}
+unsigned
+SimpleParser::current_line_number() const
+{
+ unsigned line_number(1);
+ for (std::string::size_type p(0) ; p < _imp->offset ; ++p)
+ if (_imp->text[p] == '\n')
+ ++line_number;
+
+ return line_number;
+}
+
template struct PrivateImplementationPattern<SimpleParser>;
diff --git a/paludis/util/simple_parser.hh b/paludis/util/simple_parser.hh
index c0f7922..9dbf214 100644
--- a/paludis/util/simple_parser.hh
+++ b/paludis/util/simple_parser.hh
@@ -80,6 +80,7 @@ namespace paludis
bool eof() const PALUDIS_ATTRIBUTE((warn_unused_result));
std::string::size_type offset() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ unsigned current_line_number() const PALUDIS_ATTRIBUTE((warn_unused_result));
const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
diff --git a/src/clients/reconcilio/broken_linkage_finder/configuration.cc b/src/clients/reconcilio/broken_linkage_finder/configuration.cc
index c180681..a7c8753 100644
--- a/src/clients/reconcilio/broken_linkage_finder/configuration.cc
+++ b/src/clients/reconcilio/broken_linkage_finder/configuration.cc
@@ -206,7 +206,8 @@ Implementation<Configuration>::load_from_etc_revdep_rebuild(const FSEntry & root
if (it->is_regular_file_or_symlink_to_regular_file())
{
- KeyValueConfigFile kvs(*it, opts);
+ KeyValueConfigFile kvs(*it, opts,
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
std::tr1::function<std::string (const std::string &)> fromfile(
std::tr1::bind(&KeyValueConfigFile::get, std::tr1::cref(kvs), _1));
@@ -240,7 +241,8 @@ Implementation<Configuration>::load_from_etc_profile_env(const FSEntry & root)
opts += kvcfo_disallow_space_inside_unquoted_values;
opts += kvcfo_ignore_export;
- KeyValueConfigFile kvs(etc_profile_env, opts);
+ KeyValueConfigFile kvs(etc_profile_env, opts,
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
std::tr1::function<std::string (const std::string &)> fromfile(
std::tr1::bind(&KeyValueConfigFile::get, std::tr1::cref(kvs), _1));
diff --git a/src/clients/reconcilio/broken_linkage_finder/libtool_linkage_checker.cc b/src/clients/reconcilio/broken_linkage_finder/libtool_linkage_checker.cc
index 64d5aab..307b721 100644
--- a/src/clients/reconcilio/broken_linkage_finder/libtool_linkage_checker.cc
+++ b/src/clients/reconcilio/broken_linkage_finder/libtool_linkage_checker.cc
@@ -102,7 +102,8 @@ LibtoolLinkageChecker::check_file(const FSEntry & file)
try
{
- KeyValueConfigFile kvs(stream, opts);
+ KeyValueConfigFile kvs(stream, opts,
+ &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
tokenise_whitespace(kvs.get("dependency_libs"), std::back_inserter(deps));
}
catch (const ConfigFileError & ex)