aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-10-14 19:28:18 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-10-14 19:28:18 +0100
commit6945cb45acb4f215f347cc0bbc7a55d10ea054b1 (patch)
tree689c5c44aa862ba52ced033e0fd6c812d58a171b
parent4a87c6e9793486c94d9123110b12bd0c51bdd15e (diff)
downloadpaludis-6945cb45acb4f215f347cc0bbc7a55d10ea054b1.tar.gz
paludis-6945cb45acb4f215f347cc0bbc7a55d10ea054b1.tar.xz
Hooks don't need an interface.
-rw-r--r--paludis/hooker.cc32
-rw-r--r--paludis/repositories/accounts/accounts_repository.cc9
-rw-r--r--paludis/repositories/accounts/accounts_repository.hh2
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc8
-rw-r--r--paludis/repositories/cran/cran_installed_repository.hh1
-rw-r--r--paludis/repositories/cran/cran_repository.cc8
-rw-r--r--paludis/repositories/cran/cran_repository.hh2
-rw-r--r--paludis/repositories/e/e_installed_repository.hh9
-rw-r--r--paludis/repositories/e/e_repository.cc1
-rw-r--r--paludis/repositories/e/e_repository.hh1
-rw-r--r--paludis/repositories/e/exndbam_repository.cc1
-rw-r--r--paludis/repositories/e/vdb_repository.cc1
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc1
-rw-r--r--paludis/repositories/fake/fake_repository.cc2
-rw-r--r--paludis/repositories/fake/fake_repository.hh2
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc8
-rw-r--r--paludis/repositories/fake/fake_repository_base.hh2
-rw-r--r--paludis/repositories/gems/gems_repository.cc9
-rw-r--r--paludis/repositories/gems/gems_repository.hh2
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc9
-rw-r--r--paludis/repositories/gems/installed_gems_repository.hh3
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.cc8
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.hh2
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc9
-rw-r--r--paludis/repositories/unpackaged/installed_repository.hh3
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.cc9
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.hh3
-rw-r--r--paludis/repositories/unwritten/unwritten_repository.cc8
-rw-r--r--paludis/repositories/unwritten/unwritten_repository.hh2
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc1
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.hh1
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc9
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.hh3
-rw-r--r--paludis/repository-fwd.hh3
-rw-r--r--paludis/repository.cc4
-rw-r--r--paludis/repository.hh36
36 files changed, 137 insertions, 77 deletions
diff --git a/paludis/hooker.cc b/paludis/hooker.cc
index 638128b..397d39f 100644
--- a/paludis/hooker.cc
+++ b/paludis/hooker.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
* Copyright (c) 2007 Piotr JaroszyƄski
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -711,31 +711,29 @@ Hooker::perform_hook(const Hook & hook) const
case hod_stdout:
for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
- if ((**r).hook_interface())
- result.max_exit_status() = std::max(result.max_exit_status(),
- ((**r).hook_interface()->perform_hook(hook)).max_exit_status());
+ result.max_exit_status() = std::max(result.max_exit_status(),
+ ((*r)->perform_hook(hook)).max_exit_status());
continue;
case hod_grab:
for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
- if ((**r).hook_interface())
+ {
+ HookResult tmp((*r)->perform_hook(hook));
+ if (tmp.max_exit_status() > result.max_exit_status())
+ result = tmp;
+ else if (! tmp.output().empty())
{
- HookResult tmp((**r).hook_interface()->perform_hook(hook));
- if (tmp.max_exit_status() > result.max_exit_status())
- result = tmp;
- else if (! tmp.output().empty())
+ if (hook.validate_value(tmp.output()))
{
- if (hook.validate_value(tmp.output()))
- {
- if (result.max_exit_status() == 0)
- return tmp;
- }
- else
- Log::get_instance()->message("hook.bad_output", ll_warning, lc_context)
- << "Hook returned invalid output: '" << tmp.output() << "'";
+ if (result.max_exit_status() == 0)
+ return tmp;
}
+ else
+ Log::get_instance()->message("hook.bad_output", ll_warning, lc_context)
+ << "Hook returned invalid output: '" << tmp.output() << "'";
}
+ }
continue;
case last_hod:
diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc
index b0e6a6e..d8d8662 100644
--- a/paludis/repositories/accounts/accounts_repository.cc
+++ b/paludis/repositories/accounts/accounts_repository.cc
@@ -38,6 +38,7 @@
#include <paludis/generator.hh>
#include <paludis/selection.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/hook.hh>
using namespace paludis;
using namespace paludis::accounts_repository;
@@ -112,7 +113,6 @@ AccountsRepository::AccountsRepository(const AccountsRepositoryParams & p) :
value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -135,7 +135,6 @@ AccountsRepository::AccountsRepository(const InstalledAccountsRepositoryParams &
value_for<n::destination_interface>(this),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -460,5 +459,11 @@ AccountsRepository::populate_sets() const
}
}
+HookResult
+AccountsRepository::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
template class PrivateImplementationPattern<AccountsRepository>;
diff --git a/paludis/repositories/accounts/accounts_repository.hh b/paludis/repositories/accounts/accounts_repository.hh
index c9d2d22..e3c8067 100644
--- a/paludis/repositories/accounts/accounts_repository.hh
+++ b/paludis/repositories/accounts/accounts_repository.hh
@@ -138,6 +138,8 @@ namespace paludis
virtual void invalidate_masks();
virtual void regenerate_cache() const;
+ virtual HookResult perform_hook(const Hook & hook) const;
+
///\}
///\name Destination functions
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 587f6ed..5f94c03 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -31,6 +31,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
#include <paludis/selection.hh>
+#include <paludis/hook.hh>
#include <paludis/repositories/cran/cran_package_id.hh>
#include <paludis/repositories/cran/cran_dep_parser.hh>
#include <paludis/repositories/cran/cran_installed_repository.hh>
@@ -165,7 +166,6 @@ CRANInstalledRepository::CRANInstalledRepository(const CRANInstalledRepositoryPa
value_for<n::destination_interface>(this),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -597,3 +597,9 @@ CRANInstalledRepository::populate_sets() const
true);
}
+HookResult
+CRANInstalledRepository::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
diff --git a/paludis/repositories/cran/cran_installed_repository.hh b/paludis/repositories/cran/cran_installed_repository.hh
index bba0019..79c6492 100644
--- a/paludis/repositories/cran/cran_installed_repository.hh
+++ b/paludis/repositories/cran/cran_installed_repository.hh
@@ -106,6 +106,7 @@ namespace paludis
virtual void invalidate();
virtual void invalidate_masks();
+ virtual HookResult perform_hook(const Hook & hook) const;
/* RepositoryDestinationInterface */
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index f2dfd53..762b649 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -48,6 +48,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/output_manager.hh>
#include <paludis/syncer.hh>
+#include <paludis/hook.hh>
#include <tr1/unordered_map>
#include <tr1/functional>
#include <functional>
@@ -110,7 +111,6 @@ CRANRepository::CRANRepository(const CRANRepositoryParams & p) :
value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -545,3 +545,9 @@ CRANRepository::populate_sets() const
{
}
+HookResult
+CRANRepository::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
diff --git a/paludis/repositories/cran/cran_repository.hh b/paludis/repositories/cran/cran_repository.hh
index bbd5578..a836690 100644
--- a/paludis/repositories/cran/cran_repository.hh
+++ b/paludis/repositories/cran/cran_repository.hh
@@ -162,6 +162,8 @@ namespace paludis
virtual void populate_sets() const;
///\}
+
+ virtual HookResult perform_hook(const Hook & hook) const;
};
/**
diff --git a/paludis/repositories/e/e_installed_repository.hh b/paludis/repositories/e/e_installed_repository.hh
index 4b9660c..76427b0 100644
--- a/paludis/repositories/e/e_installed_repository.hh
+++ b/paludis/repositories/e/e_installed_repository.hh
@@ -45,7 +45,6 @@ namespace paludis
public Repository,
public RepositoryEnvironmentVariableInterface,
public RepositoryDestinationInterface,
- public RepositoryHookInterface,
private PrivateImplementationPattern<EInstalledRepository>
{
private:
@@ -74,17 +73,15 @@ namespace paludis
virtual bool want_pre_post_phases() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- /* RepositoryHookInterface */
-
- virtual HookResult perform_hook(const Hook & hook) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* Repository */
virtual std::tr1::shared_ptr<const CategoryNamePartSet> unimportant_category_names() const;
virtual bool some_ids_might_support_action(const SupportsActionTestBase &) const;
+ virtual HookResult perform_hook(const Hook & hook) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
///\name For use by EInstalledRepositoryID
///\{
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 3a262e7..146a562 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -499,7 +499,6 @@ ERepository::ERepository(const ERepositoryParams & p) :
value_for<n::destination_interface>(p.binary_destination() ? this : 0),
value_for<n::e_interface>(this),
value_for<n::environment_variable_interface>(this),
- value_for<n::hook_interface>(this),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(this),
value_for<n::mirrors_interface>(this),
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index 4a5981f..39951f4 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -57,7 +57,6 @@ namespace paludis
public RepositoryVirtualsInterface,
public RepositoryDestinationInterface,
public RepositoryEInterface,
- public RepositoryHookInterface,
public RepositoryQAInterface,
public RepositoryManifestInterface,
public std::tr1::enable_shared_from_this<ERepository>,
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 382e7dc..f5181fc 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -106,7 +106,6 @@ ExndbamRepository::ExndbamRepository(const RepositoryName & n, const ExndbamRepo
value_for<n::destination_interface>(this),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(this),
- value_for<n::hook_interface>(this),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 2cca557..f4c47b5 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -161,7 +161,6 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
value_for<n::destination_interface>(this),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(this),
- value_for<n::hook_interface>(this),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index 924362a..ad8a90f 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -62,7 +62,6 @@ FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, co
value_for<n::destination_interface>(this),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 57d035f..4e3849e 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -62,7 +62,6 @@ FakeRepository::FakeRepository(const Environment * const env, const RepositoryNa
value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(this),
@@ -83,7 +82,6 @@ FakeRepository::FakeRepository(const FakeRepositoryParams & params) :
value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(this),
diff --git a/paludis/repositories/fake/fake_repository.hh b/paludis/repositories/fake/fake_repository.hh
index 5e3ced5..0c269cb 100644
--- a/paludis/repositories/fake/fake_repository.hh
+++ b/paludis/repositories/fake/fake_repository.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index 51ce369..365bd8d 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -26,7 +26,9 @@
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_output_iterator.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/hook.hh>
#include <tr1/functional>
#include <map>
#include <algorithm>
@@ -179,3 +181,9 @@ FakeRepositoryBase::populate_sets() const
{
}
+HookResult
+FakeRepositoryBase::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index b2548b5..6613358 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -123,6 +123,8 @@ namespace paludis
virtual void populate_sets() const;
///\}
+
+ virtual HookResult perform_hook(const Hook & hook) const;
};
}
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index 29e3695..6de2ede 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -39,6 +39,7 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/distribution.hh>
#include <paludis/environment.hh>
+#include <paludis/hook.hh>
#include <tr1/unordered_map>
using namespace paludis;
@@ -94,7 +95,6 @@ GemsRepository::GemsRepository(const gems::RepositoryParams & params) :
value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -405,3 +405,10 @@ GemsRepository::populate_sets() const
{
}
+HookResult
+GemsRepository::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
+
diff --git a/paludis/repositories/gems/gems_repository.hh b/paludis/repositories/gems/gems_repository.hh
index 1d5ac0d..79fe71c 100644
--- a/paludis/repositories/gems/gems_repository.hh
+++ b/paludis/repositories/gems/gems_repository.hh
@@ -113,6 +113,8 @@ namespace paludis
virtual void populate_sets() const;
///\}
+
+ virtual HookResult perform_hook(const Hook & hook) const;
};
}
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index 8c3edf0..9461342 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -45,6 +45,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
+#include <paludis/hook.hh>
#include <tr1/unordered_map>
using namespace paludis;
@@ -98,7 +99,6 @@ InstalledGemsRepository::InstalledGemsRepository(const gems::InstalledRepository
value_for<n::destination_interface>(this),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -449,3 +449,10 @@ InstalledGemsRepository::populate_sets() const
true);
}
+HookResult
+InstalledGemsRepository::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
+
diff --git a/paludis/repositories/gems/installed_gems_repository.hh b/paludis/repositories/gems/installed_gems_repository.hh
index 22a9fc0..49d671d 100644
--- a/paludis/repositories/gems/installed_gems_repository.hh
+++ b/paludis/repositories/gems/installed_gems_repository.hh
@@ -128,6 +128,9 @@ namespace paludis
virtual void populate_sets() const;
///\}
+
+ virtual HookResult perform_hook(const Hook & hook) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/unavailable/unavailable_repository.cc b/paludis/repositories/unavailable/unavailable_repository.cc
index 96f3c8d..28cf947 100644
--- a/paludis/repositories/unavailable/unavailable_repository.cc
+++ b/paludis/repositories/unavailable/unavailable_repository.cc
@@ -28,6 +28,7 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/syncer.hh>
+#include <paludis/hook.hh>
#include <list>
using namespace paludis;
@@ -88,7 +89,6 @@ UnavailableRepository::UnavailableRepository(const UnavailableRepositoryParams &
value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -344,5 +344,11 @@ UnavailableRepository::populate_sets() const
{
}
+HookResult
+UnavailableRepository::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
template class PrivateImplementationPattern<unavailable_repository::UnavailableRepository>;
diff --git a/paludis/repositories/unavailable/unavailable_repository.hh b/paludis/repositories/unavailable/unavailable_repository.hh
index 657093b..338a595 100644
--- a/paludis/repositories/unavailable/unavailable_repository.hh
+++ b/paludis/repositories/unavailable/unavailable_repository.hh
@@ -117,6 +117,8 @@ namespace paludis
virtual void populate_sets() const;
///\}
+
+ virtual HookResult perform_hook(const Hook & hook) const;
};
}
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index ca0e0ca..a8718c9 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -46,6 +46,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
#include <paludis/selection.hh>
+#include <paludis/hook.hh>
#include <sstream>
#include <sys/time.h>
@@ -93,7 +94,6 @@ InstalledUnpackagedRepository::InstalledUnpackagedRepository(
value_for<n::destination_interface>(this),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -511,3 +511,10 @@ InstalledUnpackagedRepository::populate_sets() const
true);
}
+HookResult
+InstalledUnpackagedRepository::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
+
diff --git a/paludis/repositories/unpackaged/installed_repository.hh b/paludis/repositories/unpackaged/installed_repository.hh
index 1189e8b..febe346 100644
--- a/paludis/repositories/unpackaged/installed_repository.hh
+++ b/paludis/repositories/unpackaged/installed_repository.hh
@@ -131,6 +131,9 @@ namespace paludis
virtual void populate_sets() const;
///\}
+
+ virtual HookResult perform_hook(const Hook & hook) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.cc b/paludis/repositories/unpackaged/unpackaged_repository.cc
index 05022ca..a0970a9 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository.cc
@@ -32,6 +32,7 @@
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/hook.hh>
using namespace paludis;
using namespace paludis::unpackaged_repositories;
@@ -98,7 +99,6 @@ UnpackagedRepository::UnpackagedRepository(const RepositoryName & n,
value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -282,3 +282,10 @@ UnpackagedRepository::populate_sets() const
{
}
+HookResult
+UnpackagedRepository::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
+
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.hh b/paludis/repositories/unpackaged/unpackaged_repository.hh
index 2b60131..9f886f7 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.hh
+++ b/paludis/repositories/unpackaged/unpackaged_repository.hh
@@ -130,6 +130,9 @@ namespace paludis
virtual void populate_sets() const;
///\}
+
+ virtual HookResult perform_hook(const Hook & hook) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/unwritten/unwritten_repository.cc b/paludis/repositories/unwritten/unwritten_repository.cc
index 5802238..7856e3b 100644
--- a/paludis/repositories/unwritten/unwritten_repository.cc
+++ b/paludis/repositories/unwritten/unwritten_repository.cc
@@ -28,6 +28,7 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/syncer.hh>
+#include <paludis/hook.hh>
#include <list>
using namespace paludis;
@@ -88,7 +89,6 @@ UnwrittenRepository::UnwrittenRepository(const UnwrittenRepositoryParams & p) :
value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -344,6 +344,12 @@ UnwrittenRepository::populate_sets() const
{
}
+HookResult
+UnwrittenRepository::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
template class PrivateImplementationPattern<unwritten_repository::UnwrittenRepository>;
diff --git a/paludis/repositories/unwritten/unwritten_repository.hh b/paludis/repositories/unwritten/unwritten_repository.hh
index bcb9a38..d6efad9 100644
--- a/paludis/repositories/unwritten/unwritten_repository.hh
+++ b/paludis/repositories/unwritten/unwritten_repository.hh
@@ -116,6 +116,8 @@ namespace paludis
virtual void populate_sets() const;
///\}
+
+ virtual HookResult perform_hook(const Hook & hook) const;
};
}
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 3c64417..dd7b30d 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -113,7 +113,6 @@ InstalledVirtualsRepository::InstalledVirtualsRepository(const Environment * con
value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(this)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(this),
value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.hh b/paludis/repositories/virtuals/installed_virtuals_repository.hh
index 5a72619..5cfeaf7 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.hh
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.hh
@@ -34,7 +34,6 @@ namespace paludis
*/
class PALUDIS_VISIBLE InstalledVirtualsRepository :
public Repository,
- public RepositoryHookInterface,
public RepositoryDestinationInterface,
public std::tr1::enable_shared_from_this<InstalledVirtualsRepository>,
private PrivateImplementationPattern<InstalledVirtualsRepository>
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index 5dcbaa3..ced232d 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -29,6 +29,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/hook.hh>
#include <paludis/util/log.hh>
#include <paludis/util/make_shared_ptr.hh>
@@ -124,7 +125,6 @@ VirtualsRepository::VirtualsRepository(const Environment * const env) :
value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
- value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
value_for<n::make_virtuals_interface>(this),
value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
@@ -458,3 +458,10 @@ VirtualsRepository::populate_sets() const
{
}
+HookResult
+VirtualsRepository::perform_hook(const Hook &) const
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
+
diff --git a/paludis/repositories/virtuals/virtuals_repository.hh b/paludis/repositories/virtuals/virtuals_repository.hh
index cf33555..175e3ea 100644
--- a/paludis/repositories/virtuals/virtuals_repository.hh
+++ b/paludis/repositories/virtuals/virtuals_repository.hh
@@ -121,6 +121,9 @@ namespace paludis
virtual void populate_sets() const;
///\}
+
+ virtual HookResult perform_hook(const Hook & hook) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repository-fwd.hh b/paludis/repository-fwd.hh
index 7cdc8cd..05e027e 100644
--- a/paludis/repository-fwd.hh
+++ b/paludis/repository-fwd.hh
@@ -38,8 +38,6 @@ namespace paludis
class Environment;
class RepositoryNameCache;
class ERepositoryProfile;
- class Hook;
- class HookResult;
class Repository;
class RepositorySyncableInterface;
@@ -50,7 +48,6 @@ namespace paludis
class RepositoryMakeVirtualsInterface;
class RepositoryDestinationInterface;
class RepositoryEInterface;
- class RepositoryHookInterface;
class RepositoryQAInterface;
class RepositoryManifestInterface;
diff --git a/paludis/repository.cc b/paludis/repository.cc
index 05085fb..82efaa1 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -212,10 +212,6 @@ RepositoryEInterface::~RepositoryEInterface()
{
}
-RepositoryHookInterface::~RepositoryHookInterface()
-{
-}
-
RepositoryMakeVirtualsInterface::~RepositoryMakeVirtualsInterface()
{
}
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 34ca5d2..e5ed76d 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -38,6 +38,7 @@
#include <paludis/metadata_key-fwd.hh>
#include <paludis/metadata_key_holder.hh>
#include <paludis/merger-fwd.hh>
+#include <paludis/hook-fwd.hh>
#include <string>
#include <tr1/functional>
@@ -60,7 +61,6 @@ namespace paludis
struct e_interface;
struct environment_file;
struct environment_variable_interface;
- struct hook_interface;
struct image_dir;
struct installed_this;
struct make_virtuals_interface;
@@ -95,7 +95,6 @@ namespace paludis
NamedValue<n::destination_interface, RepositoryDestinationInterface *> destination_interface;
NamedValue<n::e_interface, RepositoryEInterface *> e_interface;
NamedValue<n::environment_variable_interface, RepositoryEnvironmentVariableInterface *> environment_variable_interface;
- NamedValue<n::hook_interface, RepositoryHookInterface *> hook_interface;
NamedValue<n::make_virtuals_interface, RepositoryMakeVirtualsInterface *> make_virtuals_interface;
NamedValue<n::manifest_interface, RepositoryManifestInterface *> manifest_interface;
NamedValue<n::mirrors_interface, RepositoryMirrorsInterface *> mirrors_interface;
@@ -393,6 +392,15 @@ namespace paludis
*/
virtual void purge_invalid_cache() const;
+ /**
+ * Perform a hook.
+ *
+ * \since 0.40 (previously in an interface)
+ */
+ virtual HookResult perform_hook(const Hook & hook) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+
///\}
///\name Set methods
@@ -705,30 +713,6 @@ namespace paludis
///\}
};
-
- /**
- * Interface for handling hooks.
- *
- * \see Repository
- * \ingroup g_repository
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RepositoryHookInterface
- {
- public:
- /**
- * Perform a hook.
- */
- virtual HookResult perform_hook(const Hook & hook) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- ///\name Basic operations
- ///\{
-
- virtual ~RepositoryHookInterface();
-
- ///\}
- };
}
#endif