aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-11 20:58:16 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-11 20:58:16 +0000
commit42688dafeb432ecf7698fb38afb86bbd8b6fb5a8 (patch)
tree87836a2d787471a9fb0dbbff989e975ff68d7614
parent638098e0808eaf31a35f0ee8834ba5b528a68b48 (diff)
downloadpaludis-42688dafeb432ecf7698fb38afb86bbd8b6fb5a8.tar.gz
paludis-42688dafeb432ecf7698fb38afb86bbd8b6fb5a8.tar.xz
Use actions rather than repo methods
-rw-r--r--paludis/action-fwd.hh50
-rw-r--r--paludis/action.cc188
-rw-r--r--paludis/action.hh142
-rw-r--r--paludis/action.se18
-rw-r--r--paludis/action.sr39
-rw-r--r--paludis/dep_list/dep_list.cc15
-rw-r--r--paludis/dep_list/show_suggest_visitor.cc3
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/package_database_TEST.cc2
-rw-r--r--paludis/package_id.cc20
-rw-r--r--paludis/package_id.hh23
-rw-r--r--paludis/query.cc191
-rw-r--r--paludis/query.hh56
-rw-r--r--paludis/repositories/e/e_repository.cc96
-rw-r--r--paludis/repositories/e/e_repository.hh15
-rw-r--r--paludis/repositories/e/e_repository_entries.hh3
-rw-r--r--paludis/repositories/e/e_repository_news.cc2
-rw-r--r--paludis/repositories/e/e_repository_sets.cc6
-rw-r--r--paludis/repositories/e/ebin.cc9
-rw-r--r--paludis/repositories/e/ebin.hh1
-rw-r--r--paludis/repositories/e/ebin.sr2
-rw-r--r--paludis/repositories/e/ebin_entries.hh6
-rw-r--r--paludis/repositories/e/ebuild.cc9
-rw-r--r--paludis/repositories/e/ebuild.hh1
-rw-r--r--paludis/repositories/e/ebuild.sr2
-rw-r--r--paludis/repositories/e/ebuild_entries.cc3
-rw-r--r--paludis/repositories/e/ebuild_entries.hh2
-rw-r--r--paludis/repositories/e/ebuild_id.cc123
-rw-r--r--paludis/repositories/e/ebuild_id.hh3
-rw-r--r--paludis/repositories/e/vdb_id.cc145
-rw-r--r--paludis/repositories/e/vdb_id.hh3
-rw-r--r--paludis/repositories/e/vdb_repository.cc66
-rw-r--r--paludis/repositories/e/vdb_repository.hh27
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc50
-rw-r--r--paludis/repositories/fake/fake_installed_repository.hh4
-rw-r--r--paludis/repositories/fake/fake_package_id.cc79
-rw-r--r--paludis/repositories/fake/fake_package_id.hh4
-rw-r--r--paludis/repositories/fake/fake_repository.cc55
-rw-r--r--paludis/repositories/fake/fake_repository.hh5
-rw-r--r--paludis/repositories/fake/fake_repository_base.hh1
-rw-r--r--paludis/repositories/gems/gem_specification.cc71
-rw-r--r--paludis/repositories/gems/gem_specification.hh3
-rw-r--r--paludis/repositories/gems/gem_specification_TEST.cc6
-rw-r--r--paludis/repositories/gems/gems_repository.cc51
-rw-r--r--paludis/repositories/gems/gems_repository.hh7
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc52
-rw-r--r--paludis/repositories/gems/installed_gems_repository.hh9
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc52
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.hh2
-rw-r--r--paludis/repositories/virtuals/package_id.cc82
-rw-r--r--paludis/repositories/virtuals/package_id.hh6
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc60
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.hh7
-rw-r--r--paludis/repository-fwd.hh18
-rw-r--r--paludis/repository.cc41
-rw-r--r--paludis/repository.hh160
-rw-r--r--paludis/repository.sr42
-rw-r--r--paludis/tasks/install_task.cc57
-rw-r--r--paludis/tasks/install_task.hh3
-rw-r--r--paludis/tasks/uninstall_task.cc17
-rw-r--r--src/clients/contrarius/install.cc8
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc4
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.cc4
-rw-r--r--src/clients/paludis/do_config.cc13
-rw-r--r--src/clients/paludis/install.cc2
-rw-r--r--src/common_args/debug_build_arg.cc10
-rw-r--r--src/common_args/debug_build_arg.hh2
-rw-r--r--src/output/console_install_task.cc4
-rw-r--r--src/output/console_query_task.cc8
69 files changed, 1602 insertions, 669 deletions
diff --git a/paludis/action-fwd.hh b/paludis/action-fwd.hh
new file mode 100644
index 0000000..4683c12
--- /dev/null
+++ b/paludis/action-fwd.hh
@@ -0,0 +1,50 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_ACTION_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_ACTION_FWD_HH 1
+
+#include <iosfwd>
+#include <paludis/util/attributes.hh>
+
+namespace paludis
+{
+ class Action;
+ class InstallAction;
+ class InstalledAction;
+ class UninstallAction;
+ class PretendAction;
+ class ConfigAction;
+
+ class SupportsActionTestBase;
+ template <typename A_> class SupportsActionTest;
+
+ class ActionVisitorTypes;
+ class SupportsActionTestVisitorTypes;
+
+ class UnsupportedActionError;
+
+ class InstallActionOptions;
+ class UninstallActionOptions;
+
+#include <paludis/action-se.hh>
+
+}
+
+#endif
diff --git a/paludis/action.cc b/paludis/action.cc
new file mode 100644
index 0000000..d42a3b8
--- /dev/null
+++ b/paludis/action.cc
@@ -0,0 +1,188 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/action.hh>
+#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/stringify.hh>
+
+using namespace paludis;
+
+#include <paludis/action-se.cc>
+#include <paludis/action-sr.cc>
+
+template class MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, InstallAction>;
+template class MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, ConfigAction>;
+template class MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, PretendAction>;
+template class MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, InstalledAction>;
+template class MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, UninstallAction>;
+
+template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<InstallAction> >;
+template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<ConfigAction> >;
+template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<PretendAction> >;
+template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<InstalledAction> >;
+template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<UninstallAction> >;
+
+Action::~Action()
+{
+}
+
+namespace paludis
+{
+ template <>
+ struct Implementation<InstallAction>
+ {
+ const InstallActionOptions options;
+
+ Implementation(const InstallActionOptions & o) :
+ options(o)
+ {
+ }
+ };
+}
+
+InstallAction::InstallAction(const InstallActionOptions & o) :
+ PrivateImplementationPattern<InstallAction>(new Implementation<InstallAction>(o)),
+ options(_imp->options)
+{
+}
+
+InstallAction::~InstallAction()
+{
+}
+
+namespace paludis
+{
+ template <>
+ struct Implementation<UninstallAction>
+ {
+ const UninstallActionOptions options;
+
+ Implementation(const UninstallActionOptions & o) :
+ options(o)
+ {
+ }
+ };
+}
+
+UninstallAction::UninstallAction(const UninstallActionOptions & o) :
+ PrivateImplementationPattern<UninstallAction>(new Implementation<UninstallAction>(o)),
+ options(_imp->options)
+{
+}
+
+UninstallAction::~UninstallAction()
+{
+}
+
+namespace paludis
+{
+ template <>
+ struct Implementation<PretendAction>
+ {
+ bool failed;
+
+ Implementation() :
+ failed(false)
+ {
+ }
+ };
+}
+
+PretendAction::PretendAction() :
+ PrivateImplementationPattern<PretendAction>(new Implementation<PretendAction>)
+{
+}
+
+PretendAction::~PretendAction()
+{
+}
+
+const bool
+PretendAction::failed() const
+{
+ return _imp->failed;
+}
+
+void
+PretendAction::set_failed()
+{
+ _imp->failed = true;
+}
+
+SupportsActionTestBase::~SupportsActionTestBase()
+{
+}
+
+UnsupportedActionError::UnsupportedActionError(const PackageID & id, const Action & a) throw () :
+ Exception("Unsupported action '" + stringify(a) + "' on '" + stringify(id) + "'")
+{
+}
+
+namespace
+{
+ struct ActionStringifier :
+ ConstVisitor<ActionVisitorTypes>
+ {
+ std::ostream & s;
+
+ ActionStringifier(std::ostream & ss) :
+ s(ss)
+ {
+ }
+
+ void visit(const InstallAction & a)
+ {
+ s << "install to ";
+ if (a.options.destination)
+ s << &a.options.destination;
+ else
+ s << "nowhere";
+ }
+
+ void visit(const UninstallAction &)
+ {
+ s << "uninstall";
+ }
+
+ void visit(const PretendAction &)
+ {
+ s << "pretend";
+ }
+
+ void visit(const InstalledAction &)
+ {
+ s << "installed";
+ }
+
+ void visit(const ConfigAction &)
+ {
+ s << "config";
+ }
+ };
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & s, const Action & a)
+{
+ ActionStringifier t(s);
+ a.accept(t);
+ return s;
+}
+
diff --git a/paludis/action.hh b/paludis/action.hh
new file mode 100644
index 0000000..db80026
--- /dev/null
+++ b/paludis/action.hh
@@ -0,0 +1,142 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_ACTION_HH
+#define PALUDIS_GUARD_PALUDIS_ACTION_HH 1
+
+#include <paludis/action-fwd.hh>
+#include <paludis/repository-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/visitor.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+
+namespace paludis
+{
+
+#include <paludis/action-sr.hh>
+
+ struct ActionVisitorTypes :
+ VisitorTypes<
+ ActionVisitorTypes,
+ Action,
+ InstallAction,
+ InstalledAction,
+ UninstallAction,
+ PretendAction,
+ ConfigAction
+ >
+ {
+ };
+
+ struct SupportsActionTestVisitorTypes :
+ VisitorTypes<
+ SupportsActionTestVisitorTypes,
+ SupportsActionTestBase,
+ SupportsActionTest<InstallAction>,
+ SupportsActionTest<InstalledAction>,
+ SupportsActionTest<UninstallAction>,
+ SupportsActionTest<PretendAction>,
+ SupportsActionTest<ConfigAction>
+ >
+ {
+ };
+
+ class PALUDIS_VISIBLE Action :
+ public virtual MutableAcceptInterface<ActionVisitorTypes>
+ {
+ public:
+ virtual ~Action() = 0;
+ };
+
+ class PALUDIS_VISIBLE InstallAction :
+ public Action,
+ private PrivateImplementationPattern<InstallAction>,
+ public MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, InstallAction>
+ {
+ public:
+ InstallAction(const InstallActionOptions &);
+ ~InstallAction();
+
+ const InstallActionOptions & options;
+ };
+
+ class PALUDIS_VISIBLE UninstallAction :
+ public Action,
+ private PrivateImplementationPattern<UninstallAction>,
+ public MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, UninstallAction>
+ {
+ public:
+ UninstallAction(const UninstallActionOptions &);
+ ~UninstallAction();
+
+ const UninstallActionOptions & options;
+ };
+
+ class PALUDIS_VISIBLE InstalledAction :
+ public Action,
+ public MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, InstalledAction>
+ {
+ };
+
+ class PALUDIS_VISIBLE PretendAction :
+ public Action,
+ private PrivateImplementationPattern<PretendAction>,
+ public MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, PretendAction>
+ {
+ public:
+ PretendAction();
+ ~PretendAction();
+
+ const bool failed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ void set_failed();
+ };
+
+ class PALUDIS_VISIBLE ConfigAction :
+ public Action,
+ public MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, ConfigAction>
+ {
+ };
+
+ class PALUDIS_VISIBLE SupportsActionTestBase :
+ public virtual MutableAcceptInterface<SupportsActionTestVisitorTypes>
+ {
+ public:
+ virtual ~SupportsActionTestBase() = 0;
+ };
+
+ template <typename A_>
+ class PALUDIS_VISIBLE SupportsActionTest :
+ public SupportsActionTestBase,
+ public MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<A_> >
+ {
+ };
+
+ class PALUDIS_VISIBLE UnsupportedActionError :
+ public Exception
+ {
+ public:
+ UnsupportedActionError(const PackageID &, const Action &) throw ();
+ };
+
+ std::ostream & operator<< (std::ostream &, const Action &) PALUDIS_VISIBLE;
+}
+
+#endif
diff --git a/paludis/action.se b/paludis/action.se
new file mode 100644
index 0000000..a390b0d
--- /dev/null
+++ b/paludis/action.se
@@ -0,0 +1,18 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_InstallActionDebugOption()
+{
+ prefix iado
+
+ key iado_none "No debugging"
+ key iado_split "Split debugging"
+ key iado_internal "Internal debugging"
+
+ doxygen_comment << "END"
+ /**
+ * Debug build mode for an InstallAction.
+ */
+END
+}
+
diff --git a/paludis/action.sr b/paludis/action.sr
new file mode 100644
index 0000000..1341a17
--- /dev/null
+++ b/paludis/action.sr
@@ -0,0 +1,39 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_InstallActionOptions()
+{
+ visible
+
+ key no_config_protect bool
+ key fetch_only bool
+ key debug_build InstallActionDebugOption
+ key safe_resume bool
+ key destination "tr1::shared_ptr<Repository>"
+
+ doxygen_comment << "END"
+ /**
+ * Options for InstallAction.
+ *
+ * \see InstallAction
+ * \nosubgrouping
+ */
+END
+}
+
+make_class_UninstallActionOptions()
+{
+ visible
+
+ key no_config_protect bool
+
+ doxygen_comment << "END"
+ /**
+ * Options for UninstallAction.
+ *
+ * \see UninstallAction
+ * \nosubgrouping
+ */
+END
+}
+
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index f6f0261..c0d9c6f 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -266,7 +266,7 @@ namespace
if (0 != u && u->package_ptr())
{
return ! env.package_database()->query(
- query::RepositoryHasInstalledInterface() &
+ query::SupportsAction<InstalledAction>() &
query::Matches(PackageDepSpec(
tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(*u->package_ptr())))),
qo_whatever)->empty();
@@ -321,7 +321,7 @@ DepList::AddVisitor::visit_leaf(const PackageDepSpec & a)
/* find already installed things */
// TODO: check destinations
tr1::shared_ptr<const PackageIDSequence> already_installed(d->_imp->env->package_database()->query(
- query::RepositoryHasInstalledInterface() &
+ query::SupportsAction<InstalledAction>() &
query::Matches(a),
qo_order_by_version));
@@ -379,7 +379,9 @@ DepList::AddVisitor::visit_leaf(const PackageDepSpec & a)
/* find installable candidates, and find the best visible candidate */
tr1::shared_ptr<const PackageID> best_visible_candidate;
tr1::shared_ptr<const PackageIDSequence> installable_candidates(
- d->_imp->env->package_database()->query(query::RepositoryHasInstallableInterface() & query::Matches(a),
+ d->_imp->env->package_database()->query(
+ query::SupportsAction<InstallAction>() &
+ query::Matches(a),
qo_order_by_version));
for (PackageIDSequence::ReverseIterator p(installable_candidates->rbegin()),
@@ -558,7 +560,7 @@ DepList::AddVisitor::visit_leaf(const PackageDepSpec & a)
{
tr1::shared_ptr<const PackageIDSequence> are_we_downgrading(
d->_imp->env->package_database()->query(
- query::RepositoryHasInstalledInterface() &
+ query::SupportsAction<InstalledAction>() &
query::Matches(PackageDepSpec(
make_shared_ptr(new QualifiedPackageName(best_visible_candidate->name())),
tr1::shared_ptr<CategoryNamePart>(),
@@ -743,7 +745,7 @@ DepList::AddVisitor::visit_leaf(const BlockDepSpec & a)
PackageDepSpec just_package(tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(
*a.blocked_spec()->package_ptr())));
already_installed = d->_imp->env->package_database()->query(
- query::RepositoryHasInstalledInterface() &
+ query::SupportsAction<InstalledAction>() &
query::Matches(just_package),
qo_whatever);
@@ -770,7 +772,8 @@ DepList::AddVisitor::visit_leaf(const BlockDepSpec & a)
check_whole_list = true;
/* TODO: InstalledAtRoot? */
already_installed = d->_imp->env->package_database()->query(
- query::RepositoryHasInstalledInterface(), qo_whatever);
+ query::SupportsAction<InstalledAction>(),
+ qo_whatever);
}
if (already_installed->empty() && will_be_installed.empty() && ! check_whole_list)
diff --git a/paludis/dep_list/show_suggest_visitor.cc b/paludis/dep_list/show_suggest_visitor.cc
index 7b14693..a13fd9e 100644
--- a/paludis/dep_list/show_suggest_visitor.cc
+++ b/paludis/dep_list/show_suggest_visitor.cc
@@ -109,7 +109,8 @@ ShowSuggestVisitor::visit_leaf(const PackageDepSpec & a)
ConditionTracker(_imp->conditions).add_condition(a) : _imp->conditions);
tr1::shared_ptr<const PackageIDSequence> matches(_imp->environment->package_database()->query(
- query::RepositoryHasInstallableInterface() & query::Matches(a), qo_order_by_version));
+ query::SupportsAction<InstallAction>() &
+ query::Matches(a), qo_order_by_version));
if (matches->empty())
{
Log::get_instance()->message(ll_warning, lc_context, "Nothing found for '" + stringify(a) + "'");
diff --git a/paludis/files.m4 b/paludis/files.m4
index 890893e..eb54a05 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -9,6 +9,7 @@ dnl `test', `impl', `testscript'. Note that there isn't much error checking done
dnl on this file at present...
add(`about', `hh', `test')
+add(`action', `hh', `cc', `fwd', `se', `sr')
add(`config_file', `hh', `cc', `se', `test', `testscript')
add(`contents', `hh', `cc', `fwd')
add(`dep_spec', `hh', `cc', `se', `test', `fwd')
diff --git a/paludis/package_database_TEST.cc b/paludis/package_database_TEST.cc
index 9c997e5..7102d44 100644
--- a/paludis/package_database_TEST.cc
+++ b/paludis/package_database_TEST.cc
@@ -162,7 +162,7 @@ namespace test_cases
PackageDepSpec d9("r1c1/r1c1p1", pds_pm_permissive);
const tr1::shared_ptr<const PackageIDSequence> q9(p.query(
- query::Matches(d9) & query::RepositoryHasInstallableInterface(), qo_order_by_version));
+ query::Matches(d9) & query::SupportsAction<InstallAction>(), qo_order_by_version));
TEST_CHECK_EQUAL(std::distance(q9->begin(), q9->end()), 1);
}
} package_database_query_test;
diff --git a/paludis/package_id.cc b/paludis/package_id.cc
index 2599079..37ba514 100644
--- a/paludis/package_id.cc
+++ b/paludis/package_id.cc
@@ -64,7 +64,7 @@ PackageID::~PackageID()
}
void
-PackageID::add_key(const tr1::shared_ptr<const MetadataKey> & k) const
+PackageID::add_metadata_key(const tr1::shared_ptr<const MetadataKey> & k) const
{
using namespace tr1::placeholders;
if (_imp->keys.end() != std::find_if(_imp->keys.begin(), _imp->keys.end(),
@@ -74,27 +74,27 @@ PackageID::add_key(const tr1::shared_ptr<const MetadataKey> & k) const
_imp->keys.push_back(k);
}
-PackageID::Iterator
-PackageID::begin() const
+PackageID::MetadataIterator
+PackageID::begin_metadata() const
{
need_keys_added();
- return Iterator(indirect_iterator(_imp->keys.begin()));
+ return MetadataIterator(indirect_iterator(_imp->keys.begin()));
}
-PackageID::Iterator
-PackageID::end() const
+PackageID::MetadataIterator
+PackageID::end_metadata() const
{
need_keys_added();
- return Iterator(indirect_iterator(_imp->keys.end()));
+ return MetadataIterator(indirect_iterator(_imp->keys.end()));
}
-PackageID::Iterator
-PackageID::find(const std::string & s) const
+PackageID::MetadataIterator
+PackageID::find_metadata(const std::string & s) const
{
using namespace tr1::placeholders;
need_keys_added();
- return std::find_if(begin(), end(),
+ return std::find_if(begin_metadata(), end_metadata(),
tr1::bind(std::equal_to<std::string>(), s, tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1)));
}
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index a810e05..2f9a95b 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -22,6 +22,7 @@
#include <paludis/package_id-fwd.hh>
#include <paludis/metadata_key-fwd.hh>
+#include <paludis/action-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/instantiation_policy.hh>
@@ -43,7 +44,7 @@ namespace paludis
public equality_operators::HasEqualityOperators
{
protected:
- virtual void add_key(const tr1::shared_ptr<const MetadataKey> &) const;
+ virtual void add_metadata_key(const tr1::shared_ptr<const MetadataKey> &) const;
virtual void need_keys_added() const = 0;
public:
@@ -58,7 +59,7 @@ namespace paludis
virtual const tr1::shared_ptr<const Repository> repository() const = 0;
virtual const tr1::shared_ptr<const EAPI> eapi() const = 0;
- ///\name Specific keys
+ ///\name Specific metadata keys
///\{
virtual const tr1::shared_ptr<const MetadataPackageIDKey> virtual_for_key() const = 0;
@@ -85,13 +86,21 @@ namespace paludis
///\}
- ///\name Finding and iterating over keys
+ ///\name Finding and iterating over metadata keys
///\{
- typedef libwrapiter::ForwardIterator<PackageID, const MetadataKey> Iterator;
- Iterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
- Iterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
- Iterator find(const std::string &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ typedef libwrapiter::ForwardIterator<PackageID, const MetadataKey> MetadataIterator;
+ MetadataIterator begin_metadata() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ MetadataIterator end_metadata() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ MetadataIterator find_metadata(const std::string &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\}
+
+ ///\name Actions
+ ///\{
+
+ virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual void perform_action(Action &) const = 0;
///\}
diff --git a/paludis/query.cc b/paludis/query.cc
index 2147745..326b6e6 100644
--- a/paludis/query.cc
+++ b/paludis/query.cc
@@ -22,9 +22,11 @@
#include <paludis/util/tr1_functional.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/package_database.hh>
#include <paludis/environment.hh>
#include <paludis/match_package.hh>
+#include <paludis/action.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include <algorithm>
@@ -266,79 +268,6 @@ query::NotMasked::NotMasked() :
namespace
{
- template <typename I_>
- struct DelegateName;
-
- template <>
- struct DelegateName<RepositoryInstalledInterface>
- {
- static const char * value;
- };
-
- const char * DelegateName<RepositoryInstalledInterface>::value = "RepositoryInstalledInterface";
-
- template <>
- struct DelegateName<RepositoryUninstallableInterface>
- {
- static const char * value;
- };
-
- const char * DelegateName<RepositoryUninstallableInterface>::value = "RepositoryUninstallableInterface";
-
- template <>
- struct DelegateName<RepositoryInstallableInterface>
- {
- static const char * value;
- };
-
- const char * DelegateName<RepositoryInstallableInterface>::value = "RepositoryInstallableInterface";
-
- template <typename I_, I_ * (RepositoryCapabilities::* i_)>
- struct RepositoryHasDelegate :
- QueryDelegate
- {
- tr1::shared_ptr<RepositoryNameSequence>
- repositories(const Environment & e) const
- {
- tr1::shared_ptr<RepositoryNameSequence> result(new RepositoryNameSequence);
-
- for (PackageDatabase::RepositoryIterator i(e.package_database()->begin_repositories()),
- i_end(e.package_database()->end_repositories()) ; i != i_end ; ++i)
- if ((**i).*i_)
- result->push_back((*i)->name());
-
- return result;
- }
-
- std::string
- as_human_readable_string() const
- {
- return "repository has '" + std::string(DelegateName<I_>::value) + "'";
- }
-
- };
-}
-
-query::RepositoryHasInstalledInterface::RepositoryHasInstalledInterface() :
- Query(tr1::shared_ptr<QueryDelegate>(
- new RepositoryHasDelegate<RepositoryInstalledInterface, &RepositoryCapabilities::installed_interface>))
-{
-}
-
-query::RepositoryHasInstallableInterface::RepositoryHasInstallableInterface() :
- Query(tr1::shared_ptr<QueryDelegate>(
- new RepositoryHasDelegate<RepositoryInstallableInterface, &RepositoryCapabilities::installable_interface>))
-{
-}
-
-query::RepositoryHasUninstallableInterface::RepositoryHasUninstallableInterface() :
- Query(tr1::shared_ptr<QueryDelegate>(
- new RepositoryHasDelegate<RepositoryUninstallableInterface, &RepositoryCapabilities::uninstallable_interface>))
-{
-}
-
-namespace
-{
struct InstalledAtRootDelegate :
QueryDelegate
{
@@ -518,3 +447,119 @@ query::All::All() :
{
}
+namespace
+{
+ template <typename T_>
+ struct SupportsNames;
+
+ template <>
+ struct SupportsNames<InstallAction>
+ {
+ static const std::string name()
+ {
+ return "supports install action";
+ }
+ };
+
+ template <>
+ struct SupportsNames<InstalledAction>
+ {
+ static const std::string name()
+ {
+ return "supports installed action";
+ }
+ };
+
+ template <>
+ struct SupportsNames<UninstallAction>
+ {
+ static const std::string name()
+ {
+ return "supports uninstall action";
+ }
+ };
+
+ template <>
+ struct SupportsNames<ConfigAction>
+ {
+ static const std::string name()
+ {
+ return "supports config action";
+ }
+ };
+
+ template <>
+ struct SupportsNames<PretendAction>
+ {
+ static const std::string name()
+ {
+ return "supports pretend action";
+ }
+ };
+
+ template <typename T_>
+ struct SupportsDelegate :
+ QueryDelegate
+ {
+ std::string
+ as_human_readable_string() const
+ {
+ return SupportsNames<T_>::name();
+ }
+
+ tr1::shared_ptr<RepositoryNameSequence>
+ repositories(const Environment & e) const
+ {
+ SupportsActionTest<T_> t;
+
+ tr1::shared_ptr<RepositoryNameSequence> result(new RepositoryNameSequence);
+
+ for (PackageDatabase::RepositoryIterator i(e.package_database()->begin_repositories()),
+ i_end(e.package_database()->end_repositories()) ; i != i_end ; ++i)
+ if ((*i)->some_ids_might_support_action(t))
+ result->push_back((*i)->name());
+
+ return result;
+ }
+
+ tr1::shared_ptr<PackageIDSequence>
+ ids(const Environment & e,
+ tr1::shared_ptr<const RepositoryNameSequence> repos,
+ tr1::shared_ptr<const QualifiedPackageNameSet> pkgs) const
+ {
+ SupportsActionTest<T_> t;
+
+ tr1::shared_ptr<PackageIDSequence> result(new PackageIDSequence);
+ for (RepositoryNameSequence::Iterator r(repos->begin()), r_end(repos->end()) ;
+ r != r_end ; ++r)
+ {
+ tr1::shared_ptr<const Repository> repo(e.package_database()->fetch_repository(*r));
+
+ for (QualifiedPackageNameSet::Iterator p(pkgs->begin()), p_end(pkgs->end()) ;
+ p != p_end ; ++p)
+ {
+ tr1::shared_ptr<const PackageIDSequence> i(repo->package_ids(*p));
+ for (PackageIDSequence::Iterator v(i->begin()), v_end(i->end()) ;
+ v != v_end ; ++v)
+ if ((*v)->supports_action(t))
+ result->push_back(*v);
+ }
+ }
+
+ return result;
+ }
+ };
+}
+
+template <typename A_>
+query::SupportsAction<A_>::SupportsAction() :
+ Query(tr1::shared_ptr<QueryDelegate>(new SupportsDelegate<A_>))
+{
+}
+
+template class query::SupportsAction<InstallAction>;
+template class query::SupportsAction<UninstallAction>;
+template class query::SupportsAction<InstalledAction>;
+template class query::SupportsAction<PretendAction>;
+template class query::SupportsAction<ConfigAction>;
+
diff --git a/paludis/query.hh b/paludis/query.hh
index c0c0f33..9e6bc97 100644
--- a/paludis/query.hh
+++ b/paludis/query.hh
@@ -197,7 +197,6 @@ namespace paludis
* Fetch packages with a given package name.
*
* \see Query
- * \see PackageData
* \ingroup grpquerybase::query
* \nosubgrouping
*/
@@ -217,7 +216,6 @@ namespace paludis
* Fetch packages in a given repository.
*
* \see Query
- * \see PackageData
* \ingroup grpquerybase::query
* \nosubgrouping
*/
@@ -237,7 +235,6 @@ namespace paludis
* Fetch packages in a given category.
*
* \see Query
- * \see PackageData
* \ingroup grpquerybase::query
* \nosubgrouping
*/
@@ -257,8 +254,7 @@ namespace paludis
* Fetch packages that are not masked.
*
* \see Query
- * \see PackageData
- * \ingroup grpquerybase::query
+ * \ingroup grpquery
* \nosubgrouping
*/
class PALUDIS_VISIBLE NotMasked :
@@ -274,64 +270,22 @@ namespace paludis
};
/**
- * Fetch packages from a repository that has
- * RepositoryInstalledInterface.
+ * Fetch packages that support a particular action.
*
* \see Query
- * \see PackageData
- * \ingroup grpquerybase::query
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RepositoryHasInstalledInterface :
- public Query
- {
- public:
- ///\name Basic operations
- ///\{
-
- RepositoryHasInstalledInterface();
-
- ///\}
- };
-
- /**
- * Fetch packages from a repository that has
- * RepositoryInstallableInterface.
- *
* \see PackageDatabase::query
- * \see Query
- * \ingroup grpquery
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RepositoryHasInstallableInterface :
- public Query
- {
- public:
- ///\name Basic operations
- ///\{
-
- RepositoryHasInstallableInterface();
-
- ///\}
- };
-
- /**
- * Fetch packages from a repository that has
- * RepositoryUninstallableInterface.
- *
- * \see PackageDatabase::query
- * \see Query
* \ingroup grpquery
* \nosubgrouping
*/
- class PALUDIS_VISIBLE RepositoryHasUninstallableInterface :
+ template <typename A_>
+ class PALUDIS_VISIBLE SupportsAction :
public Query
{
public:
///\name Basic operations
///\{
- RepositoryHasUninstallableInterface();
+ SupportsAction();
///\}
};
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 787d899..0b5dc7f 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -45,6 +45,7 @@
#include <paludis/repository_name_cache.hh>
#include <paludis/syncer.hh>
#include <paludis/eapi.hh>
+#include <paludis/action.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/iterator.hh>
@@ -57,6 +58,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
#include <paludis/util/tr1_functional.hh>
+#include <paludis/util/visitor-impl.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -249,11 +251,9 @@ ERepository::ERepository(const ERepositoryParams & p) :
Repository(fetch_repo_name(p.location),
RepositoryCapabilities::create()
.mask_interface(this)
- .installable_interface(this)
.installed_interface(0)
.sets_interface(this)
.syncable_interface(this)
- .uninstallable_interface(0)
.use_interface(this)
.world_interface(0)
.environment_variable_interface(this)
@@ -261,12 +261,10 @@ ERepository::ERepository(const ERepositoryParams & p) :
.virtuals_interface(DistributionData::get_instance()->distribution_from_string(
p.environment->default_distribution())->support_old_style_virtuals ? this : 0)
.provides_interface(0)
- .config_interface(0)
.destination_interface(p.enable_destinations ? this : 0)
.licenses_interface(this)
.make_virtuals_interface(0)
.e_interface(this)
- .pretend_interface(this)
#ifdef ENABLE_QA
.qa_interface(this)
#else
@@ -490,18 +488,18 @@ ERepository::need_mirrors() const
LineConfigFile mirrors(*p, LineConfigFileOptions());
for (LineConfigFile::Iterator line(mirrors.begin()) ; line != mirrors.end() ; ++line)
{
- std::vector<std::string> entries;
- WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(entries));
- if (! entries.empty())
+ std::vector<std::string> ee;
+ WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(ee));
+ if (! ee.empty())
{
/* pick up to five random mirrors only */
static Random r;
- std::random_shuffle(next(entries.begin()), entries.end(), r);
- if (entries.size() > 6)
- entries.resize(6);
- for (std::vector<std::string>::const_iterator e(next(entries.begin())),
- e_end(entries.end()) ; e != e_end ; ++e)
- _imp->mirrors.insert(std::make_pair(entries.at(0), *e));
+ std::random_shuffle(next(ee.begin()), ee.end(), r);
+ if (ee.size() > 6)
+ ee.resize(6);
+ for (std::vector<std::string>::const_iterator e(next(ee.begin())),
+ e_end(ee.end()) ; e != e_end ; ++e)
+ _imp->mirrors.insert(std::make_pair(ee.at(0), *e));
}
}
}
@@ -519,21 +517,6 @@ ERepository::need_mirrors() const
}
}
-void
-ERepository::do_install(const tr1::shared_ptr<const PackageID> & id,
- const InstallOptions & o) const
-{
- _imp->need_profiles();
- _imp->entries_ptr->install(id, o, _imp->profile_ptr);
-}
-
-bool
-ERepository::do_pretend(const tr1::shared_ptr<const PackageID> & id) const
-{
- _imp->need_profiles();
- return _imp->entries_ptr->pretend(id, _imp->profile_ptr);
-}
-
tr1::shared_ptr<SetSpecTree::ConstItem>
ERepository::do_package_set(const SetName & s) const
{
@@ -612,6 +595,19 @@ ERepository::layout() const
return _imp->layout;
}
+const tr1::shared_ptr<const ERepositoryProfile>
+ERepository::profile() const
+{
+ _imp->need_profiles();
+ return _imp->profile_ptr;
+}
+
+const tr1::shared_ptr<const ERepositoryEntries>
+ERepository::entries() const
+{
+ return _imp->entries_ptr;
+}
+
std::string
ERepository::get_environment_variable(
const tr1::shared_ptr<const PackageID> & for_package,
@@ -978,3 +974,47 @@ ERepository::check_qa(
#endif
}
+namespace
+{
+ struct SupportsActionQuery :
+ ConstVisitor<SupportsActionTestVisitorTypes>
+ {
+ bool result;
+
+ SupportsActionQuery() :
+ result(false)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstalledAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstallAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<ConfigAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<PretendAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<UninstallAction> &)
+ {
+ }
+ };
+}
+
+bool
+ERepository::do_some_ids_might_support_action(const SupportsActionTestBase & a) const
+{
+ SupportsActionQuery q;
+ a.accept(q);
+ return q.result;
+}
+
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index b911c03..ed8b9ab 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -52,7 +52,6 @@ namespace paludis
public Repository,
public RepositoryMaskInterface,
public RepositoryUseInterface,
- public RepositoryInstallableInterface,
public RepositorySyncableInterface,
public RepositorySetsInterface,
public RepositoryEnvironmentVariableInterface,
@@ -62,7 +61,6 @@ namespace paludis
public RepositoryLicensesInterface,
public RepositoryEInterface,
public RepositoryHookInterface,
- public RepositoryPretendInterface,
public RepositoryQAInterface,
public tr1::enable_shared_from_this<ERepository>,
private PrivateImplementationPattern<ERepository>
@@ -121,10 +119,6 @@ namespace paludis
const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- /* RepositoryInstallableInterface */
-
- virtual void do_install(const tr1::shared_ptr<const PackageID> &, const InstallOptions &) const;
-
/* RepositoryEnvironmentVariableInterface */
virtual std::string get_environment_variable(
@@ -132,11 +126,6 @@ namespace paludis
const std::string & var) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- /* RepositoryPretendInterface */
-
- virtual bool do_pretend(const tr1::shared_ptr<const PackageID> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* Repository */
virtual tr1::shared_ptr<const PackageIDSequence> do_package_ids(
@@ -159,6 +148,8 @@ namespace paludis
virtual bool do_has_category_named(const CategoryNamePart &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool do_some_ids_might_support_action(const SupportsActionTestBase &) const;
+
public:
virtual tr1::shared_ptr<const RepositoryInfo> info(bool verbose) const;
@@ -238,6 +229,8 @@ namespace paludis
void update_news() const;
const tr1::shared_ptr<const Layout> layout() const;
+ const tr1::shared_ptr<const ERepositoryEntries> entries() const;
+ const tr1::shared_ptr<const ERepositoryProfile> profile() const;
void regenerate_cache() const;
};
diff --git a/paludis/repositories/e/e_repository_entries.hh b/paludis/repositories/e/e_repository_entries.hh
index b49b890..26b5155 100644
--- a/paludis/repositories/e/e_repository_entries.hh
+++ b/paludis/repositories/e/e_repository_entries.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_REPOSITORY_METADATA_HH 1
#include <paludis/name-fwd.hh>
+#include <paludis/action-fwd.hh>
#include <paludis/repository-fwd.hh>
#include <paludis/version_spec-fwd.hh>
#include <paludis/package_id-fwd.hh>
@@ -79,7 +80,7 @@ namespace paludis
/**
* Handle an install.
*/
- virtual void install(const tr1::shared_ptr<const PackageID> &, const InstallOptions &,
+ virtual void install(const tr1::shared_ptr<const PackageID> &, const InstallActionOptions &,
tr1::shared_ptr<const ERepositoryProfile>) const = 0;
/**
diff --git a/paludis/repositories/e/e_repository_news.cc b/paludis/repositories/e/e_repository_news.cc
index 6b56df8..5009d3e 100644
--- a/paludis/repositories/e/e_repository_news.cc
+++ b/paludis/repositories/e/e_repository_news.cc
@@ -130,7 +130,7 @@ ERepositoryNews::update_news() const
i_end(news.end_display_if_installed()) ; i != i_end ; ++i)
if (! _imp->environment->package_database()->query(
query::Matches(PackageDepSpec(*i, pds_pm_permissive)) &
- query::RepositoryHasInstalledInterface(),
+ query::SupportsAction<InstalledAction>(),
qo_whatever)->empty())
local_show = true;
show &= local_show;
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index a26da75..c77697c 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -251,7 +251,9 @@ ERepositorySets::security_set(bool insecurity) const
candidates = _imp->environment->package_database()->query(query::Package(glsa_pkg->name()), qo_order_by_version);
else
candidates = _imp->environment->package_database()->query(
- query::Package(glsa_pkg->name()) & query::RepositoryHasInstalledInterface(), qo_order_by_version);
+ query::Package(glsa_pkg->name()) &
+ query::SupportsAction<InstalledAction>(),
+ qo_order_by_version);
for (PackageIDSequence::Iterator c(candidates->begin()), c_end(candidates->end()) ;
c != c_end ; ++c)
@@ -296,7 +298,7 @@ ERepositorySets::security_set(bool insecurity) const
tr1::shared_ptr<VersionRequirements>(),
vr_and,
tr1::shared_ptr<SlotName>(new SlotName((*c)->slot())))) &
- query::RepositoryHasInstallableInterface() &
+ query::SupportsAction<InstallAction>() &
query::NotMasked(),
qo_order_by_version));
diff --git a/paludis/repositories/e/ebin.cc b/paludis/repositories/e/ebin.cc
index 2c1479c..d5b8efc 100644
--- a/paludis/repositories/e/ebin.cc
+++ b/paludis/repositories/e/ebin.cc
@@ -219,17 +219,20 @@ EbinInstallCommand::extend_command(const Command & cmd)
{
switch (install_params.debug_build)
{
- case ido_none:
+ case iado_none:
debug_build = "none";
continue;
- case ido_split:
+ case iado_split:
debug_build = "split";
continue;
- case ido_internal:
+ case iado_internal:
debug_build = "internal";
continue;
+
+ case last_iado:
+ break;
}
throw InternalError(PALUDIS_HERE, "Bad debug_build value");
diff --git a/paludis/repositories/e/ebin.hh b/paludis/repositories/e/ebin.hh
index 7bd658b..a75bb6d 100644
--- a/paludis/repositories/e/ebin.hh
+++ b/paludis/repositories/e/ebin.hh
@@ -24,6 +24,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/attributes.hh>
#include <paludis/package_database.hh>
+#include <paludis/action-fwd.hh>
#include <string>
namespace paludis
diff --git a/paludis/repositories/e/ebin.sr b/paludis/repositories/e/ebin.sr
index 20800ef..2da3ff9 100644
--- a/paludis/repositories/e/ebin.sr
+++ b/paludis/repositories/e/ebin.sr
@@ -48,7 +48,7 @@ make_class_EbinInstallCommandParams()
key b std::string
key root std::string
key disable_cfgpro bool
- key debug_build InstallDebugOption
+ key debug_build InstallActionDebugOption
key slot SlotName
key phase EbinInstallCommandPhase
key config_protect std::string
diff --git a/paludis/repositories/e/ebin_entries.hh b/paludis/repositories/e/ebin_entries.hh
index e9be746..930f8fb 100644
--- a/paludis/repositories/e/ebin_entries.hh
+++ b/paludis/repositories/e/ebin_entries.hh
@@ -69,12 +69,6 @@ namespace paludis
virtual std::string get_environment_variable(const tr1::shared_ptr<const PackageID> &, const std::string & var,
tr1::shared_ptr<const ERepositoryProfile>) const;
- virtual void install(const tr1::shared_ptr<const PackageID> &, const InstallOptions &,
- tr1::shared_ptr<const ERepositoryProfile>) const;
-
- virtual bool pretend(const tr1::shared_ptr<const PackageID> &,
- tr1::shared_ptr<const ERepositoryProfile>) const;
-
virtual void merge(const MergeOptions &);
};
}
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index a0dc586..2dbb6bc 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -485,17 +485,20 @@ EbuildInstallCommand::extend_command(const Command & cmd)
{
switch (install_params.debug_build)
{
- case ido_none:
+ case iado_none:
debug_build = "none";
continue;
- case ido_split:
+ case iado_split:
debug_build = "split";
continue;
- case ido_internal:
+ case iado_internal:
debug_build = "internal";
continue;
+
+ case last_iado:
+ break;
}
throw InternalError(PALUDIS_HERE, "Bad debug_build value");
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index e326d20..60e0b5a 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -25,6 +25,7 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/map-fwd.hh>
#include <paludis/package_database.hh>
+#include <paludis/action-fwd.hh>
#include <string>
/** \file
diff --git a/paludis/repositories/e/ebuild.sr b/paludis/repositories/e/ebuild.sr
index a87cae4..613e536 100644
--- a/paludis/repositories/e/ebuild.sr
+++ b/paludis/repositories/e/ebuild.sr
@@ -65,7 +65,7 @@ make_class_EbuildInstallCommandParams()
key profiles "tr1::shared_ptr<const FSEntrySequence>"
key expand_vars "tr1::shared_ptr<const Map<std::string, std::string> >"
key disable_cfgpro bool
- key debug_build InstallDebugOption
+ key debug_build InstallActionDebugOption
key slot SlotName
key config_protect std::string
key config_protect_mask std::string
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 12b1e3a..56ba7cc 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -25,6 +25,7 @@
#include <paludis/repositories/e/ebuild_id.hh>
#include <paludis/eapi.hh>
+#include <paludis/action.hh>
#include <paludis/dep_spec_flattener.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
@@ -234,7 +235,7 @@ namespace
void
EbuildEntries::install(const tr1::shared_ptr<const PackageID> & id,
- const InstallOptions & o, tr1::shared_ptr<const ERepositoryProfile> p) const
+ const InstallActionOptions & o, tr1::shared_ptr<const ERepositoryProfile> p) const
{
using namespace tr1::placeholders;
diff --git a/paludis/repositories/e/ebuild_entries.hh b/paludis/repositories/e/ebuild_entries.hh
index b6582b1..11a302f 100644
--- a/paludis/repositories/e/ebuild_entries.hh
+++ b/paludis/repositories/e/ebuild_entries.hh
@@ -77,7 +77,7 @@ namespace paludis
virtual std::string get_environment_variable(const tr1::shared_ptr<const PackageID> &, const std::string & var,
tr1::shared_ptr<const ERepositoryProfile>) const;
- virtual void install(const tr1::shared_ptr<const PackageID> &, const InstallOptions &,
+ virtual void install(const tr1::shared_ptr<const PackageID> &, const InstallActionOptions &,
tr1::shared_ptr<const ERepositoryProfile>) const;
virtual bool pretend(const tr1::shared_ptr<const PackageID> &,
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index ff8bb50..fd1c05c 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -21,6 +21,7 @@
#include <paludis/repositories/e/ebuild_flat_metadata_cache.hh>
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/e_repository_params.hh>
+#include <paludis/repositories/e/e_repository_entries.hh>
#include <paludis/repositories/e/eapi_phase.hh>
#include <paludis/repositories/e/e_key.hh>
@@ -30,12 +31,14 @@
#include <paludis/distribution.hh>
#include <paludis/eapi.hh>
#include <paludis/environment.hh>
+#include <paludis/action.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/log.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/idle_action_pool.hh>
+#include <paludis/util/visitor-impl.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
@@ -479,84 +482,84 @@ void
EbuildID::load_short_description(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->short_description.reset(new EStringKey(shared_from_this(), r, h, v, mkt_significant));
- add_key(_imp->short_description);
+ add_metadata_key(_imp->short_description);
}
void
EbuildID::load_build_depend(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->build_dependencies.reset(new EDependenciesKey(shared_from_this(), r, h, v, mkt_dependencies));
- add_key(_imp->build_dependencies);
+ add_metadata_key(_imp->build_dependencies);
}
void
EbuildID::load_run_depend(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->run_dependencies.reset(new EDependenciesKey(shared_from_this(), r, h, v, mkt_dependencies));
- add_key(_imp->run_dependencies);
+ add_metadata_key(_imp->run_dependencies);
}
void
EbuildID::load_post_depend(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->post_dependencies.reset(new EDependenciesKey(shared_from_this(), r, h, v, mkt_dependencies));
- add_key(_imp->post_dependencies);
+ add_metadata_key(_imp->post_dependencies);
}
void
EbuildID::load_src_uri(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->src_uri.reset(new EURIKey(shared_from_this(), r, h, v, mkt_dependencies));
- add_key(_imp->src_uri);
+ add_metadata_key(_imp->src_uri);
}
void
EbuildID::load_homepage(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->homepage.reset(new EURIKey(shared_from_this(), r, h, v, mkt_significant));
- add_key(_imp->homepage);
+ add_metadata_key(_imp->homepage);
}
void
EbuildID::load_license(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->license.reset(new ELicenseKey(shared_from_this(), r, h, v, mkt_normal));
- add_key(_imp->license);
+ add_metadata_key(_imp->license);
}
void
EbuildID::load_restrict(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->restrictions.reset(new ERestrictKey(shared_from_this(), r, h, v, mkt_internal));
- add_key(_imp->restrictions);
+ add_metadata_key(_imp->restrictions);
}
void
EbuildID::load_provide(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->provide.reset(new EProvideKey(shared_from_this(), r, h, v, mkt_dependencies));
- add_key(_imp->provide);
+ add_metadata_key(_imp->provide);
}
void
EbuildID::load_iuse(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->iuse.reset(new EIUseKey(shared_from_this(), r, h, v, mkt_normal));
- add_key(_imp->iuse);
+ add_metadata_key(_imp->iuse);
}
void
EbuildID::load_keywords(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->keywords.reset(new EKeywordsKey(shared_from_this(), r, h, v, mkt_normal));
- add_key(_imp->keywords);
+ add_metadata_key(_imp->keywords);
}
void
EbuildID::load_inherited(const std::string & r, const std::string & h, const std::string & v) const
{
_imp->inherited.reset(new EInheritedKey(shared_from_this(), r, h, v, mkt_internal));
- add_key(_imp->inherited);
+ add_metadata_key(_imp->inherited);
}
void
@@ -583,3 +586,99 @@ EbuildID::_idle_load() const throw ()
}
}
+namespace
+{
+ struct SupportsActionQuery :
+ ConstVisitor<SupportsActionTestVisitorTypes>
+ {
+ bool result;
+
+ SupportsActionQuery() :
+ result(false)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstalledAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstallAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<ConfigAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<PretendAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<UninstallAction> &)
+ {
+ }
+ };
+}
+
+bool
+EbuildID::supports_action(const SupportsActionTestBase & b) const
+{
+ SupportsActionQuery q;
+ b.accept(q);
+ return q.result;
+}
+
+namespace
+{
+ struct PerformAction :
+ ConstVisitor<ActionVisitorTypes>
+ {
+ const tr1::shared_ptr<const PackageID> id;
+
+ PerformAction(const tr1::shared_ptr<const PackageID> i) :
+ id(i)
+ {
+ }
+
+ void visit(const InstallAction & a)
+ {
+ tr1::static_pointer_cast<const ERepository>(id->repository())->entries()->install(id, a.options,
+ tr1::static_pointer_cast<const ERepository>(id->repository())->profile());
+ }
+
+ void visit(const PretendAction &)
+ {
+ tr1::static_pointer_cast<const ERepository>(id->repository())->entries()->pretend(id,
+ tr1::static_pointer_cast<const ERepository>(id->repository())->profile());
+ }
+
+ void visit(const InstalledAction & a) PALUDIS_ATTRIBUTE((noreturn));
+ void visit(const UninstallAction & a) PALUDIS_ATTRIBUTE((noreturn));
+ void visit(const ConfigAction & a) PALUDIS_ATTRIBUTE((noreturn));
+ };
+
+ void PerformAction::visit(const InstalledAction & a)
+ {
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void PerformAction::visit(const UninstallAction & a)
+ {
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void PerformAction::visit(const ConfigAction & a)
+ {
+ throw UnsupportedActionError(*id, a);
+ }
+}
+
+void
+EbuildID::perform_action(Action & a) const
+{
+ PerformAction b(shared_from_this());
+ a.accept(b);
+}
+
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index b6d3d44..990054e 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -108,6 +108,9 @@ namespace paludis
void load_inherited(const std::string &, const std::string &, const std::string &) const;
void load_keywords(const std::string &, const std::string &, const std::string &) const;
void load_restrict(const std::string &, const std::string &, const std::string &) const;
+
+ virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual void perform_action(Action &) const;
};
}
}
diff --git a/paludis/repositories/e/vdb_id.cc b/paludis/repositories/e/vdb_id.cc
index 5bb44c4..e199d85 100644
--- a/paludis/repositories/e/vdb_id.cc
+++ b/paludis/repositories/e/vdb_id.cc
@@ -19,6 +19,7 @@
#include <paludis/repositories/e/vdb_id.hh>
#include <paludis/repositories/e/e_key.hh>
+#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
@@ -26,7 +27,9 @@
#include <paludis/distribution.hh>
#include <paludis/eapi.hh>
#include <paludis/environment.hh>
+#include <paludis/action.hh>
#include <paludis/util/fs_entry.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/log.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -148,7 +151,7 @@ VDBID::need_keys_added() const
{
_imp->use.reset(new EUseKey(shared_from_this(), env->env_use, env->description_use,
file_contents(_imp->dir / env->env_use), mkt_internal));
- add_key(_imp->use);
+ add_metadata_key(_imp->use);
}
if (! vars->metadata_inherited.empty())
@@ -156,7 +159,7 @@ VDBID::need_keys_added() const
{
_imp->inherited.reset(new EInheritedKey(shared_from_this(), vars->metadata_inherited, vars->description_inherited,
file_contents(_imp->dir / vars->metadata_inherited), mkt_internal));
- add_key(_imp->inherited);
+ add_metadata_key(_imp->inherited);
}
if (! vars->metadata_iuse.empty())
@@ -164,7 +167,7 @@ VDBID::need_keys_added() const
{
_imp->iuse.reset(new EIUseKey(shared_from_this(), vars->metadata_iuse, vars->description_iuse,
file_contents(_imp->dir / vars->metadata_iuse), mkt_normal));
- add_key(_imp->iuse);
+ add_metadata_key(_imp->iuse);
}
if (! vars->metadata_license.empty())
@@ -172,7 +175,7 @@ VDBID::need_keys_added() const
{
_imp->license.reset(new ELicenseKey(shared_from_this(), vars->metadata_license, vars->description_license,
file_contents(_imp->dir / vars->metadata_license), mkt_normal));
- add_key(_imp->license);
+ add_metadata_key(_imp->license);
}
if (! vars->metadata_provide.empty())
@@ -180,7 +183,7 @@ VDBID::need_keys_added() const
{
_imp->provide.reset(new EProvideKey(shared_from_this(), vars->metadata_provide, vars->description_provide,
file_contents(_imp->dir / vars->metadata_provide), mkt_internal));
- add_key(_imp->provide);
+ add_metadata_key(_imp->provide);
}
if (! vars->metadata_build_depend.empty())
@@ -188,7 +191,7 @@ VDBID::need_keys_added() const
{
_imp->build_dependencies.reset(new EDependenciesKey(shared_from_this(), vars->metadata_build_depend,
vars->description_build_depend, file_contents(_imp->dir / vars->metadata_build_depend), mkt_dependencies));
- add_key(_imp->build_dependencies);
+ add_metadata_key(_imp->build_dependencies);
}
if (! vars->metadata_run_depend.empty())
@@ -196,7 +199,7 @@ VDBID::need_keys_added() const
{
_imp->run_dependencies.reset(new EDependenciesKey(shared_from_this(), vars->metadata_run_depend,
vars->description_run_depend, file_contents(_imp->dir / vars->metadata_run_depend), mkt_dependencies));
- add_key(_imp->run_dependencies);
+ add_metadata_key(_imp->run_dependencies);
}
if (! vars->metadata_pdepend.empty())
@@ -204,7 +207,7 @@ VDBID::need_keys_added() const
{
_imp->post_dependencies.reset(new EDependenciesKey(shared_from_this(), vars->metadata_pdepend,
vars->description_pdepend, file_contents(_imp->dir / vars->metadata_pdepend), mkt_dependencies));
- add_key(_imp->post_dependencies);
+ add_metadata_key(_imp->post_dependencies);
}
if (! vars->metadata_restrict.empty())
@@ -212,7 +215,7 @@ VDBID::need_keys_added() const
{
_imp->restrictions.reset(new ERestrictKey(shared_from_this(), vars->metadata_restrict, vars->description_restrict,
file_contents(_imp->dir / vars->metadata_restrict), mkt_internal));
- add_key(_imp->restrictions);
+ add_metadata_key(_imp->restrictions);
}
if (! vars->metadata_src_uri.empty())
@@ -220,7 +223,7 @@ VDBID::need_keys_added() const
{
_imp->src_uri.reset(new EURIKey(shared_from_this(), vars->metadata_src_uri, vars->description_src_uri,
file_contents(_imp->dir / vars->metadata_src_uri), mkt_dependencies));
- add_key(_imp->src_uri);
+ add_metadata_key(_imp->src_uri);
}
if (! vars->metadata_description.empty())
@@ -228,7 +231,7 @@ VDBID::need_keys_added() const
{
_imp->short_description.reset(new EStringKey(shared_from_this(), vars->metadata_description,
vars->description_description, file_contents(_imp->dir / vars->metadata_description), mkt_significant));
- add_key(_imp->short_description);
+ add_metadata_key(_imp->short_description);
}
if (! vars->metadata_homepage.empty())
@@ -236,85 +239,85 @@ VDBID::need_keys_added() const
{
_imp->homepage.reset(new EURIKey(shared_from_this(), vars->metadata_homepage, vars->description_homepage,
file_contents(_imp->dir / vars->metadata_homepage), mkt_significant));
- add_key(_imp->homepage);
+ add_metadata_key(_imp->homepage);
}
_imp->contents.reset(new EContentsKey(shared_from_this(), "CONTENTS", "Contents",
_imp->dir / "CONTENTS", mkt_internal));
- add_key(_imp->contents);
+ add_metadata_key(_imp->contents);
_imp->installed_time.reset(new ECTimeKey(shared_from_this(), "INSTALLED_TIME", "Installed time",
_imp->dir / "CONTENTS", mkt_normal));
- add_key(_imp->installed_time);
+ add_metadata_key(_imp->installed_time);
if ((_imp->dir / "REPOSITORY").exists())
{
_imp->source_origin.reset(new EStringKey(shared_from_this(), "REPOSITORY", "Source repository",
file_contents(_imp->dir / "REPOSITORY"), mkt_normal));
- add_key(_imp->source_origin);
+ add_metadata_key(_imp->source_origin);
}
if ((_imp->dir / "BINARY_REPOSITORY").exists())
{
_imp->binary_origin.reset(new EStringKey(shared_from_this(), "BINARY_REPOSITORY", "Binary repository",
file_contents(_imp->dir / "BINARY_REPOSITORY"), mkt_normal));
- add_key(_imp->binary_origin);
+ add_metadata_key(_imp->binary_origin);
}
if ((_imp->dir / "ASFLAGS").exists())
{
_imp->asflags.reset(new EStringKey(shared_from_this(), "ASFLAGS", "ASFLAGS",
file_contents(_imp->dir / "ASFLAGS"), mkt_internal));
- add_key(_imp->asflags);
+ add_metadata_key(_imp->asflags);
}
if ((_imp->dir / "CBUILD").exists())
{
_imp->cbuild.reset(new EStringKey(shared_from_this(), "CBUILD", "CBUILD",
file_contents(_imp->dir / "CBUILD"), mkt_internal));
- add_key(_imp->cbuild);
+ add_metadata_key(_imp->cbuild);
}
if ((_imp->dir / "CFLAGS").exists())
{
_imp->cflags.reset(new EStringKey(shared_from_this(), "CFLAGS", "CFLAGS",
file_contents(_imp->dir / "CFLAGS"), mkt_internal));
- add_key(_imp->cflags);
+ add_metadata_key(_imp->cflags);
}
if ((_imp->dir / "CHOST").exists())
{
_imp->chost.reset(new EStringKey(shared_from_this(), "CHOST", "CHOST",
file_contents(_imp->dir / "CHOST"), mkt_internal));
- add_key(_imp->chost);
+ add_metadata_key(_imp->chost);
}
if ((_imp->dir / "CXXFLAGS").exists())
{
_imp->cxxflags.reset(new EStringKey(shared_from_this(), "CXXFLAGS", "CXXFLAGS",
file_contents(_imp->dir / "CXXFLAGS"), mkt_internal));
- add_key(_imp->cxxflags);
+ add_metadata_key(_imp->cxxflags);
}
if ((_imp->dir / "LDFLAGS").exists())
{
_imp->ldflags.reset(new EStringKey(shared_from_this(), "LDFLAGS", "LDFLAGS",
file_contents(_imp->dir / "LDFLAGS"), mkt_internal));
- add_key(_imp->ldflags);
+ add_metadata_key(_imp->ldflags);
}
if ((_imp->dir / "PKGMANAGER").exists())
{
_imp->pkgmanager.reset(new EStringKey(shared_from_this(), "PKGMANAGER", "Installed using",
file_contents(_imp->dir / "PKGMANAGER"), mkt_normal));
- add_key(_imp->pkgmanager);
+ add_metadata_key(_imp->pkgmanager);
}
if ((_imp->dir / "VDB_FORMAT").exists())
{
_imp->vdb_format.reset(new EStringKey(shared_from_this(), "VDB_FORMAT", "VDB Format",
file_contents(_imp->dir / "VDB_FORMAT"), mkt_internal));
- add_key(_imp->vdb_format);
+ add_metadata_key(_imp->vdb_format);
}
}
@@ -561,3 +564,97 @@ VDBID::extra_hash_value() const
return 0;
}
+namespace
+{
+ struct SupportsActionQuery :
+ ConstVisitor<SupportsActionTestVisitorTypes>
+ {
+ bool result;
+
+ SupportsActionQuery() :
+ result(false)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstalledAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<InstallAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<ConfigAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<PretendAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<UninstallAction> &)
+ {
+ result = true;
+ }
+ };
+}
+
+bool
+VDBID::supports_action(const SupportsActionTestBase & b) const
+{
+ SupportsActionQuery q;
+ b.accept(q);
+ return q.result;
+}
+
+namespace
+{
+ struct PerformAction :
+ ConstVisitor<ActionVisitorTypes>
+ {
+ const tr1::shared_ptr<const PackageID> id;
+
+ PerformAction(const tr1::shared_ptr<const PackageID> i) :
+ id(i)
+ {
+ }
+
+ void visit(const UninstallAction & a)
+ {
+ tr1::static_pointer_cast<const VDBRepository>(id->repository())->perform_uninstall(id,
+ a.options, false);
+ }
+
+ void visit(const InstalledAction &)
+ {
+ }
+
+ void visit(const ConfigAction &)
+ {
+ tr1::static_pointer_cast<const VDBRepository>(id->repository())->perform_config(id);
+ }
+
+ void visit(const InstallAction & a) PALUDIS_ATTRIBUTE((noreturn));
+ void visit(const PretendAction & a) PALUDIS_ATTRIBUTE((noreturn));
+ };
+
+ void PerformAction::visit(const InstallAction & a)
+ {
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void PerformAction::visit(const PretendAction & a)
+ {
+ throw UnsupportedActionError(*id, a);
+ }
+}
+
+void
+VDBID::perform_action(Action & a) const
+{
+ PerformAction b(shared_from_this());
+ a.accept(b);
+}
+
diff --git a/paludis/repositories/e/vdb_id.hh b/paludis/repositories/e/vdb_id.hh
index 3eee1cd..a0c46b6 100644
--- a/paludis/repositories/e/vdb_id.hh
+++ b/paludis/repositories/e/vdb_id.hh
@@ -78,6 +78,9 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const;
+ virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual void perform_action(Action &) const;
+
virtual bool arbitrary_less_than_comparison(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index e2f2589..b7837da 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -23,6 +23,7 @@
#include <paludis/repositories/e/vdb_id.hh>
#include <paludis/repositories/e/eapi_phase.hh>
+#include <paludis/action.hh>
#include <paludis/config_file.hh>
#include <paludis/dep_spec.hh>
#include <paludis/dep_spec_flattener.hh>
@@ -125,12 +126,10 @@ namespace paludis
VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
Repository(RepositoryName("installed"),
RepositoryCapabilities::create()
- .installable_interface(0)
.installed_interface(this)
.mask_interface(0)
.sets_interface(this)
.syncable_interface(0)
- .uninstallable_interface(this)
.use_interface(this)
.world_interface(this)
.environment_variable_interface(this)
@@ -138,10 +137,8 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
.provides_interface(this)
.virtuals_interface(0)
.destination_interface(this)
- .config_interface(this)
.licenses_interface(0)
.e_interface(0)
- .pretend_interface(0)
.make_virtuals_interface(0)
.qa_interface(0)
.hook_interface(this),
@@ -332,14 +329,8 @@ VDBRepositoryKeyReadError::VDBRepositoryKeyReadError(
}
void
-VDBRepository::do_uninstall(const tr1::shared_ptr<const PackageID> & id, const UninstallOptions & o) const
-{
- _uninstall(id, o, false);
-}
-
-void
-VDBRepository::_uninstall(const tr1::shared_ptr<const PackageID> & id,
- const UninstallOptions & o, bool reinstalling) const
+VDBRepository::perform_uninstall(const tr1::shared_ptr<const PackageID> & id,
+ const UninstallActionOptions & o, bool reinstalling) const
{
Context context("When uninstalling '" + stringify(*id) + (reinstalling ? "' for a reinstall:" : "':"));
@@ -424,7 +415,7 @@ VDBRepository::_uninstall(const tr1::shared_ptr<const PackageID> & id,
}
void
-VDBRepository::do_config(const tr1::shared_ptr<const PackageID> & id) const
+VDBRepository::perform_config(const tr1::shared_ptr<const PackageID> & id) const
{
Context context("When configuring '" + stringify(*id) + "':");
@@ -1009,8 +1000,8 @@ VDBRepository::merge(const MergeOptions & m)
if (is_replace)
{
- UninstallOptions uninstall_options(false);
- _uninstall(m.package_id, uninstall_options, true);
+ UninstallActionOptions uninstall_options(false);
+ perform_uninstall(m.package_id, uninstall_options, true);
}
VDBPostMergeCommand post_merge_command(
@@ -1116,3 +1107,48 @@ VDBRepository::package_id_if_exists(const QualifiedPackageName & q, const Versio
return *i;
}
+namespace
+{
+ struct SupportsActionQuery :
+ ConstVisitor<SupportsActionTestVisitorTypes>
+ {
+ bool result;
+
+ SupportsActionQuery() :
+ result(false)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstalledAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<InstallAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<ConfigAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<PretendAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<UninstallAction> &)
+ {
+ result = true;
+ }
+ };
+}
+
+bool
+VDBRepository::do_some_ids_might_support_action(const SupportsActionTestBase & a) const
+{
+ SupportsActionQuery q;
+ a.accept(q);
+ return q.result;
+}
+
diff --git a/paludis/repositories/e/vdb_repository.hh b/paludis/repositories/e/vdb_repository.hh
index 4adc995..74ca391 100644
--- a/paludis/repositories/e/vdb_repository.hh
+++ b/paludis/repositories/e/vdb_repository.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_VDB_REPOSITORY_HH 1
#include <paludis/repository.hh>
+#include <paludis/action-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/fs_entry.hh>
@@ -50,13 +51,11 @@ namespace paludis
public Repository,
public RepositoryInstalledInterface,
public RepositoryUseInterface,
- public RepositoryUninstallableInterface,
public RepositorySetsInterface,
public RepositoryWorldInterface,
public RepositoryEnvironmentVariableInterface,
public RepositoryProvidesInterface,
public RepositoryDestinationInterface,
- public RepositoryConfigInterface,
public RepositoryHookInterface,
public tr1::enable_shared_from_this<VDBRepository>,
public PrivateImplementationPattern<VDBRepository>
@@ -67,9 +66,6 @@ namespace paludis
void regenerate_provides_cache() const;
- void _uninstall(const tr1::shared_ptr<const PackageID> &, const UninstallOptions &,
- bool reinstalling) const;
-
void need_category_names() const;
void need_package_ids(const CategoryNamePart &) const;
@@ -124,10 +120,6 @@ namespace paludis
virtual tr1::shared_ptr<const SetNameSet> sets_list() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- /* RepositoryUninstallableInterface */
-
- virtual void do_uninstall(const tr1::shared_ptr<const PackageID> &, const UninstallOptions &) const;
-
/* RepositoryWorldInterface */
virtual void add_to_world(const QualifiedPackageName &) const;
@@ -163,10 +155,6 @@ namespace paludis
virtual void merge(const MergeOptions &);
- /* RepositoryConfigInterface */
-
- virtual void do_config(const tr1::shared_ptr<const PackageID> &) const;
-
/* RepositoryHookInterface */
virtual HookResult perform_hook(const Hook & hook) const
@@ -211,6 +199,8 @@ namespace paludis
virtual bool do_has_category_named(const CategoryNamePart &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool do_some_ids_might_support_action(const SupportsActionTestBase &) const;
+
public:
/**
* Constructor.
@@ -232,6 +222,17 @@ namespace paludis
virtual void invalidate();
virtual void regenerate_cache() const;
+
+ ///\name For use by VDBID
+ ///\{
+
+ void perform_uninstall(const tr1::shared_ptr<const PackageID> & id,
+ const UninstallActionOptions & o, bool reinstalling) const;
+
+ void perform_config(const tr1::shared_ptr<const PackageID> & id) const;
+
+ ///\}
+
};
/**
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index d5418be..6b8ec69 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -22,11 +22,14 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/environment.hh>
#include <paludis/dep_spec_flattener.hh>
+#include <paludis/action.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -34,23 +37,19 @@ using namespace paludis;
FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, const RepositoryName & our_name) :
FakeRepositoryBase(e, our_name, RepositoryCapabilities::create()
- .installable_interface(0)
.installed_interface(this)
.mask_interface(this)
.sets_interface(this)
.syncable_interface(0)
- .uninstallable_interface(0)
.use_interface(this)
.world_interface(0)
.mirrors_interface(0)
.environment_variable_interface(0)
.provides_interface(this)
.virtuals_interface(0)
- .config_interface(0)
.destination_interface(this)
.licenses_interface(0)
.e_interface(0)
- .pretend_interface(0)
.make_virtuals_interface(0)
.qa_interface(0)
.hook_interface(0),
@@ -125,9 +124,46 @@ FakeInstalledRepository::merge(const MergeOptions &)
{
}
-time_t
-FakeInstalledRepository::do_installed_time(const PackageID &) const
+namespace
+{
+ struct SupportsActionQuery :
+ ConstVisitor<SupportsActionTestVisitorTypes>
+ {
+ bool result;
+
+ SupportsActionQuery() :
+ result(false)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstalledAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<InstallAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<ConfigAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<PretendAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<UninstallAction> &)
+ {
+ }
+ };
+}
+
+bool
+FakeInstalledRepository::do_some_ids_might_support_action(const SupportsActionTestBase & a) const
{
- return 0;
+ SupportsActionQuery q;
+ a.accept(q);
+ return q.result;
}
diff --git a/paludis/repositories/fake/fake_installed_repository.hh b/paludis/repositories/fake/fake_installed_repository.hh
index 58bb394..9e2e381 100644
--- a/paludis/repositories/fake/fake_installed_repository.hh
+++ b/paludis/repositories/fake/fake_installed_repository.hh
@@ -36,9 +36,9 @@ namespace paludis
public RepositoryProvidesInterface
{
protected:
- /* RepositoryInstalledInterface */
+ virtual bool do_some_ids_might_support_action(const SupportsActionTestBase &) const;
- virtual time_t do_installed_time(const PackageID &) const;
+ /* RepositoryInstalledInterface */
virtual FSEntry root() const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 52b3b4f..3547e7e 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -21,6 +21,7 @@
#include <paludis/repositories/fake/fake_repository_base.hh>
#include <paludis/eapi.hh>
#include <paludis/name.hh>
+#include <paludis/action.hh>
#include <paludis/version_spec.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/hashed_containers.hh>
@@ -233,14 +234,14 @@ FakePackageID::FakePackageID(const tr1::shared_ptr<const FakeRepositoryBase> & r
PrivateImplementationPattern<FakePackageID>(new Implementation<FakePackageID>(r, q, v)),
_imp(PrivateImplementationPattern<FakePackageID>::_imp.get())
{
- add_key(_imp->keywords);
- add_key(_imp->iuse);
- add_key(_imp->license);
- add_key(_imp->provide);
- add_key(_imp->build_dependencies);
- add_key(_imp->run_dependencies);
- add_key(_imp->post_dependencies);
- add_key(_imp->suggested_dependencies);
+ add_metadata_key(_imp->keywords);
+ add_metadata_key(_imp->iuse);
+ add_metadata_key(_imp->license);
+ add_metadata_key(_imp->provide);
+ add_metadata_key(_imp->build_dependencies);
+ add_metadata_key(_imp->run_dependencies);
+ add_metadata_key(_imp->post_dependencies);
+ add_metadata_key(_imp->suggested_dependencies);
}
FakePackageID::~FakePackageID()
@@ -489,6 +490,68 @@ FakePackageID::extra_hash_value() const
return CRCHash<SlotName>()(slot());
}
+bool
+FakePackageID::supports_action(const SupportsActionTestBase & b) const
+{
+ return repository()->some_ids_might_support_action(b);
+}
+
+namespace
+{
+ struct PerformAction :
+ ConstVisitor<ActionVisitorTypes>
+ {
+ const PackageID * const id;
+
+ PerformAction(const PackageID * const i) :
+ id(i)
+ {
+ }
+
+ void visit(const InstallAction & a)
+ {
+ SupportsActionTest<InstallAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const InstalledAction & a)
+ {
+ SupportsActionTest<InstalledAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const UninstallAction & a)
+ {
+ SupportsActionTest<UninstallAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const ConfigAction & a)
+ {
+ SupportsActionTest<ConfigAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const PretendAction & a)
+ {
+ SupportsActionTest<PretendAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+ };
+}
+
+void
+FakePackageID::perform_action(Action & a) const
+{
+ PerformAction b(this);
+ a.accept(b);
+}
+
template class FakeMetadataSpecTreeKey<LicenseSpecTree>;
template class FakeMetadataSpecTreeKey<ProvideSpecTree>;
template class FakeMetadataSpecTreeKey<DependencySpecTree>;
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 26b6c29..8c9f54e 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -156,6 +156,10 @@ namespace paludis
virtual bool arbitrary_less_than_comparison(const PackageID &) const;
virtual std::size_t extra_hash_value() const;
+
+ virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual void perform_action(Action &) const;
+
};
}
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index d24b5de..d6658dc 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -21,11 +21,14 @@
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/distribution.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
+#include <paludis/action.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -49,12 +52,10 @@ namespace paludis
FakeRepository::FakeRepository(const Environment * const e, const RepositoryName & our_name) :
PrivateImplementationPattern<FakeRepository>(new Implementation<FakeRepository>),
FakeRepositoryBase(e, our_name, RepositoryCapabilities::create()
- .installable_interface(this)
.installed_interface(0)
.mask_interface(this)
.sets_interface(this)
.syncable_interface(0)
- .uninstallable_interface(0)
.use_interface(this)
.world_interface(0)
.mirrors_interface(0)
@@ -62,11 +63,9 @@ FakeRepository::FakeRepository(const Environment * const e, const RepositoryName
.provides_interface(0)
.virtuals_interface(DistributionData::get_instance()->distribution_from_string(
e->default_distribution())->support_old_style_virtuals ? this : 0)
- .config_interface(0)
.destination_interface(0)
.licenses_interface(0)
.e_interface(0)
- .pretend_interface(0)
.make_virtuals_interface(0)
.qa_interface(0)
.hook_interface(0),
@@ -79,11 +78,6 @@ FakeRepository::~FakeRepository()
{
}
-void
-FakeRepository::do_install(const tr1::shared_ptr<const PackageID> &, const InstallOptions &) const
-{
-}
-
tr1::shared_ptr<const FakeRepository::VirtualsSequence>
FakeRepository::virtual_packages() const
{
@@ -110,3 +104,46 @@ void register_repositories(RepositoryMaker *)
{
}
+namespace
+{
+ struct SupportsActionQuery :
+ ConstVisitor<SupportsActionTestVisitorTypes>
+ {
+ bool result;
+
+ SupportsActionQuery() :
+ result(false)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstalledAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstallAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<ConfigAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<PretendAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<UninstallAction> &)
+ {
+ }
+ };
+}
+
+bool
+FakeRepository::do_some_ids_might_support_action(const SupportsActionTestBase & a) const
+{
+ SupportsActionQuery q;
+ a.accept(q);
+ return q.result;
+}
+
diff --git a/paludis/repositories/fake/fake_repository.hh b/paludis/repositories/fake/fake_repository.hh
index c28afcb..6391739 100644
--- a/paludis/repositories/fake/fake_repository.hh
+++ b/paludis/repositories/fake/fake_repository.hh
@@ -32,16 +32,13 @@ namespace paludis
class PALUDIS_VISIBLE FakeRepository :
private PrivateImplementationPattern<FakeRepository>,
public FakeRepositoryBase,
- public RepositoryInstallableInterface,
public RepositoryVirtualsInterface
{
private:
Implementation<FakeRepository> * const _imp;
protected:
- /* RepositoryInstallableInterface */
-
- virtual void do_install(const tr1::shared_ptr<const PackageID> &, const InstallOptions &) const;
+ virtual bool do_some_ids_might_support_action(const SupportsActionTestBase &) const;
public:
///\name Basic operations
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index da07a71..4011dec 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_FAKE_REPOSITORY_BASE_HH 1
#include <paludis/repository.hh>
+#include <paludis/action-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
/** \file
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index 1c84f64..4a54e55 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -28,6 +28,7 @@
#include <paludis/version_spec.hh>
#include <paludis/repository.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/action.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -275,16 +276,16 @@ GemSpecification::GemSpecification(const tr1::shared_ptr<const Repository> & r,
node.accept(v);
if (_imp->summary_key)
- add_key(_imp->summary_key);
+ add_metadata_key(_imp->summary_key);
if (_imp->description_key)
- add_key(_imp->description_key);
+ add_metadata_key(_imp->description_key);
if (_imp->authors_key)
- add_key(_imp->authors_key);
+ add_metadata_key(_imp->authors_key);
if (_imp->rubyforge_project_key)
- add_key(_imp->rubyforge_project_key);
+ add_metadata_key(_imp->rubyforge_project_key);
}
@@ -537,3 +538,65 @@ InstalledGemsRepository::need_version_metadata(const QualifiedPackageName & q, c
}
#endif
+bool
+GemSpecification::supports_action(const SupportsActionTestBase & b) const
+{
+ return repository()->some_ids_might_support_action(b);
+}
+
+namespace
+{
+ struct PerformAction :
+ ConstVisitor<ActionVisitorTypes>
+ {
+ const PackageID * const id;
+
+ PerformAction(const PackageID * const i) :
+ id(i)
+ {
+ }
+
+ void visit(const InstallAction & a)
+ {
+ SupportsActionTest<InstallAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const InstalledAction & a)
+ {
+ SupportsActionTest<InstalledAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const UninstallAction & a)
+ {
+ SupportsActionTest<UninstallAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const ConfigAction & a)
+ {
+ SupportsActionTest<ConfigAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const PretendAction & a)
+ {
+ SupportsActionTest<PretendAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+ };
+}
+
+void
+GemSpecification::perform_action(Action & a) const
+{
+ PerformAction b(this);
+ a.accept(b);
+}
+
diff --git a/paludis/repositories/gems/gem_specification.hh b/paludis/repositories/gems/gem_specification.hh
index c1d0322..e9ae86f 100644
--- a/paludis/repositories/gems/gem_specification.hh
+++ b/paludis/repositories/gems/gem_specification.hh
@@ -113,6 +113,9 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const;
+ virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual void perform_action(Action &) const;
+
virtual bool arbitrary_less_than_comparison(const PackageID &) const;
virtual std::size_t extra_hash_value() const;
};
diff --git a/paludis/repositories/gems/gem_specification_TEST.cc b/paludis/repositories/gems/gem_specification_TEST.cc
index 2ed677b..06bc812 100644
--- a/paludis/repositories/gems/gem_specification_TEST.cc
+++ b/paludis/repositories/gems/gem_specification_TEST.cc
@@ -124,13 +124,13 @@ namespace test_cases
TEST_CHECK_EQUAL(spec.short_description_key()->value(), "This is the summary");
TEST_CHECK_EQUAL(spec.name(), QualifiedPackageName("gems/demo"));
TEST_CHECK_EQUAL(spec.version(), VersionSpec("1.2.3"));
- TEST_CHECK(spec.find("rubyforge_project") == spec.end());
+ TEST_CHECK(spec.find_metadata("rubyforge_project") == spec.end_metadata());
TEST_CHECK(spec.long_description_key());
TEST_CHECK_EQUAL(spec.long_description_key()->value(), "A longer description");
- TEST_CHECK(spec.find("authors") != spec.end());
+ TEST_CHECK(spec.find_metadata("authors") != spec.end_metadata());
ExtractValueVisitor v;
- spec.find("authors")->accept(v);
+ spec.find_metadata("authors")->accept(v);
TEST_CHECK_EQUAL(v.s, "Fred, Barney");
#if 0
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index a3f3f7b..94dab62 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -29,8 +29,10 @@
#include <paludis/util/system.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/eapi.hh>
#include <paludis/hashed_containers.hh>
+#include <paludis/action.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include <fstream>
@@ -64,23 +66,19 @@ GemsRepository::GemsRepository(const gems::RepositoryParams & params) :
Repository(RepositoryName("gems"),
RepositoryCapabilities::create()
.mask_interface(0)
- .installable_interface(this)
.installed_interface(0)
.sets_interface(0)
.syncable_interface(0)
- .uninstallable_interface(0)
.use_interface(0)
.world_interface(0)
.environment_variable_interface(0)
.mirrors_interface(0)
.virtuals_interface(0)
.provides_interface(0)
- .config_interface(0)
.destination_interface(0)
.licenses_interface(0)
.e_interface(0)
.qa_interface(0)
- .pretend_interface(0)
.make_virtuals_interface(0)
.hook_interface(0),
"gems"),
@@ -211,6 +209,7 @@ GemsRepository::need_ids() const
_imp->has_ids = true;
}
+#if 0
void
GemsRepository::do_install(const tr1::shared_ptr<const PackageID> & id, const InstallOptions & o) const
{
@@ -225,4 +224,48 @@ GemsRepository::do_install(const tr1::shared_ptr<const PackageID> & id, const In
if (0 != run_command(cmd))
throw PackageInstallActionError("Install of '" + stringify(*id) + "' failed");
}
+#endif
+
+namespace
+{
+ struct SupportsActionQuery :
+ ConstVisitor<SupportsActionTestVisitorTypes>
+ {
+ bool result;
+
+ SupportsActionQuery() :
+ result(false)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstalledAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstallAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<ConfigAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<PretendAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<UninstallAction> &)
+ {
+ }
+ };
+}
+
+bool
+GemsRepository::do_some_ids_might_support_action(const SupportsActionTestBase & a) const
+{
+ SupportsActionQuery q;
+ a.accept(q);
+ return q.result;
+}
diff --git a/paludis/repositories/gems/gems_repository.hh b/paludis/repositories/gems/gems_repository.hh
index fff0e17..bef9627 100644
--- a/paludis/repositories/gems/gems_repository.hh
+++ b/paludis/repositories/gems/gems_repository.hh
@@ -35,7 +35,6 @@ namespace paludis
*/
class PALUDIS_VISIBLE GemsRepository :
public Repository,
- public RepositoryInstallableInterface,
private PrivateImplementationPattern<GemsRepository>,
public tr1::enable_shared_from_this<GemsRepository>
{
@@ -44,10 +43,6 @@ namespace paludis
void need_ids() const;
protected:
- /* RepositoryInstallableInterface */
-
- virtual void do_install(const tr1::shared_ptr<const PackageID> &, const InstallOptions &) const;
-
/* Repository */
virtual tr1::shared_ptr<const PackageIDSequence> do_package_ids(
@@ -67,6 +62,8 @@ namespace paludis
virtual bool do_has_category_named(const CategoryNamePart &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool do_some_ids_might_support_action(const SupportsActionTestBase &) const;
+
public:
/**
* Constructor.
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index afc1ce6..517cb68 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -32,11 +32,13 @@
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/pstream.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/util/system.hh>
#include <paludis/util/log.hh>
#include <paludis/util/strip.hh>
#include <paludis/hashed_containers.hh>
#include <paludis/eapi.hh>
+#include <paludis/action.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -72,24 +74,20 @@ InstalledGemsRepository::InstalledGemsRepository(const gems::InstalledRepository
Repository(RepositoryName("installed-gems"),
RepositoryCapabilities::create()
.mask_interface(0)
- .installable_interface(0)
.installed_interface(this)
.sets_interface(0)
.syncable_interface(0)
- .uninstallable_interface(this)
.use_interface(0)
.world_interface(0)
.environment_variable_interface(0)
.mirrors_interface(0)
.virtuals_interface(0)
.provides_interface(0)
- .config_interface(0)
.destination_interface(this)
.licenses_interface(0)
.e_interface(0)
.qa_interface(0)
.make_virtuals_interface(0)
- .pretend_interface(0)
.hook_interface(0),
"installed_gems"),
PrivateImplementationPattern<InstalledGemsRepository>(new Implementation<InstalledGemsRepository>(params))
@@ -249,6 +247,7 @@ InstalledGemsRepository::root() const
return FSEntry("/");
}
+#if 0
void
InstalledGemsRepository::do_uninstall(const tr1::shared_ptr<const PackageID> & id,
const UninstallOptions &) const
@@ -261,10 +260,49 @@ InstalledGemsRepository::do_uninstall(const tr1::shared_ptr<const PackageID> & i
if (0 != run_command(cmd))
throw PackageInstallActionError("Uninstall of '" + stringify(*id) + "' failed");
}
+#endif
-time_t
-InstalledGemsRepository::do_installed_time(const PackageID &) const
+namespace
{
- return 0;
+ struct SupportsActionQuery :
+ ConstVisitor<SupportsActionTestVisitorTypes>
+ {
+ bool result;
+
+ SupportsActionQuery() :
+ result(false)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstalledAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<InstallAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<ConfigAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<PretendAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<UninstallAction> &)
+ {
+ result = true;
+ }
+ };
+}
+
+bool
+InstalledGemsRepository::do_some_ids_might_support_action(const SupportsActionTestBase & a) const
+{
+ SupportsActionQuery q;
+ a.accept(q);
+ return q.result;
}
diff --git a/paludis/repositories/gems/installed_gems_repository.hh b/paludis/repositories/gems/installed_gems_repository.hh
index 7956d6d..eea593c 100644
--- a/paludis/repositories/gems/installed_gems_repository.hh
+++ b/paludis/repositories/gems/installed_gems_repository.hh
@@ -37,7 +37,6 @@ namespace paludis
public Repository,
public RepositoryDestinationInterface,
public RepositoryInstalledInterface,
- public RepositoryUninstallableInterface,
public tr1::enable_shared_from_this<InstalledGemsRepository>,
private PrivateImplementationPattern<InstalledGemsRepository>
{
@@ -48,14 +47,8 @@ namespace paludis
protected:
/* RepositoryInstalledInterface */
- virtual time_t do_installed_time(const PackageID &) const;
-
virtual FSEntry root() const PALUDIS_ATTRIBUTE((warn_unused_result));
- /* RepositoryUninstallableInterface */
-
- virtual void do_uninstall(const tr1::shared_ptr<const PackageID> &, const UninstallOptions &) const;
-
/* Repository */
virtual tr1::shared_ptr<const PackageIDSequence> do_package_ids(
@@ -75,6 +68,8 @@ namespace paludis
virtual bool do_has_category_named(const CategoryNamePart &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool do_some_ids_might_support_action(const SupportsActionTestBase &) const;
+
public:
/**
* Constructor.
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index c88e17f..bcbda23 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -24,6 +24,7 @@
#include <paludis/hashed_containers.hh>
#include <paludis/hook.hh>
#include <paludis/package_database.hh>
+#include <paludis/action.hh>
#include <paludis/repository_info.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/fs_entry.hh>
@@ -31,6 +32,7 @@
#include <paludis/util/tr1_functional.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/util/map.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
@@ -98,24 +100,20 @@ namespace
InstalledVirtualsRepository::InstalledVirtualsRepository(const Environment * const env,
const FSEntry & r) :
Repository(RepositoryName(make_name(r)), RepositoryCapabilities::create()
- .installable_interface(0)
.mask_interface(0)
.installed_interface(this)
.use_interface(0)
.sets_interface(0)
.syncable_interface(0)
- .uninstallable_interface(0)
.mirrors_interface(0)
.environment_variable_interface(0)
.world_interface(0)
.provides_interface(0)
.virtuals_interface(0)
- .config_interface(0)
.destination_interface(0)
.licenses_interface(0)
.e_interface(0)
.make_virtuals_interface(0)
- .pretend_interface(0)
.qa_interface(0)
.hook_interface(this),
"installed_virtuals"),
@@ -156,7 +154,7 @@ InstalledVirtualsRepository::need_ids() const
if (i == _imp->ids.end())
i = _imp->ids.insert(std::make_pair(p->virtual_name, make_shared_ptr(new PackageIDSequence))).first;
- tr1::shared_ptr<const PackageID> id(new virtuals::VirtualsPackageID(shared_from_this(), p->virtual_name, p->provided_by));
+ tr1::shared_ptr<const PackageID> id(new virtuals::VirtualsPackageID(shared_from_this(), p->virtual_name, p->provided_by, false));
i->second->push_back(id);
}
}
@@ -268,3 +266,47 @@ InstalledVirtualsRepository::can_be_favourite_repository() const
return false;
}
+namespace
+{
+ struct SupportsActionQuery :
+ ConstVisitor<SupportsActionTestVisitorTypes>
+ {
+ bool result;
+
+ SupportsActionQuery() :
+ result(false)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstalledAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<InstallAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<ConfigAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<PretendAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<UninstallAction> &)
+ {
+ }
+ };
+}
+
+bool
+InstalledVirtualsRepository::do_some_ids_might_support_action(const SupportsActionTestBase & a) const
+{
+ SupportsActionQuery q;
+ a.accept(q);
+ return q.result;
+}
+
+
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.hh b/paludis/repositories/virtuals/installed_virtuals_repository.hh
index db4813e..8e8fa77 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.hh
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.hh
@@ -66,6 +66,8 @@ namespace paludis
virtual bool do_has_category_named(const CategoryNamePart &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool do_some_ids_might_support_action(const SupportsActionTestBase &) const;
+
public:
///\name Basic operations
//\{
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 5cf0f11..e4b8bf9 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -23,12 +23,14 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/name.hh>
#include <paludis/dep_spec.hh>
#include <paludis/version_spec.hh>
#include <paludis/version_requirements.hh>
#include <paludis/metadata_key.hh>
#include <paludis/hashed_containers.hh>
+#include <paludis/action.hh>
using namespace paludis;
using namespace paludis::virtuals;
@@ -122,13 +124,14 @@ namespace paludis
Implementation(
const tr1::shared_ptr<const Repository> & o,
const QualifiedPackageName & n,
- const tr1::shared_ptr<const PackageID> & p) :
+ const tr1::shared_ptr<const PackageID> & p,
+ const bool b) :
repository(o),
name(n),
version(p->version()),
virtual_for(new virtuals::VirtualsPackageIDKey(p)),
- bdep(new virtuals::VirtualsDepKey("DEPEND", "Build dependencies", p, o->installable_interface)),
- rdep(new virtuals::VirtualsDepKey("RDEPEND", "Run dependencies", p, o->installable_interface))
+ bdep(new virtuals::VirtualsDepKey("DEPEND", "Build dependencies", p, b)),
+ rdep(new virtuals::VirtualsDepKey("RDEPEND", "Run dependencies", p, b))
{
}
};
@@ -137,14 +140,15 @@ namespace paludis
VirtualsPackageID::VirtualsPackageID(
const tr1::shared_ptr<const Repository> & owner,
const QualifiedPackageName & virtual_name,
- const tr1::shared_ptr<const PackageID> & virtual_for) :
+ const tr1::shared_ptr<const PackageID> & virtual_for,
+ const bool exact) :
PrivateImplementationPattern<VirtualsPackageID>(
- new Implementation<VirtualsPackageID>(owner, virtual_name, virtual_for)),
+ new Implementation<VirtualsPackageID>(owner, virtual_name, virtual_for, exact)),
_imp(PrivateImplementationPattern<VirtualsPackageID>::_imp.get())
{
- add_key(_imp->virtual_for);
- add_key(_imp->bdep);
- add_key(_imp->rdep);
+ add_metadata_key(_imp->virtual_for);
+ add_metadata_key(_imp->bdep);
+ add_metadata_key(_imp->rdep);
}
VirtualsPackageID::~VirtualsPackageID()
@@ -349,3 +353,65 @@ VirtualsPackageID::need_keys_added() const
{
}
+namespace
+{
+ struct PerformAction :
+ ConstVisitor<ActionVisitorTypes>
+ {
+ const PackageID * const id;
+
+ PerformAction(const PackageID * const i) :
+ id(i)
+ {
+ }
+
+ void visit(const InstallAction & a)
+ {
+ SupportsActionTest<InstallAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const InstalledAction & a)
+ {
+ SupportsActionTest<InstalledAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const UninstallAction & a)
+ {
+ SupportsActionTest<UninstallAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const ConfigAction & a)
+ {
+ SupportsActionTest<ConfigAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
+ void visit(const PretendAction & a)
+ {
+ SupportsActionTest<PretendAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+ };
+}
+
+void
+VirtualsPackageID::perform_action(Action & a) const
+{
+ PerformAction b(this);
+ a.accept(b);
+}
+
+bool
+VirtualsPackageID::supports_action(const SupportsActionTestBase & b) const
+{
+ return repository()->some_ids_might_support_action(b);
+}
+
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index 535196f..7134451 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -73,7 +73,8 @@ namespace paludis
VirtualsPackageID(
const tr1::shared_ptr<const Repository> & repo,
const QualifiedPackageName & virtual_name,
- const tr1::shared_ptr<const PackageID> & virtual_for);
+ const tr1::shared_ptr<const PackageID> & virtual_for,
+ const bool exact);
virtual ~VirtualsPackageID();
@@ -107,6 +108,9 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataStringKey> source_origin_key() const;
virtual const tr1::shared_ptr<const MetadataStringKey> binary_origin_key() const;
+ virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual void perform_action(Action &) const;
+
virtual bool arbitrary_less_than_comparison(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index b8c255e..3b2617a 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -26,6 +26,7 @@
#include <paludis/package_database.hh>
#include <paludis/query.hh>
#include <paludis/repository_info.hh>
+#include <paludis/action.hh>
#include <paludis/util/log.hh>
#include <paludis/util/make_shared_ptr.hh>
@@ -35,6 +36,7 @@
#include <paludis/util/map.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/visitor-impl.hh>
#include <vector>
#include <utility>
@@ -93,23 +95,19 @@ namespace
VirtualsRepository::VirtualsRepository(const Environment * const env) :
Repository(RepositoryName("virtuals"), RepositoryCapabilities::create()
- .installable_interface(this)
.mask_interface(0)
.installed_interface(0)
.use_interface(0)
.sets_interface(0)
.syncable_interface(0)
- .uninstallable_interface(0)
.mirrors_interface(0)
.environment_variable_interface(0)
.world_interface(0)
.provides_interface(0)
.virtuals_interface(0)
.destination_interface(0)
- .config_interface(0)
.licenses_interface(0)
.e_interface(0)
- .pretend_interface(0)
.make_virtuals_interface(this)
.qa_interface(0)
.hook_interface(0),
@@ -201,7 +199,9 @@ VirtualsRepository::need_ids() const
v(_imp->names.begin()), v_end(_imp->names.end()) ; v != v_end ; ++v)
{
tr1::shared_ptr<const PackageIDSequence> matches(_imp->env->package_database()->query(
- query::Matches(*v->second) & query::RepositoryHasInstallableInterface(), qo_order_by_version));
+ query::Matches(*v->second) &
+ query::SupportsAction<InstallAction>(),
+ qo_order_by_version));
if (matches->empty())
Log::get_instance()->message(ll_warning, lc_context, "No packages matching '"
@@ -301,11 +301,6 @@ VirtualsRepository::invalidate()
_imp.reset(new Implementation<VirtualsRepository>(_imp->env));
}
-void
-VirtualsRepository::do_install(const tr1::shared_ptr<const PackageID> &, const InstallOptions &) const
-{
-}
-
const tr1::shared_ptr<const PackageID>
VirtualsRepository::make_virtual_package_id(
const QualifiedPackageName & virtual_name, const tr1::shared_ptr<const PackageID> & provider) const
@@ -314,7 +309,7 @@ VirtualsRepository::make_virtual_package_id(
throw InternalError(PALUDIS_HERE, "tried to make a virtual package id using '" + stringify(virtual_name) + "', '"
+ stringify(*provider) + "'");
- return make_shared_ptr(new virtuals::VirtualsPackageID(shared_from_this(), virtual_name, provider));
+ return make_shared_ptr(new virtuals::VirtualsPackageID(shared_from_this(), virtual_name, provider, true));
}
bool
@@ -323,3 +318,46 @@ VirtualsRepository::can_be_favourite_repository() const
return false;
}
+namespace
+{
+ struct SupportsActionQuery :
+ ConstVisitor<SupportsActionTestVisitorTypes>
+ {
+ bool result;
+
+ SupportsActionQuery() :
+ result(false)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstalledAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<InstallAction> &)
+ {
+ result = true;
+ }
+
+ void visit(const SupportsActionTest<ConfigAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<PretendAction> &)
+ {
+ }
+
+ void visit(const SupportsActionTest<UninstallAction> &)
+ {
+ }
+ };
+}
+
+bool
+VirtualsRepository::do_some_ids_might_support_action(const SupportsActionTestBase & a) const
+{
+ SupportsActionQuery q;
+ a.accept(q);
+ return q.result;
+}
+
diff --git a/paludis/repositories/virtuals/virtuals_repository.hh b/paludis/repositories/virtuals/virtuals_repository.hh
index 872b1cf..e1c30ac 100644
--- a/paludis/repositories/virtuals/virtuals_repository.hh
+++ b/paludis/repositories/virtuals/virtuals_repository.hh
@@ -33,7 +33,6 @@ namespace paludis
*/
class PALUDIS_VISIBLE VirtualsRepository :
public Repository,
- public RepositoryInstallableInterface,
public RepositoryMakeVirtualsInterface,
private PrivateImplementationPattern<VirtualsRepository>,
public tr1::enable_shared_from_this<VirtualsRepository>
@@ -43,10 +42,6 @@ namespace paludis
void need_ids() const;
protected:
- /* RepositoryInstallableInterface */
-
- virtual void do_install(const tr1::shared_ptr<const PackageID> &, const InstallOptions &) const;
-
/* Repository */
virtual tr1::shared_ptr<const PackageIDSequence> do_package_ids(
@@ -66,6 +61,8 @@ namespace paludis
virtual bool do_has_category_named(const CategoryNamePart &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool do_some_ids_might_support_action(const SupportsActionTestBase &) const;
+
/* RepositoryMakeVirtualsInterface */
virtual const tr1::shared_ptr<const PackageID> make_virtual_package_id(
diff --git a/paludis/repository-fwd.hh b/paludis/repository-fwd.hh
index 06ca2e7..d19d772 100644
--- a/paludis/repository-fwd.hh
+++ b/paludis/repository-fwd.hh
@@ -32,12 +32,10 @@ namespace paludis
class HookResult;
class Repository;
- class RepositoryInstallableInterface;
class RepositoryInstalledInterface;
class RepositoryMaskInterface;
class RepositorySetsInterface;
class RepositorySyncableInterface;
- class RepositoryUninstallableInterface;
class RepositoryUseInterface;
class RepositoryWorldInterface;
class RepositoryEnvironmentVariableInterface;
@@ -46,16 +44,12 @@ namespace paludis
class RepositoryVirtualsInterface;
class RepositoryMakeVirtualsInterface;
class RepositoryDestinationInterface;
- class RepositoryConfigInterface;
- class RepositoryPretendInterface;
class RepositoryLicensesInterface;
class RepositoryEInterface;
class RepositoryHookInterface;
class RepositoryQAInterface;
- class InstallOptions;
class MergeOptions;
- class UninstallOptions;
/**
* A set of destinations.
@@ -63,18 +57,6 @@ namespace paludis
* \ingroup grpdepresolver
*/
typedef Set<paludis::tr1::shared_ptr<Repository> > DestinationsSet;
-
- /**
- * What debug build option to use when installing a package.
- *
- * \ingroup grprepository
- */
- enum InstallDebugOption
- {
- ido_none,
- ido_split,
- ido_internal
- };
}
#endif
diff --git a/paludis/repository.cc b/paludis/repository.cc
index 6fe2976..6f4680e 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -164,10 +164,6 @@ Repository::format() const
return _format;
}
-RepositoryInstallableInterface::~RepositoryInstallableInterface()
-{
-}
-
RepositoryInstalledInterface::~RepositoryInstalledInterface()
{
}
@@ -184,10 +180,6 @@ RepositorySyncableInterface::~RepositorySyncableInterface()
{
}
-RepositoryUninstallableInterface::~RepositoryUninstallableInterface()
-{
-}
-
RepositoryUseInterface::~RepositoryUseInterface()
{
}
@@ -216,10 +208,6 @@ RepositoryDestinationInterface::~RepositoryDestinationInterface()
{
}
-RepositoryConfigInterface::~RepositoryConfigInterface()
-{
-}
-
RepositoryLicensesInterface::~RepositoryLicensesInterface()
{
}
@@ -232,10 +220,6 @@ RepositoryHookInterface::~RepositoryHookInterface()
{
}
-RepositoryPretendInterface::~RepositoryPretendInterface()
-{
-}
-
RepositoryMakeVirtualsInterface::~RepositoryMakeVirtualsInterface()
{
}
@@ -250,12 +234,6 @@ RepositoryLicensesInterface::license_exists(const std::string & license) const
return do_license_exists(license);
}
-bool
-RepositoryPretendInterface::pretend(const tr1::shared_ptr<const PackageID> & id) const
-{
- return do_pretend(id);
-}
-
UseFlagState
RepositoryUseInterface::query_use(const UseFlagName & u, const PackageID & pde) const
{
@@ -369,28 +347,15 @@ Repository::category_names() const
return do_category_names();
}
-void
-RepositoryConfigInterface::config(const tr1::shared_ptr<const PackageID> & id) const
-{
- return do_config(id);
-}
-
bool
RepositorySyncableInterface::sync() const
{
return do_sync();
}
-void
-RepositoryInstallableInterface::install(const tr1::shared_ptr<const PackageID> & id, const InstallOptions & o) const
-{
- do_install(id, o);
-}
-
-void
-RepositoryUninstallableInterface::uninstall(const tr1::shared_ptr<const PackageID> & v, const UninstallOptions & i) const
+bool
+Repository::some_ids_might_support_action(const SupportsActionTestBase & b) const
{
- do_uninstall(v, i);
+ return do_some_ids_might_support_action(b);
}
-
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 97d3309..37010a8 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -20,6 +20,7 @@
#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORY_HH
#define PALUDIS_GUARD_PALUDIS_REPOSITORY_HH 1
+#include <paludis/action-fwd.hh>
#include <paludis/repository-fwd.hh>
#include <paludis/repository_info-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
@@ -51,11 +52,6 @@ namespace paludis
* A Repository provides a representation of a physical repository to a
* PackageDatabase.
*
- * We make pretty heavy use of the non-virtual interface idiom here. See
- * \ref EffCpp items 35 and 37. There's a lot of optional functionality
- * available. These are split off via get_interface() style functions,
- * which return 0 if an interface is not available.
- *
* \ingroup grprepository
* \nosubgrouping
*/
@@ -133,6 +129,12 @@ namespace paludis
virtual bool do_has_category_named(const CategoryNamePart &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ /**
+ * Override in descendents: might some of our IDs support a
+ * particular action?
+ */
+ virtual bool do_some_ids_might_support_action(const SupportsActionTestBase &) const = 0;
+
///\}
public:
@@ -206,6 +208,15 @@ namespace paludis
*/
tr1::shared_ptr<const PackageIDSequence> package_ids(const QualifiedPackageName & p) const;
+ /**
+ * Might some of our IDs support a particular action?
+ *
+ * Used to optimise PackageDatabase::query. If a repository doesn't
+ * support, say, InstallAction, a query can skip searching it
+ * entirely when looking for installable packages.
+ */
+ bool some_ids_might_support_action(const SupportsActionTestBase &) const;
+
///\}
///\name Repository behaviour methods
@@ -410,74 +421,6 @@ namespace paludis
};
/**
- * Interface for handling installs for repositories.
- *
- * \see Repository
- * \ingroup grprepository
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RepositoryInstallableInterface
- {
- protected:
- ///\name Implementation details
- ///\{
-
- /**
- * Override in descendents: install.
- */
- virtual void do_install(const tr1::shared_ptr<const PackageID> &, const InstallOptions &) const = 0;
-
- ///\}
-
- public:
- ///\name Installable functions
- ///\{
-
- /**
- * Install a package.
- */
- void install(const tr1::shared_ptr<const PackageID> &, const InstallOptions & i) const;
-
- ///\}
-
- virtual ~RepositoryInstallableInterface();
- };
-
- /**
- * Interface for handling uninstalls for repositories.
- *
- * \see Repository
- * \ingroup grprepository
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RepositoryUninstallableInterface
- {
- protected:
- ///\name Implementation details
- ///\{
-
- /**
- * Override in descendents: uninstall.
- */
- virtual void do_uninstall(const tr1::shared_ptr<const PackageID> &, const UninstallOptions &) const = 0;
-
- ///\}
-
- public:
- ///\name Uninstall functions
- ///\{
-
- /**
- * Uninstall a package.
- */
- void uninstall(const tr1::shared_ptr<const PackageID> & v, const UninstallOptions & i) const;
-
- ///\}
-
- virtual ~RepositoryUninstallableInterface();
- };
-
- /**
* Interface for package sets for repositories.
*
* \see Repository
@@ -778,77 +721,6 @@ namespace paludis
};
/**
- * Interface for handling actions for repositories supporting package configuration.
- *
- * \see Repository
- * \ingroup grprepository
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RepositoryConfigInterface
- {
- protected:
- ///\name Implementation details
- ///\{
-
- /**
- * Override in descendents: do the configuration.
- */
- virtual void do_config(const tr1::shared_ptr<const PackageID> &) const = 0;
-
- ///\}
-
- public:
- ///\name Configuration actions
- ///\{
-
- /**
- * Configure.
- */
- void config(const tr1::shared_ptr<const PackageID> &) const;
-
- ///\}
-
- virtual ~RepositoryConfigInterface();
- };
-
- /**
- * Interface for handling actions for repositories supporting
- * pretend-phase functions.
- *
- * \see Repository
- * \ingroup grprepository
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RepositoryPretendInterface
- {
- protected:
- ///\name Implementation details
- ///\{
-
- /**
- * Override in descendents: do the pretend.
- */
- virtual bool do_pretend(const tr1::shared_ptr<const PackageID> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- ///\}
-
- public:
- ///\name Pretend phase actions
- ///\{
-
- /**
- * Do the pretend.
- */
- bool pretend(const tr1::shared_ptr<const PackageID> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- ///\}
-
- virtual ~RepositoryPretendInterface();
- };
-
- /**
* Interface for handling actions relating to licenses.
*
* \see Repository
diff --git a/paludis/repository.sr b/paludis/repository.sr
index 5aec3cb..37b6591 100644
--- a/paludis/repository.sr
+++ b/paludis/repository.sr
@@ -1,54 +1,14 @@
#!/bin/bash
# vim: set sw=4 sts=4 et :
-make_class_InstallOptions()
-{
- visible
-
- key no_config_protect bool
- key fetch_only bool
- key debug_build InstallDebugOption
- key safe_resume bool
- key destination "tr1::shared_ptr<Repository>"
-
- doxygen_comment << "END"
- /**
- * Options for the Repository::install method.
- *
- * \see Repository
- * \ingroup grprepository
- * \nosubgrouping
- */
-END
-}
-
-make_class_UninstallOptions()
-{
- visible
-
- key no_config_protect bool
-
- doxygen_comment << "END"
- /**
- * Options for the Repository::uninstall method.
- *
- * \see Repository
- * \ingroup grprepository
- * \nosubgrouping
- */
-END
-}
-
make_class_RepositoryCapabilities()
{
visible
- key installable_interface "RepositoryInstallableInterface *"
key installed_interface "RepositoryInstalledInterface *"
key mask_interface "RepositoryMaskInterface *"
key sets_interface "RepositorySetsInterface *"
key syncable_interface "RepositorySyncableInterface *"
- key uninstallable_interface "RepositoryUninstallableInterface *"
key use_interface "RepositoryUseInterface *"
key world_interface "RepositoryWorldInterface *"
key mirrors_interface "RepositoryMirrorsInterface *"
@@ -57,8 +17,6 @@ make_class_RepositoryCapabilities()
key virtuals_interface "RepositoryVirtualsInterface *"
key make_virtuals_interface "RepositoryMakeVirtualsInterface *"
key destination_interface "RepositoryDestinationInterface *"
- key config_interface "RepositoryConfigInterface *"
- key pretend_interface "RepositoryPretendInterface *"
key licenses_interface "RepositoryLicensesInterface *"
key e_interface "RepositoryEInterface *"
key hook_interface "RepositoryHookInterface *"
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 7a7af46..5276fb3 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -21,6 +21,7 @@
#include <paludis/dep_spec.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/dep_spec_pretty_printer.hh>
+#include <paludis/action.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/iterator.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -47,8 +48,8 @@ namespace paludis
Environment * const env;
DepList dep_list;
DepList::Iterator current_dep_list_entry;
- InstallOptions install_options;
- UninstallOptions uninstall_options;
+ InstallActionOptions install_options;
+ UninstallActionOptions uninstall_options;
std::list<std::string> raw_targets;
tr1::shared_ptr<ConstTreeSequence<SetSpecTree, AllDepSpec> > targets;
@@ -67,7 +68,7 @@ namespace paludis
env(e),
dep_list(e, o),
current_dep_list_entry(dep_list.begin()),
- install_options(false, false, ido_none, false, tr1::shared_ptr<Repository>()),
+ install_options(false, false, iado_none, false, tr1::shared_ptr<Repository>()),
uninstall_options(false),
targets(new ConstTreeSequence<SetSpecTree, AllDepSpec>(tr1::shared_ptr<AllDepSpec>(new AllDepSpec))),
destinations(d),
@@ -216,13 +217,15 @@ InstallTask::execute()
/* do pretend phase things */
bool pretend_failed(false);
+ SupportsActionTest<PretendAction> pretend_action_query;
for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
dep != dep_end ; ++dep)
- {
- const RepositoryPretendInterface * const pretend_interface(dep->package_id->repository()->pretend_interface);
- if (pretend_interface)
- pretend_failed |= ! pretend_interface->pretend(dep->package_id);
- }
+ if (dep->package_id->supports_action(pretend_action_query))
+ {
+ PretendAction pretend_action;
+ dep->package_id->perform_action(pretend_action);
+ pretend_failed |= pretend_action.failed();
+ }
if (_imp->pretend)
{
@@ -305,14 +308,11 @@ InstallTask::execute()
}
/* fetch / install one item */
- const RepositoryInstallableInterface * const installable_interface(dep->package_id->repository()->installable_interface);
- if (! installable_interface)
- throw InternalError(PALUDIS_HERE, "Trying to install from a non-installable repository");
-
try
{
_imp->install_options.destination = dep->destination;
- installable_interface->install(dep->package_id, _imp->install_options);
+ InstallAction install_action(_imp->install_options);
+ dep->package_id->perform_action(install_action);
}
catch (const PackageInstallActionError & e)
{
@@ -357,17 +357,17 @@ InstallTask::execute()
tr1::shared_ptr<const PackageIDSequence> collision_list;
if (dep->destination)
- if (dep->destination->uninstallable_interface)
- collision_list = _imp->env->package_database()->query(
- query::Matches(PackageDepSpec(
- tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(dep->package_id->name())),
- tr1::shared_ptr<CategoryNamePart>(),
- tr1::shared_ptr<PackageNamePart>(),
- tr1::shared_ptr<VersionRequirements>(),
- vr_and,
- tr1::shared_ptr<SlotName>(new SlotName(dep->package_id->slot())),
- tr1::shared_ptr<RepositoryName>(new RepositoryName(dep->destination->name())))) &
- query::RepositoryHasInstalledInterface(), qo_order_by_version);
+ collision_list = _imp->env->package_database()->query(
+ query::Matches(PackageDepSpec(
+ tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(dep->package_id->name())),
+ tr1::shared_ptr<CategoryNamePart>(),
+ tr1::shared_ptr<PackageNamePart>(),
+ tr1::shared_ptr<VersionRequirements>(),
+ vr_and,
+ tr1::shared_ptr<SlotName>(new SlotName(dep->package_id->slot())),
+ tr1::shared_ptr<RepositoryName>(new RepositoryName(dep->destination->name())))) &
+ query::SupportsAction<UninstallAction>(),
+ qo_order_by_version);
// don't clean the thing we just installed
PackageIDSequence clean_list;
@@ -400,13 +400,10 @@ InstallTask::execute()
throw PackageInstallActionError("Clean of '" + cpvr + "' aborted by hook");
on_clean_pre(*dep, **c);
- const RepositoryUninstallableInterface * const uninstall_interface((*c)->repository()->uninstallable_interface);
- if (! uninstall_interface)
- throw InternalError(PALUDIS_HERE, "Trying to uninstall from a non-uninstallable repo");
-
try
{
- uninstall_interface->uninstall(*c, _imp->uninstall_options);
+ UninstallAction uninstall_action(_imp->uninstall_options);
+ (*c)->perform_action(uninstall_action);
}
catch (const PackageUninstallActionError & e)
{
@@ -546,7 +543,7 @@ InstallTask::set_preserve_world(const bool value)
}
void
-InstallTask::set_debug_mode(const InstallDebugOption value)
+InstallTask::set_debug_mode(const InstallActionDebugOption value)
{
_imp->install_options.debug_build = value;
}
diff --git a/paludis/tasks/install_task.hh b/paludis/tasks/install_task.hh
index 239ea1b..f7bd00d 100644
--- a/paludis/tasks/install_task.hh
+++ b/paludis/tasks/install_task.hh
@@ -24,6 +24,7 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/dep_list/dep_list.hh>
#include <paludis/repository-fwd.hh>
+#include <paludis/action-fwd.hh>
#include <libwrapiter/libwrapiter_forward_iterator-fwd.hh>
namespace paludis
@@ -64,7 +65,7 @@ namespace paludis
void set_fetch_only(const bool value);
void set_pretend(const bool value);
void set_preserve_world(const bool value);
- void set_debug_mode(const InstallDebugOption value);
+ void set_debug_mode(const InstallActionDebugOption value);
void set_add_to_world_spec(const std::string &);
void set_safe_resume(const bool);
diff --git a/paludis/tasks/uninstall_task.cc b/paludis/tasks/uninstall_task.cc
index 8ca01bc..d678028 100644
--- a/paludis/tasks/uninstall_task.cc
+++ b/paludis/tasks/uninstall_task.cc
@@ -19,6 +19,7 @@
#include "uninstall_task.hh"
#include <paludis/environment.hh>
+#include <paludis/action.hh>
#include <paludis/dep_list/uninstall_list.hh>
#include <paludis/dep_spec_flattener.hh>
#include <paludis/tasks/exceptions.hh>
@@ -78,7 +79,7 @@ namespace paludis
struct Implementation<UninstallTask>
{
Environment * const env;
- UninstallOptions uninstall_options;
+ UninstallActionOptions uninstall_options;
std::list<std::string> raw_targets;
std::list<tr1::shared_ptr<PackageDepSpec> > targets;
@@ -247,7 +248,9 @@ UninstallTask::execute()
Context local_context("When looking for target '" + stringify(**t) + "':");
tr1::shared_ptr<const PackageIDSequence> r(_imp->env->package_database()->query(
- query::Matches(**t) & query::RepositoryHasUninstallableInterface(), qo_order_by_version));
+ query::Matches(**t) &
+ query::SupportsAction<UninstallAction>(),
+ qo_order_by_version));
if (r->empty())
{
if (! _imp->had_set_targets)
@@ -313,7 +316,8 @@ UninstallTask::execute()
tr1::shared_ptr<const PackageIDSequence> installed(
_imp->env->package_database()->query(query::Matches(PackageDepSpec(
tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(i->first)))) &
- query::RepositoryHasInstalledInterface(), qo_whatever));
+ query::SupportsAction<InstalledAction>(),
+ qo_whatever));
for (PackageIDSequence::Iterator r(installed->begin()), r_end(installed->end()) ;
r != r_end && remove ; ++r)
if (i->second.end() == i->second.find((*r)->version()))
@@ -360,13 +364,10 @@ UninstallTask::execute()
throw PackageUninstallActionError("Uninstall of '" + cpvr + "' aborted by hook");
on_uninstall_pre(*i);
- const RepositoryUninstallableInterface * const uninstall_interface(i->package_id->repository()->uninstallable_interface);
- if (! uninstall_interface)
- throw InternalError(PALUDIS_HERE, "Trying to uninstall from a non-uninstallable repo");
-
try
{
- uninstall_interface->uninstall(i->package_id, _imp->uninstall_options);
+ UninstallAction uninstall_action(_imp->uninstall_options);
+ i->package_id->perform_action(uninstall_action);
}
catch (const PackageUninstallActionError & e)
{
diff --git a/src/clients/contrarius/install.cc b/src/clients/contrarius/install.cc
index 04b038d..2b5fb9d 100644
--- a/src/clients/contrarius/install.cc
+++ b/src/clients/contrarius/install.cc
@@ -229,11 +229,11 @@ do_install(tr1::shared_ptr<Environment> env, std::string spec_str)
if (CommandLine::get_instance()->a_debug_build.specified())
{
if (CommandLine::get_instance()->a_debug_build.argument() == "none")
- task.set_debug_mode(ido_none);
+ task.set_debug_mode(iado_none);
else if (CommandLine::get_instance()->a_debug_build.argument() == "split")
- task.set_debug_mode(ido_split);
+ task.set_debug_mode(iado_split);
else if (CommandLine::get_instance()->a_debug_build.argument() == "internal")
- task.set_debug_mode(ido_internal);
+ task.set_debug_mode(iado_internal);
else
throw DoHelp("bad value for --debug-build");
}
@@ -296,7 +296,7 @@ do_install(tr1::shared_ptr<Environment> env, std::string spec_str)
tr1::shared_ptr<const PackageIDSequence> p(
env->package_database()->query(
query::Matches(e.query()) &
- query::RepositoryHasInstallableInterface(),
+ query::SupportsAction<InstallAction>(),
qo_order_by_version));
if (p->empty())
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc b/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc
index f73f512..cc38e27 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc
@@ -147,7 +147,7 @@ namespace
paludis::tr1::shared_ptr<const PackageIDSequence> av(
environment->package_database()->query(
- query::RepositoryHasInstallableInterface() &
+ query::SupportsAction<InstallAction>() &
query::Matches(pds) &
query::Matches(PackageDepSpec(
paludis::tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(id->name())),
@@ -190,7 +190,7 @@ namespace
paludis::tr1::shared_ptr<VersionRequirements>(),
vr_and,
paludis::tr1::shared_ptr<SlotName>(new SlotName(id->slot())))) &
- query::RepositoryHasInstallableInterface() &
+ query::SupportsAction<InstallAction>() &
query::NotMasked(),
qo_order_by_version));
if (av->empty())
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.cc b/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.cc
index 9541c24..68fd020 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.cc
@@ -52,12 +52,12 @@ PackagesRepositoryFilterModel::populate()
r = append();
(*r)[_imp->columns.col_text] = "Installable repositories";
(*r)[_imp->columns.col_sensitive] = true;
- (*r)[_imp->columns.col_query] = paludis::tr1::shared_ptr<Query>(new query::RepositoryHasInstallableInterface);
+ (*r)[_imp->columns.col_query] = paludis::tr1::shared_ptr<Query>(new query::SupportsAction<InstallAction>());
r = append();
(*r)[_imp->columns.col_text] = "Installed repositories";
(*r)[_imp->columns.col_sensitive] = true;
- (*r)[_imp->columns.col_query] = paludis::tr1::shared_ptr<Query>(new query::RepositoryHasInstalledInterface);
+ (*r)[_imp->columns.col_query] = paludis::tr1::shared_ptr<Query>(new query::SupportsAction<InstalledAction>());
_imp->main_window->paludis_thread_action(
sigc::mem_fun(this, &PackagesRepositoryFilterModel::populate_in_paludis_thread), "Populating repository filter model");
diff --git a/src/clients/paludis/do_config.cc b/src/clients/paludis/do_config.cc
index 2b8649f..3024f52 100644
--- a/src/clients/paludis/do_config.cc
+++ b/src/clients/paludis/do_config.cc
@@ -51,15 +51,16 @@ namespace
{
int return_code(0);
- const RepositoryConfigInterface * conf_if(p->repository()->config_interface);
- if (! conf_if)
+ ConfigAction a;
+ try
+ {
+ p->perform_action(a);
+ }
+ catch (const UnsupportedActionError &)
{
- std::cerr << "Repository '" << p->repository()->name() <<
- "' does not support post-install configuration" << std::endl;
+ std::cerr << "Package '" << *p << "' does not support post-install configuration" << std::endl;
return_code |= 1;
}
- else
- conf_if->config(p);
return return_code;
}
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 6b97195..d46259a 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -621,7 +621,7 @@ do_install(tr1::shared_ptr<Environment> env)
{
tr1::shared_ptr<const PackageIDSequence> p(
env->package_database()->query(
- query::Matches(e.query()) & query::RepositoryHasInstallableInterface(), qo_order_by_version));
+ query::Matches(e.query()) & query::SupportsAction<InstallAction>(), qo_order_by_version));
if (p->empty())
{
cout << endl;
diff --git a/src/common_args/debug_build_arg.cc b/src/common_args/debug_build_arg.cc
index d649d41..5d70844 100644
--- a/src/common_args/debug_build_arg.cc
+++ b/src/common_args/debug_build_arg.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -38,15 +38,15 @@ DebugBuildArg::~DebugBuildArg()
{
}
-InstallDebugOption
+InstallActionDebugOption
DebugBuildArg::option() const
{
if ("none" == argument())
- return ido_none;
+ return iado_none;
if ("split" == argument())
- return ido_split;
+ return iado_split;
if ("internal" == argument())
- return ido_internal;
+ return iado_internal;
throw DoHelp("Bad value for --" + long_name());
}
diff --git a/src/common_args/debug_build_arg.hh b/src/common_args/debug_build_arg.hh
index 6c7b47b..d35904b 100644
--- a/src/common_args/debug_build_arg.hh
+++ b/src/common_args/debug_build_arg.hh
@@ -34,7 +34,7 @@ namespace paludis
DebugBuildArg(ArgsGroup * const, const std::string &, char);
~DebugBuildArg();
- InstallDebugOption option() const;
+ InstallActionDebugOption option() const;
};
}
}
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 6d32a0e..175669d 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -1032,7 +1032,9 @@ ConsoleInstallTask::display_merge_list_entry_tags(const DepListEntry & d, const
tr1::shared_ptr<const PackageDepSpec> spec(
tr1::static_pointer_cast<const DependencyDepTag>(tag->tag)->dependency());
if (d.kind != dlk_masked && d.kind != dlk_block && environment()->package_database()->query(
- query::Matches(*spec) & query::RepositoryHasInstalledInterface(), qo_whatever)->empty())
+ query::Matches(*spec) &
+ query::SupportsAction<InstalledAction>(),
+ qo_whatever)->empty())
unsatisfied_dependents.insert(tag->tag->short_text());
else
dependents.insert(tag->tag->short_text());
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 21e6953..1f5edb0 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -304,21 +304,21 @@ ConsoleQueryTask::display_metadata(const PackageDepSpec &, const tr1::shared_ptr
}
Displayer ds(this, id, mkt_significant);
- std::for_each(id->begin(), id->end(), accept_visitor(ds));
+ std::for_each(id->begin_metadata(), id->end_metadata(), accept_visitor(ds));
Displayer dn(this, id, mkt_normal);
- std::for_each(id->begin(), id->end(), accept_visitor(dn));
+ std::for_each(id->begin_metadata(), id->end_metadata(), accept_visitor(dn));
if (want_deps() || want_raw())
{
Displayer dd(this, id, mkt_dependencies);
- std::for_each(id->begin(), id->end(), accept_visitor(dd));
+ std::for_each(id->begin_metadata(), id->end_metadata(), accept_visitor(dd));
}
if (want_raw())
{
Displayer dr(this, id, mkt_internal);
- std::for_each(id->begin(), id->end(), accept_visitor(dr));
+ std::for_each(id->begin_metadata(), id->end_metadata(), accept_visitor(dr));
}
}