aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/vdb_unmerger.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-29 21:47:08 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-03 21:20:26 +0100
commit77be16f5c2de2ebcd7ce78084755f83c522edc39 (patch)
tree7f46de7cf0f1cd9ec9cd2c4b342446cd0c4d567c /paludis/repositories/e/vdb_unmerger.cc
parent5c42e4800f4e6edd91dc6d8cdf54afb3d1fb34df (diff)
downloadpaludis-77be16f5c2de2ebcd7ce78084755f83c522edc39.tar.gz
paludis-77be16f5c2de2ebcd7ce78084755f83c522edc39.tar.xz
Kill kc. Breaks python.
Diffstat (limited to 'paludis/repositories/e/vdb_unmerger.cc')
-rw-r--r--paludis/repositories/e/vdb_unmerger.cc62
1 files changed, 32 insertions, 30 deletions
diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc
index a3130753c..bd40b2073 100644
--- a/paludis/repositories/e/vdb_unmerger.cc
+++ b/paludis/repositories/e/vdb_unmerger.cc
@@ -37,6 +37,7 @@ using namespace paludis;
#include <paludis/util/sequence.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/strip.hh>
+#include <paludis/util/make_named_values.hh>
#include <list>
#include <map>
@@ -57,8 +58,8 @@ namespace paludis
Implementation(const VDBUnmergerOptions & o) :
options(o)
{
- tokenise_whitespace(o[k::config_protect()], std::back_inserter(config_protect));
- tokenise_whitespace(o[k::config_protect_mask()], std::back_inserter(config_protect_mask));
+ tokenise_whitespace(o.config_protect(), std::back_inserter(config_protect));
+ tokenise_whitespace(o.config_protect_mask(), std::back_inserter(config_protect_mask));
}
};
}
@@ -116,9 +117,10 @@ class VDBUnmerger::MiscExtraInfo :
};
VDBUnmerger::VDBUnmerger(const VDBUnmergerOptions & o) :
- Unmerger(UnmergerOptions::named_create()
- (k::environment(), o[k::environment()])
- (k::root(), o[k::root()])),
+ Unmerger(make_named_values<UnmergerOptions>(
+ value_for<n::environment>(o.environment()),
+ value_for<n::root>(o.root())
+ )),
PrivateImplementationPattern<VDBUnmerger>(new Implementation<VDBUnmerger>(o)),
_imp(PrivateImplementationPattern<VDBUnmerger>::_imp.get())
{
@@ -131,29 +133,29 @@ VDBUnmerger::~VDBUnmerger()
Hook
VDBUnmerger::extend_hook(const Hook & h) const
{
- std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->options[k::environment()]->bashrc_files());
+ std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->options.environment()->bashrc_files());
Hook result(Unmerger::extend_hook(h)
- ("CONFIG_PROTECT", _imp->options[k::config_protect()])
- ("CONFIG_PROTECT_MASK", _imp->options[k::config_protect_mask()])
+ ("CONFIG_PROTECT", _imp->options.config_protect())
+ ("CONFIG_PROTECT_MASK", _imp->options.config_protect_mask())
("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " ")));
- if (_imp->options[k::package_id()])
+ if (_imp->options.package_id())
{
- std::string cat(stringify(_imp->options[k::package_id()]->name().category));
- std::string pn(stringify(_imp->options[k::package_id()]->name().package));
- std::string pvr(stringify(_imp->options[k::package_id()]->version()));
- std::string pv(stringify(_imp->options[k::package_id()]->version().remove_revision()));
+ std::string cat(stringify(_imp->options.package_id()->name().category));
+ std::string pn(stringify(_imp->options.package_id()->name().package));
+ std::string pvr(stringify(_imp->options.package_id()->version()));
+ std::string pv(stringify(_imp->options.package_id()->version().remove_revision()));
return result
("P", pn + "-" + pv)
("PN", pn)
("CATEGORY", cat)
- ("PR", _imp->options[k::package_id()]->version().revision_only())
+ ("PR", _imp->options.package_id()->version().revision_only())
("PV", pv)
("PVR", pvr)
("PF", pn + "-" + pvr)
- ("SLOT", stringify(_imp->options[k::package_id()]->slot()));
+ ("SLOT", stringify(_imp->options.package_id()->slot()));
}
return result;
@@ -187,7 +189,7 @@ VDBUnmerger::config_protected(const FSEntry & f) const
std::string
VDBUnmerger::make_tidy(const FSEntry & f) const
{
- std::string root_str(stringify(_imp->options[k::root()])), f_str(stringify(f));
+ std::string root_str(stringify(_imp->options.root())), f_str(stringify(f));
if (root_str == "/")
root_str.clear();
if (0 != f_str.compare(0, root_str.length(), root_str))
@@ -198,9 +200,9 @@ VDBUnmerger::make_tidy(const FSEntry & f) const
void
VDBUnmerger::populate_unmerge_set()
{
- std::ifstream c(stringify(_imp->options[k::contents_file()]).c_str());
+ std::ifstream c(stringify(_imp->options.contents_file()).c_str());
if (! c)
- throw VDBUnmergerError("Cannot read '" + stringify(_imp->options[k::contents_file()]) + "'");
+ throw VDBUnmergerError("Cannot read '" + stringify(_imp->options.contents_file()) + "'");
std::string line;
while (std::getline(c, line))
@@ -251,22 +253,22 @@ VDBUnmerger::check_file(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) c
{
std::tr1::shared_ptr<FileExtraInfo> fie(std::tr1::static_pointer_cast<FileExtraInfo>(ei));
- if (! (_imp->options[k::root()] / f).is_regular_file())
+ if (! (_imp->options.root() / f).is_regular_file())
display("--- [!type] " + stringify(f));
- else if ((_imp->options[k::root()] / f).mtime() != fie->_mtime)
+ else if ((_imp->options.root() / f).mtime() != fie->_mtime)
display("--- [!time] " + stringify(f));
else
{
- std::ifstream md5_file(stringify(_imp->options[k::root()] / f).c_str());
+ std::ifstream md5_file(stringify(_imp->options.root() / f).c_str());
if (! md5_file)
{
Log::get_instance()->message("e.vdb.contents.md5_failed", ll_warning, lc_no_context)
- << "Cannot get md5 for '" << (_imp->options[k::root()] / f) << "'";
+ << "Cannot get md5 for '" << (_imp->options.root() / f) << "'";
display("--- [!md5?] " + stringify(f));
}
else if (MD5(md5_file).hexsum() != fie->_md5sum)
display("--- [!md5 ] " + stringify(f));
- else if (config_protected(_imp->options[k::root()] / f))
+ else if (config_protected(_imp->options.root() / f))
display("--- [cfgpr] " + stringify(f));
else
return true;
@@ -280,11 +282,11 @@ VDBUnmerger::check_sym(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) co
{
std::tr1::shared_ptr<SymlinkExtraInfo> sie(std::tr1::static_pointer_cast<SymlinkExtraInfo>(ei));
- if (! (_imp->options[k::root()] / f).is_symbolic_link())
+ if (! (_imp->options.root() / f).is_symbolic_link())
display("--- [!type] " + stringify(f));
- else if ((_imp->options[k::root()] / f).mtime() != sie->_mtime)
+ else if ((_imp->options.root() / f).mtime() != sie->_mtime)
display("--- [!time] " + stringify(f));
- else if ((_imp->options[k::root()] / f).readlink() != sie->_dest)
+ else if ((_imp->options.root() / f).readlink() != sie->_dest)
display("--- [!dest] " + stringify(f));
else
return true;
@@ -297,9 +299,9 @@ VDBUnmerger::check_misc(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) c
{
std::tr1::shared_ptr<MiscExtraInfo> mie(std::tr1::static_pointer_cast<MiscExtraInfo>(ei));
- if ("fif" == mie->_type && ! (_imp->options[k::root()] / f).is_fifo())
+ if ("fif" == mie->_type && ! (_imp->options.root() / f).is_fifo())
display("--- [!type] " + stringify(f));
- else if ("dev" == mie->_type && ! (_imp->options[k::root()] / f).is_device())
+ else if ("dev" == mie->_type && ! (_imp->options.root() / f).is_device())
display("--- [!type] " + stringify(f));
else
return true;
@@ -310,9 +312,9 @@ VDBUnmerger::check_misc(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) c
bool
VDBUnmerger::check_dir(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
{
- if (! (_imp->options[k::root()] / f).is_directory())
+ if (! (_imp->options.root() / f).is_directory())
display("--- [!type] " + stringify(f));
- else if (DirIterator(_imp->options[k::root()] / f, DirIteratorOptions() + dio_include_dotfiles + dio_first_only) != DirIterator())
+ else if (DirIterator(_imp->options.root() / f, DirIteratorOptions() + dio_include_dotfiles + dio_first_only) != DirIterator())
display("--- [!empt] " + stringify(f));
else
return true;