aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-04-17 18:25:28 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-04-17 18:25:28 +0000
commit549705408bc3cf99b8c4f210a07e3862e7dccbfb (patch)
tree94b693c6779108e41c60ec79fd45e036fea57ad8
parentc3af10b1593a472aacd141cb3aa6143c79d92da2 (diff)
downloadpaludis-549705408bc3cf99b8c4f210a07e3862e7dccbfb.tar.gz
paludis-549705408bc3cf99b8c4f210a07e3862e7dccbfb.tar.xz
More sr -> kc
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/ndbam_unmerger.cc54
-rw-r--r--paludis/ndbam_unmerger.hh13
-rw-r--r--paludis/ndbam_unmerger.sr19
-rw-r--r--paludis/repositories/e/exndbam_repository.cc16
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc16
-rw-r--r--paludis/util/keys.hh1
7 files changed, 55 insertions, 66 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4
index 423d179..2e9ad5a 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -43,7 +43,7 @@ add(`metadata_key_holder', `hh', `cc', `fwd')
add(`name', `hh', `cc', `fwd', `test', `sr', `se')
add(`ndbam', `hh', `cc', `fwd')
add(`ndbam_merger', `hh', `cc')
-add(`ndbam_unmerger', `hh', `cc', `sr')
+add(`ndbam_unmerger', `hh', `cc')
add(`override_functions', `hh', `cc')
add(`package_database', `hh', `cc', `fwd', `test', `se')
add(`package_id', `hh', `cc', `fwd', `se')
diff --git a/paludis/ndbam_unmerger.cc b/paludis/ndbam_unmerger.cc
index d7de7cb..dbaa00e 100644
--- a/paludis/ndbam_unmerger.cc
+++ b/paludis/ndbam_unmerger.cc
@@ -46,8 +46,6 @@
using namespace paludis;
-#include <paludis/ndbam_unmerger-sr.cc>
-
namespace paludis
{
template<>
@@ -61,8 +59,8 @@ namespace paludis
Implementation(const NDBAMUnmergerOptions & o) :
options(o)
{
- tokenise_whitespace(o.config_protect, std::back_inserter(config_protect));
- tokenise_whitespace(o.config_protect_mask, std::back_inserter(config_protect_mask));
+ tokenise_whitespace(o[k::config_protect()], std::back_inserter(config_protect));
+ tokenise_whitespace(o[k::config_protect_mask()], std::back_inserter(config_protect_mask));
}
};
}
@@ -105,8 +103,8 @@ class NDBAMUnmerger::SymlinkExtraInfo :
NDBAMUnmerger::NDBAMUnmerger(const NDBAMUnmergerOptions & o) :
Unmerger(UnmergerOptions::named_create()
- (k::environment(), o.environment)
- (k::root(), o.root)),
+ (k::environment(), o[k::environment()])
+ (k::root(), o[k::root()])),
PrivateImplementationPattern<NDBAMUnmerger>(new Implementation<NDBAMUnmerger>(o)),
_imp(PrivateImplementationPattern<NDBAMUnmerger>::_imp.get())
{
@@ -119,29 +117,29 @@ NDBAMUnmerger::~NDBAMUnmerger()
Hook
NDBAMUnmerger::extend_hook(const Hook & h) const
{
- tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->options.environment->bashrc_files());
+ tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->options[k::environment()]->bashrc_files());
Hook result(Unmerger::extend_hook(h)
- ("CONFIG_PROTECT", _imp->options.config_protect)
- ("CONFIG_PROTECT_MASK", _imp->options.config_protect_mask)
+ ("CONFIG_PROTECT", _imp->options[k::config_protect()])
+ ("CONFIG_PROTECT_MASK", _imp->options[k::config_protect_mask()])
("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " ")));
- if (_imp->options.package_id)
+ if (_imp->options[k::package_id()])
{
- 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()));
+ 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()));
return result
("P", pn + "-" + pv)
("PN", pn)
("CATEGORY", cat)
- ("PR", _imp->options.package_id->version().revision_only())
+ ("PR", _imp->options[k::package_id()]->version().revision_only())
("PV", pv)
("PVR", pvr)
("PF", pn + "-" + pvr)
- ("SLOT", stringify(_imp->options.package_id->slot()));
+ ("SLOT", stringify(_imp->options[k::package_id()]->slot()));
}
return result;
@@ -175,7 +173,7 @@ NDBAMUnmerger::config_protected(const FSEntry & f) const
std::string
NDBAMUnmerger::make_tidy(const FSEntry & f) const
{
- std::string root_str(stringify(_imp->options.root)), f_str(stringify(f));
+ std::string root_str(stringify(_imp->options[k::root()])), f_str(stringify(f));
if (root_str == "/")
root_str.clear();
if (0 != f_str.compare(0, root_str.length(), root_str))
@@ -205,7 +203,7 @@ void
NDBAMUnmerger::populate_unmerge_set()
{
using namespace tr1::placeholders;
- _imp->options.ndbam->parse_contents(*_imp->options.package_id,
+ _imp->options[k::ndbam()]->parse_contents(*_imp->options[k::package_id()],
tr1::bind(&NDBAMUnmerger::_add_file, this, _1, _2, _3),
tr1::bind(&NDBAMUnmerger::_add_dir, this, _1),
tr1::bind(&NDBAMUnmerger::_add_sym, this, _1, _2, _3)
@@ -217,22 +215,22 @@ NDBAMUnmerger::check_file(const FSEntry & f, tr1::shared_ptr<ExtraInfo> ei) cons
{
tr1::shared_ptr<FileExtraInfo> fie(tr1::static_pointer_cast<FileExtraInfo>(ei));
- if (! (_imp->options.root / f).is_regular_file())
+ if (! (_imp->options[k::root()] / f).is_regular_file())
display("--- [!type] " + stringify(f));
- else if ((_imp->options.root / f).mtime() != fie->_mtime)
+ else if ((_imp->options[k::root()] / f).mtime() != fie->_mtime)
display("--- [!time] " + stringify(f));
else
{
- std::ifstream md5_file(stringify(_imp->options.root / f).c_str());
+ std::ifstream md5_file(stringify(_imp->options[k::root()] / f).c_str());
if (! md5_file)
{
Log::get_instance()->message("ndbam.unmerger.md5_failed", ll_warning, lc_no_context) << "Cannot get md5 for '" <<
- (_imp->options.root / f) << "'";
+ (_imp->options[k::root()] / f) << "'";
display("--- [!md5?] " + stringify(f));
}
else if (MD5(md5_file).hexsum() != fie->_md5sum)
display("--- [!md5 ] " + stringify(f));
- else if (config_protected(_imp->options.root / f))
+ else if (config_protected(_imp->options[k::root()] / f))
display("--- [cfgpr] " + stringify(f));
else
return true;
@@ -246,11 +244,11 @@ NDBAMUnmerger::check_sym(const FSEntry & f, tr1::shared_ptr<ExtraInfo> ei) const
{
tr1::shared_ptr<SymlinkExtraInfo> sie(tr1::static_pointer_cast<SymlinkExtraInfo>(ei));
- if (! (_imp->options.root / f).is_symbolic_link())
+ if (! (_imp->options[k::root()] / f).is_symbolic_link())
display("--- [!type] " + stringify(f));
- else if ((_imp->options.root / f).mtime() != sie->_mtime)
+ else if ((_imp->options[k::root()] / f).mtime() != sie->_mtime)
display("--- [!time] " + stringify(f));
- else if ((_imp->options.root / f).readlink() != sie->_dest)
+ else if ((_imp->options[k::root()] / f).readlink() != sie->_dest)
display("--- [!dest] " + stringify(f));
else
return true;
@@ -267,9 +265,9 @@ NDBAMUnmerger::check_misc(const FSEntry &, tr1::shared_ptr<ExtraInfo>) const
bool
NDBAMUnmerger::check_dir(const FSEntry & f, tr1::shared_ptr<ExtraInfo>) const
{
- if (! (_imp->options.root / f).is_directory())
+ if (! (_imp->options[k::root()] / f).is_directory())
display("--- [!type] " + stringify(f));
- else if (DirIterator(_imp->options.root / f, DirIteratorOptions() + dio_include_dotfiles + dio_first_only) != DirIterator())
+ else if (DirIterator(_imp->options[k::root()] / f, DirIteratorOptions() + dio_include_dotfiles + dio_first_only) != DirIterator())
display("--- [!empt] " + stringify(f));
else
return true;
diff --git a/paludis/ndbam_unmerger.hh b/paludis/ndbam_unmerger.hh
index 1fb3f30..486e891 100644
--- a/paludis/ndbam_unmerger.hh
+++ b/paludis/ndbam_unmerger.hh
@@ -22,8 +22,9 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_NDBAM_UNMERGER_HH 1
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/sr.hh>
#include <paludis/util/fs_entry.hh>
+#include <paludis/util/kc-fwd.hh>
+#include <paludis/util/keys.hh>
#include <paludis/unmerger.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
@@ -32,7 +33,15 @@ namespace paludis
{
class NDBAM;
-#include <paludis/ndbam_unmerger-sr.hh>
+ typedef kc::KeyedClass<
+ kc::Field<k::environment, const Environment *>,
+ kc::Field<k::root, FSEntry>,
+ kc::Field<k::contents_file, FSEntry>,
+ kc::Field<k::config_protect, std::string>,
+ kc::Field<k::config_protect_mask, std::string>,
+ kc::Field<k::package_id, tr1::shared_ptr<const PackageID> >,
+ kc::Field<k::ndbam, const NDBAM *>
+ > NDBAMUnmergerOptions;
class PALUDIS_VISIBLE NDBAMUnmergerError :
public UnmergerError
diff --git a/paludis/ndbam_unmerger.sr b/paludis/ndbam_unmerger.sr
deleted file mode 100644
index 31b4f4b..0000000
--- a/paludis/ndbam_unmerger.sr
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-make_class_NDBAMUnmergerOptions()
-{
- visible
-
- key environment "const Environment *"
- key root "FSEntry"
- key contents_file "FSEntry"
- key config_protect std::string
- key config_protect_mask std::string
- key package_id "tr1::shared_ptr<const PackageID>"
- key ndbam "const NDBAM *"
-
- allow_named_args
-}
-
-
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 628152d..fe1898e 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -414,14 +414,14 @@ ExndbamRepository::perform_uninstall(const tr1::shared_ptr<const ERepositoryID>
/* unmerge */
NDBAMUnmerger unmerger(
- NDBAMUnmergerOptions::create()
- .environment(_imp->params.environment)
- .root(installed_root_key()->value())
- .contents_file(ver_dir / "contents")
- .config_protect(config_protect)
- .config_protect_mask(config_protect_mask)
- .ndbam(&_imp->ndbam)
- .package_id(id));
+ NDBAMUnmergerOptions::named_create()
+ (k::environment(), _imp->params.environment)
+ (k::root(), installed_root_key()->value())
+ (k::contents_file(), ver_dir / "contents")
+ (k::config_protect(), config_protect)
+ (k::config_protect_mask(), config_protect_mask)
+ (k::ndbam(), &_imp->ndbam)
+ (k::package_id(), id));
unmerger.unmerge();
}
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index aa59f15..0ceb9ec 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -703,14 +703,14 @@ InstalledUnpackagedID::uninstall(const UninstallActionOptions &, const bool repl
FSEntry ver_dir(fs_location_key()->value());
NDBAMUnmerger unmerger(
- NDBAMUnmergerOptions::create()
- .environment(_imp->env)
- .root(_imp->root)
- .contents_file(ver_dir / "contents")
- .config_protect(getenv_with_default("CONFIG_PROTECT", ""))
- .config_protect_mask(getenv_with_default("CONFIG_PROTECT_MASK", ""))
- .ndbam(_imp->ndbam)
- .package_id(shared_from_this()));
+ NDBAMUnmergerOptions::named_create()
+ (k::environment(), _imp->env)
+ (k::root(), _imp->root)
+ (k::contents_file(), ver_dir / "contents")
+ (k::config_protect(), getenv_with_default("CONFIG_PROTECT", ""))
+ (k::config_protect_mask(), getenv_with_default("CONFIG_PROTECT_MASK", ""))
+ (k::ndbam(), _imp->ndbam)
+ (k::package_id(), shared_from_this()));
unmerger.unmerge();
diff --git a/paludis/util/keys.hh b/paludis/util/keys.hh
index 1373409..9a0ab68 100644
--- a/paludis/util/keys.hh
+++ b/paludis/util/keys.hh
@@ -162,6 +162,7 @@ namespace paludis
typedef kc::Key<133> fs_location;
typedef kc::Key<134> magic;
typedef kc::Key<135> mutex;
+ typedef kc::Key<136> ndbam;
}
}