aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-10-15 14:36:52 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-10-15 14:36:52 +0100
commita9f59a6f152b3d326323d8afcdd8f22555f46e02 (patch)
tree250a86be85c83d52af0f8120ce3a96aba0c9bd55
parent3e5637f46926ab182a132aacd3b991b45a5f945c (diff)
parentfa0523349f3a99978786fe8e49db5260d079cfb2 (diff)
downloadpaludis-a9f59a6f152b3d326323d8afcdd8f22555f46e02.tar.gz
paludis-a9f59a6f152b3d326323d8afcdd8f22555f46e02.tar.xz
Merge branch 'profiles-updates'
-rw-r--r--doc/faq/index.html.part1
-rw-r--r--doc/faq/operation.html.part21
-rw-r--r--paludis/hooker.cc32
-rw-r--r--paludis/install_task.cc2
-rw-r--r--paludis/install_task.hh2
-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.cc5
-rw-r--r--paludis/repositories/e/e_installed_repository.hh11
-rw-r--r--paludis/repositories/e/e_repository.cc9
-rw-r--r--paludis/repositories/e/e_repository.hh3
-rw-r--r--paludis/repositories/e/exheres_layout.cc6
-rw-r--r--paludis/repositories/e/exheres_layout.hh3
-rw-r--r--paludis/repositories/e/exndbam_repository.cc6
-rw-r--r--paludis/repositories/e/exndbam_repository.hh2
-rw-r--r--paludis/repositories/e/layout.hh3
-rw-r--r--paludis/repositories/e/traditional_layout.cc11
-rw-r--r--paludis/repositories/e/traditional_layout.hh3
-rw-r--r--paludis/repositories/e/vdb_repository.cc384
-rw-r--r--paludis/repositories/e/vdb_repository.hh2
-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.cc3
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.hh3
-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
-rw-r--r--src/output/console_install_task.cc2
-rw-r--r--src/output/console_install_task.hh2
50 files changed, 596 insertions, 87 deletions
diff --git a/doc/faq/index.html.part b/doc/faq/index.html.part
index 55452cc..ab270d7 100644
--- a/doc/faq/index.html.part
+++ b/doc/faq/index.html.part
@@ -43,6 +43,7 @@ functionality. Pestering anyone about these is liable to get you hurt a lot.</p>
<li><a href="operation.html#updateworldmissesthings">Updating world misses things</a></li>
<li><a href="operation.html#info">Get package information for a bug report</a></li>
<li><a href="operation.html#arrows">What do those fancy arrows when merging things mean?</a></li>
+ <li><a href="operation.html#updates">Profiles Updates for Package Moves and Slot Moves</a></li>
</ul>
<h2>Stricter than Portage</h2>
diff --git a/doc/faq/operation.html.part b/doc/faq/operation.html.part
index 0bd9303..e0c3261 100644
--- a/doc/faq/operation.html.part
+++ b/doc/faq/operation.html.part
@@ -6,6 +6,7 @@
<li><a href="operation.html#updatingdepends">Paludis does not update DEPENDs of already installed packages</a></li>
<li><a href="operation.html#updateworldmissesthings">Updating world misses things</a></li>
<li><a href="operation.html#info">Get package information for a bug report</a></li>
+ <li><a href="operation.html#updates">Profiles Updates for Package Moves and Slot Moves</a></li>
</ul>
<h2 id="updatingdepends">Paludis does not update DEPENDs of already installed packages</h2>
@@ -77,3 +78,23 @@ If it's an installed package, <em>spec</em> can usually just be the qualified pa
<dd>Copied xattrs</dd>
</dl></li>
</ul>
+
+<h2 id="updates">Profiles Updates for Package Moves and Slot Moves</h2>
+
+<p>Gentoo includes support for repositories specifying that a package has moved (e.g. <code>app-misc/foo</code> is now
+called <code>app-admin/foo</code>) or changed slot (e.g. <code>app-misc/foo:0</code> is now
+<code>app-misc/foo:2</code>). Paludis has experimental support for performing these updates after a sync, but by default
+updates are not carried out.</p>
+
+<p><strong>Carrying out updates is not guaranteed to work. Before allowing Paludis to carry out updates, you should back
+ up your VDB. If you don't know what this means, wait until updates have received wider testing. If you don't have a
+ backup of your VDB and things do go wrong, you will have to do a full system reinstall to fix things.</strong></p>
+
+<p>If you fully understand the above paragraph, you can set the <code>PALUDIS_CARRY_OUT_UPDATES</code> environment
+variable to <code>yes</code> and then sync to perform updates.</p>
+
+<p>Sometimes it is possible for renames to cause collisions. For example, if <code>foo</code> is being renamed to
+<code>bar</code>, and you have both <code>foo</code> and <code>bar</code> installed, Paludis will be unable to perform
+the update. In this situation, you should generally manually uninstall the older of <code>foo</code> or
+<code>bar</code>.</p>
+
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/install_task.cc b/paludis/install_task.cc
index 52f7e06..5d372ff 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -1356,7 +1356,7 @@ InstallTask::set_safe_resume(const bool value)
}
HookResult
-InstallTask::perform_hook(const Hook & hook) const
+InstallTask::perform_hook(const Hook & hook)
{
return _imp->env->perform_hook(hook);
}
diff --git a/paludis/install_task.hh b/paludis/install_task.hh
index 37debab..088aeeb 100644
--- a/paludis/install_task.hh
+++ b/paludis/install_task.hh
@@ -255,7 +255,7 @@ namespace paludis
/**
* Perform a hook. By default, delegates to environment.
*/
- virtual HookResult perform_hook(const Hook &) const
+ virtual HookResult perform_hook(const Hook &)
PALUDIS_ATTRIBUTE((warn_unused_result));
/**
diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc
index b0e6a6e..26f5b8f 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 &)
+{
+ 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..c19fa5f 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);
+
///\}
///\name Destination functions
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 587f6ed..66a1ccc 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 &)
+{
+ 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..5b1a1e2 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);
/* RepositoryDestinationInterface */
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index f2dfd53..bba60bf 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 &)
+{
+ 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..33b4084 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);
};
/**
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 7d0227c..5e898c8 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -149,11 +149,14 @@ EInstalledRepository::want_pre_post_phases() const
}
HookResult
-EInstalledRepository::perform_hook(const Hook & hook) const
+EInstalledRepository::perform_hook(const Hook & hook)
{
Context context("When performing hook '" + stringify(hook.name()) + "' for repository '"
+ stringify(name()) + "':");
+ if (hook.name() == "sync_all_post")
+ perform_updates();
+
return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
diff --git a/paludis/repositories/e/e_installed_repository.hh b/paludis/repositories/e/e_installed_repository.hh
index 4b9660c..06e7a28 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;
+ HookResult perform_hook(const Hook & hook)
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
///\name For use by EInstalledRepositoryID
///\{
@@ -108,6 +105,8 @@ namespace paludis
virtual void populate_sets() const;
///\}
+
+ virtual void perform_updates() = 0;
};
}
}
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 3a262e7..0652b2a 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -243,6 +243,7 @@ namespace paludis
std::tr1::shared_ptr<const MetadataValueKey<std::string> > binary_src_uri_prefix_key;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > binary_keywords;
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > accounts_repository_data_location_key;
+ std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > e_updates_location_key;
std::list<std::tr1::shared_ptr<const MetadataKey> > about_keys;
};
@@ -327,7 +328,8 @@ namespace paludis
"binary_uri_prefix", "binary_uri_prefix", mkt_normal, params.binary_uri_prefix())),
binary_keywords(new LiteralMetadataValueKey<std::string> (
"binary_keywords", "binary_keywords", mkt_normal, params.binary_keywords())),
- accounts_repository_data_location_key(layout->accounts_repository_data_location_key())
+ accounts_repository_data_location_key(layout->accounts_repository_data_location_key()),
+ e_updates_location_key(layout->e_updates_location_key())
{
if ((params.location() / "metadata" / "about.conf").is_regular_file_or_symlink_to_regular_file())
{
@@ -499,7 +501,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),
@@ -558,6 +559,8 @@ ERepository::_add_metadata_keys() const
add_metadata_key(_imp->binary_keywords);
if (_imp->accounts_repository_data_location_key)
add_metadata_key(_imp->accounts_repository_data_location_key);
+ if (_imp->e_updates_location_key)
+ add_metadata_key(_imp->e_updates_location_key);
std::for_each(_imp->about_keys.begin(), _imp->about_keys.end(), std::tr1::bind(
std::tr1::mem_fn(&ERepository::add_metadata_key), this, std::tr1::placeholders::_1));
@@ -1068,7 +1071,7 @@ ERepository::merge(const MergeParams & p)
}
HookResult
-ERepository::perform_hook(const Hook & hook) const
+ERepository::perform_hook(const Hook & hook)
{
Context context("When performing hook '" + stringify(hook.name()) + "' for repository '"
+ stringify(name()) + "':");
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index 4a5981f..7f5aeb3 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>,
@@ -185,7 +184,7 @@ namespace paludis
///\}
- HookResult perform_hook(const Hook &) const
+ HookResult perform_hook(const Hook &)
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::tr1::shared_ptr<const CategoryNamePartSet> unimportant_category_names() const;
diff --git a/paludis/repositories/e/exheres_layout.cc b/paludis/repositories/e/exheres_layout.cc
index dd251c7..df6ffab 100644
--- a/paludis/repositories/e/exheres_layout.cc
+++ b/paludis/repositories/e/exheres_layout.cc
@@ -660,3 +660,9 @@ ExheresLayout::accounts_repository_data_location_key() const
return make_null_shared_ptr();
}
+std::tr1::shared_ptr<MetadataValueKey<FSEntry> >
+ExheresLayout::e_updates_location_key() const
+{
+ return make_null_shared_ptr();
+}
+
diff --git a/paludis/repositories/e/exheres_layout.hh b/paludis/repositories/e/exheres_layout.hh
index 12af444..6bea452 100644
--- a/paludis/repositories/e/exheres_layout.hh
+++ b/paludis/repositories/e/exheres_layout.hh
@@ -130,6 +130,9 @@ namespace paludis
virtual std::tr1::shared_ptr<MetadataValueKey<FSEntry> > accounts_repository_data_location_key() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual std::tr1::shared_ptr<MetadataValueKey<FSEntry> > e_updates_location_key() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
virtual void invalidate_masks();
};
}
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 382e7dc..2361772 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)),
@@ -600,3 +599,8 @@ ExndbamRepository::regenerate_cache() const
{
}
+void
+ExndbamRepository::perform_updates()
+{
+}
+
diff --git a/paludis/repositories/e/exndbam_repository.hh b/paludis/repositories/e/exndbam_repository.hh
index d5fb511..91377d6 100644
--- a/paludis/repositories/e/exndbam_repository.hh
+++ b/paludis/repositories/e/exndbam_repository.hh
@@ -139,6 +139,8 @@ namespace paludis
const std::tr1::function<std::string (const std::string &)> &);
///\}
+
+ virtual void perform_updates();
};
class PALUDIS_VISIBLE ExndbamRepositoryConfigurationError : public ConfigurationError
diff --git a/paludis/repositories/e/layout.hh b/paludis/repositories/e/layout.hh
index 6595747..3eeca4f 100644
--- a/paludis/repositories/e/layout.hh
+++ b/paludis/repositories/e/layout.hh
@@ -152,6 +152,9 @@ namespace paludis
virtual std::tr1::shared_ptr<MetadataValueKey<FSEntry> > accounts_repository_data_location_key() const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual std::tr1::shared_ptr<MetadataValueKey<FSEntry> > e_updates_location_key() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
virtual FSEntry sync_filter_file() const;
virtual void invalidate_masks() = 0;
diff --git a/paludis/repositories/e/traditional_layout.cc b/paludis/repositories/e/traditional_layout.cc
index 15ce2c5..e30842a 100644
--- a/paludis/repositories/e/traditional_layout.cc
+++ b/paludis/repositories/e/traditional_layout.cc
@@ -41,6 +41,7 @@
#include <paludis/util/hashes.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/choice.hh>
+#include <paludis/literal_metadata_key.hh>
#include <tr1/functional>
#include <tr1/unordered_map>
#include <functional>
@@ -671,3 +672,13 @@ TraditionalLayout::accounts_repository_data_location_key() const
return make_null_shared_ptr();
}
+std::tr1::shared_ptr<MetadataValueKey<FSEntry> >
+TraditionalLayout::e_updates_location_key() const
+{
+ if ((_imp->tree_root / "profiles" / "updates").exists())
+ return make_shared_ptr(new LiteralMetadataValueKey<FSEntry>("e_updates_location",
+ "VDBRepository updates data location", mkt_internal, _imp->tree_root / "profiles" / "updates"));
+ else
+ return make_null_shared_ptr();
+}
+
diff --git a/paludis/repositories/e/traditional_layout.hh b/paludis/repositories/e/traditional_layout.hh
index a7c70b7..db107dd 100644
--- a/paludis/repositories/e/traditional_layout.hh
+++ b/paludis/repositories/e/traditional_layout.hh
@@ -132,6 +132,9 @@ namespace paludis
virtual std::tr1::shared_ptr<MetadataValueKey<FSEntry> > accounts_repository_data_location_key() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual std::tr1::shared_ptr<MetadataValueKey<FSEntry> > e_updates_location_key() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
virtual FSEntry sync_filter_file() const;
virtual void invalidate_masks();
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 2cca557..221402a 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -50,6 +50,10 @@
#include <paludis/version_operator.hh>
#include <paludis/version_requirements.hh>
#include <paludis/stringify_formatter.hh>
+#include <paludis/selection.hh>
+#include <paludis/generator.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/filter.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/dir_iterator.hh>
@@ -69,6 +73,7 @@
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/output_manager.hh>
#include <paludis/util/safe_ifstream.hh>
#include <paludis/util/safe_ofstream.hh>
@@ -79,6 +84,7 @@
#include <vector>
#include <list>
#include <map>
+#include <iostream>
#include <cstring>
#include <cerrno>
@@ -161,7 +167,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)),
@@ -1144,3 +1149,380 @@ VDBRepository::installed_root_key() const
return _imp->root_key;
}
+namespace
+{
+ typedef std::map<QualifiedPackageName, QualifiedPackageName> DepRewrites;
+
+ struct DepRewriter
+ {
+ const DepRewrites & rewrites;
+ bool changed;
+
+ std::stringstream str;
+ StringifyFormatter f;
+
+ DepRewriter(const DepRewrites & w) :
+ rewrites(w),
+ changed(false)
+ {
+ }
+
+ void do_annotations(const DepSpec & p)
+ {
+ if (p.annotations_key() && (p.annotations_key()->begin_metadata() != p.annotations_key()->end_metadata()))
+ {
+ str << " [[ ";
+ for (MetadataSectionKey::MetadataConstIterator k(p.annotations_key()->begin_metadata()),
+ k_end(p.annotations_key()->end_metadata()) ;
+ k != k_end ; ++k)
+ {
+ const MetadataValueKey<std::string> * r(
+ simple_visitor_cast<const MetadataValueKey<std::string> >(**k));
+ if (! r)
+ throw InternalError(PALUDIS_HERE, "annotations must be string keys");
+ str << (*k)->raw_name() << " = [" << (r->value().empty() ? " " : " " + r->value() + " ") << "] ";
+ }
+ str << "]] ";
+ }
+ }
+
+ void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
+ {
+ str << "|| ( ";
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ str << " ) ";
+ do_annotations(*node.spec());
+ }
+
+ void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
+ {
+ str << "( ";
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ str << " ) ";
+ do_annotations(*node.spec());
+ }
+
+ void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node)
+ {
+ /* don't rewrite blocks. some people block the old package after
+ * doing a move. */
+ str << f.format(*node.spec(), format::Plain()) << " ";
+ do_annotations(*node.spec());
+ }
+
+ void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node)
+ {
+ str << f.format(*node.spec(), format::Plain()) << " ";
+ do_annotations(*node.spec());
+ }
+
+ void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
+ {
+ if (node.spec()->package_ptr() && rewrites.end() != rewrites.find(*node.spec()->package_ptr()))
+ {
+ changed = true;
+ str << f.format(PartiallyMadePackageDepSpec(*node.spec())
+ .package(rewrites.find(*node.spec()->package_ptr())->second),
+ format::Plain()) << " ";
+ }
+ else
+ str << f.format(*node.spec(), format::Plain()) << " ";
+
+ do_annotations(*node.spec());
+ }
+
+ void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
+ {
+ str << f.format(*node.spec(), format::Plain()) << " ( ";
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ str << " ) ";
+ do_annotations(*node.spec());
+ }
+
+ void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
+ {
+ str << f.format(*node.spec(), format::Plain()) << " ";
+ do_annotations(*node.spec());
+ }
+ };
+
+ bool rewrite_dependencies(
+ const FSEntry & f,
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > & key,
+ const DepRewrites & rewrites)
+ {
+ DepRewriter v(rewrites);
+ key->value()->root()->accept(v);
+ if (v.changed)
+ {
+ if ("yes" == getenv_with_default("PALUDIS_CARRY_OUT_UPDATES", ""))
+ {
+ std::cout << " Rewriting " << f << std::endl;
+ SafeOFStream ff(f);
+ ff << v.str.str() << std::endl;
+ }
+ else
+ std::cout << " Would rewrite " << f << std::endl;
+ }
+
+ return v.changed;
+ }
+}
+
+void
+VDBRepository::perform_updates()
+{
+ Context context("When performing updates:");
+
+ DepRewrites dep_rewrites;
+
+ typedef std::list<std::pair<std::tr1::shared_ptr<const PackageID>, QualifiedPackageName> > Moves;
+ Moves moves;
+
+ typedef std::list<std::pair<std::tr1::shared_ptr<const PackageID>, SlotName> > SlotMoves;
+ SlotMoves slot_moves;
+
+ for (PackageDatabase::RepositoryConstIterator r(_imp->params.environment()->package_database()->begin_repositories()),
+ r_end(_imp->params.environment()->package_database()->end_repositories()) ;
+ r != r_end ; ++r)
+ {
+ Context context_2("When performing updates from '" + stringify((*r)->name()) + "':");
+
+ Repository::MetadataConstIterator k_iter((*r)->find_metadata("e_updates_location"));
+ if (k_iter == (*r)->end_metadata())
+ {
+ Log::get_instance()->message("e.vdb.updates.no_key", ll_debug, lc_context) <<
+ "Repository " << (*r)->name() << " defines no e_updates_location key";
+ continue;
+ }
+
+ const MetadataValueKey<FSEntry> * k(simple_visitor_cast<const MetadataValueKey<FSEntry> >(**k_iter));
+ if (! k)
+ {
+ Log::get_instance()->message("e.vdb.udpates.bad_key", ll_warning, lc_context) <<
+ "Repository " << (*r)->name() << " defines an e_updates_location key, but it is not an FSEntry key";
+ continue;
+ }
+
+ FSEntry dir(k->value());
+ if (! dir.is_directory_or_symlink_to_directory())
+ {
+ Log::get_instance()->message("e.vdb.updates.bad_key", ll_warning, lc_context) <<
+ "Repository " << (*r)->name() << " has e_updates_location " << dir << ", but this is not a directory";
+ continue;
+ }
+
+ try
+ {
+ for (DirIterator d(k->value(), DirIteratorOptions()), d_end ;
+ d != d_end ; ++d)
+ {
+ Context context_3("When performing updates from '" + stringify(*d) + "':");
+
+ if (! d->is_regular_file_or_symlink_to_regular_file())
+ continue;
+
+ LineConfigFile f(*d, LineConfigFileOptions());
+
+ for (LineConfigFile::ConstIterator line(f.begin()), line_end(f.end()) ;
+ line != line_end ; ++line)
+ {
+ std::vector<std::string> tokens;
+ tokenise_whitespace(*line, std::back_inserter(tokens));
+
+ if (tokens.empty())
+ continue;
+
+ if ("move" == tokens.at(0))
+ {
+ if (3 == tokens.size())
+ {
+ QualifiedPackageName old_q(tokens.at(1)), new_q(tokens.at(2));
+
+ /* we want to rewrite deps to avoid a mess. we do
+ * this even if we don't have an installed thing
+ * matching the dep, since a package might dep upon
+ * || ( a b ) where a is installed and b is being
+ * moved. */
+ dep_rewrites.insert(std::make_pair(old_q, new_q)).first->second = new_q;
+
+ const std::tr1::shared_ptr<const PackageIDSequence> ids((*_imp->params.environment())[selection::AllVersionsSorted(
+ generator::Package(old_q) & generator::InRepository(name())
+ )]);
+ if (! ids->empty())
+ {
+ for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ i != i_end ; ++i)
+ moves.push_back(std::make_pair(*i, new_q));
+ }
+ }
+ else
+ Log::get_instance()->message("e.vdb.updates.bad_line", ll_warning, lc_context) <<
+ "Don't know how to handle '" << *line << "' in " << *d << ": expected 3 tokens for a move";
+ }
+ else if ("slotmove" == tokens.at(0))
+ {
+ if (4 == tokens.size())
+ {
+ PackageDepSpec old_spec(parse_user_package_dep_spec(tokens.at(1), _imp->params.environment(),
+ UserPackageDepSpecOptions()));
+ SlotName old_slot(tokens.at(2)), new_slot(tokens.at(3));
+
+ const std::tr1::shared_ptr<const PackageIDSequence> ids((*_imp->params.environment())[selection::AllVersionsSorted(
+ (generator::Matches(old_spec, MatchPackageOptions()) & generator::InRepository(name())) |
+ filter::Slot(old_slot)
+ )]);
+ if (! ids->empty())
+ {
+ for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ i != i_end ; ++i)
+ slot_moves.push_back(std::make_pair(*i, new_slot));
+ }
+ }
+ else
+ Log::get_instance()->message("e.vdb.updates.bad_line", ll_warning, lc_context) <<
+ "Don't know how to handle '" << *line << "' in " << *d << ": expected 4 tokens for a slotmove";
+ }
+ else
+ Log::get_instance()->message("e.vdb.updates.bad_line", ll_warning, lc_context) <<
+ "Don't know how to handle '" << *line << "' in " << *d << ": unknown operation";
+ }
+ }
+ }
+ catch (const Exception & e)
+ {
+ Log::get_instance()->message("e.vdb.updates.exception", ll_warning, lc_context) <<
+ "Caught exception '" << e.message() << "' (" << e.what() << ") when looking for updates. This is "
+ "probably bad.";
+ }
+ }
+
+ try
+ {
+ std::cout << std::endl;
+
+ if (! moves.empty())
+ {
+ if ("yes" == getenv_with_default("PALUDIS_CARRY_OUT_UPDATES", ""))
+ {
+ std::cout << "Performing package moves:" << std::endl;
+ for (Moves::const_iterator m(moves.begin()), m_end(moves.end()) ;
+ m != m_end ; ++m)
+ {
+ std::cout << " " << *m->first << " to " << m->second << std::endl;
+
+ FSEntry target_cat_dir(_imp->params.location() / stringify(m->second.category()));
+ target_cat_dir.mkdir();
+
+ FSEntry from_dir(m->first->fs_location_key()->value());
+ FSEntry to_dir(target_cat_dir / ((stringify(m->second.package()) + "-" + stringify(m->first->version()))));
+
+ if (to_dir.exists())
+ {
+ /* Uh oh. It's possible to install both a package and its renamed version. */
+ Log::get_instance()->message("e.vdb.updates.collision", ll_warning, lc_context) <<
+ "I wanted to rename '" << from_dir << "' to '" << to_dir << "' for a package move, but the "
+ "latter already exists. Consult the Paludis FAQ for how to proceed.";
+ }
+ else
+ from_dir.rename(to_dir);
+ }
+ }
+ else
+ {
+ std::cout << "The following package moves need to be performed:" << std::endl;
+ for (Moves::const_iterator m(moves.begin()), m_end(moves.end()) ;
+ m != m_end ; ++m)
+ std::cout << " " << *m->first << " to " << m->second << std::endl;
+ std::cout << std::endl;
+ }
+ }
+
+ if (! slot_moves.empty())
+ {
+ if ("yes" == getenv_with_default("PALUDIS_CARRY_OUT_UPDATES", ""))
+ {
+ std::cout << "Performing slot moves:" << std::endl;
+ for (SlotMoves::const_iterator m(slot_moves.begin()), m_end(slot_moves.end()) ;
+ m != m_end ; ++m)
+ {
+ std::cout << " " << *m->first << " to " << m->second << std::endl;
+
+ SafeOFStream f(m->first->fs_location_key()->value() / "SLOT");
+ f << m->second << std::endl;
+ }
+ }
+ else
+ {
+ std::cout << "The following slot moves need to be performed:" << std::endl;
+ for (SlotMoves::const_iterator m(slot_moves.begin()), m_end(slot_moves.end()) ;
+ m != m_end ; ++m)
+ std::cout << " " << *m->first << " to " << m->second << std::endl;
+ std::cout << std::endl;
+ }
+ }
+
+ if ("yes" != getenv_with_default("PALUDIS_CARRY_OUT_UPDATES", ""))
+ {
+ if ((! moves.empty()) || (! slot_moves.empty()))
+ {
+ std::cout << "Profile updates support is currently considered experimental. See the Paludis" << std::endl;
+ std::cout << "FAQ for how to proceed." << std::endl;
+ std::cout << std::endl;
+ }
+ }
+ else
+ {
+ if ((! moves.empty()) || (! slot_moves.empty()))
+ if (_imp->params.provides_cache() != FSEntry("/var/empty"))
+ if (_imp->params.provides_cache().is_regular_file_or_symlink_to_regular_file())
+ {
+ std::cout << "Invalidating provides cache following updates" << std::endl;
+ FSEntry(_imp->params.provides_cache()).unlink();
+ regenerate_provides_cache();
+ }
+ }
+
+ if ((! moves.empty()) || (! slot_moves.empty()))
+ invalidate();
+
+ if (! dep_rewrites.empty())
+ {
+ std::cout << "Updating installed package dependencies" << std::endl;
+
+ bool rewrite_done(false);
+ const std::tr1::shared_ptr<const PackageIDSequence> ids((*_imp->params.environment())[selection::AllVersionsSorted(
+ generator::InRepository(name()))]);
+ for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ i != i_end ; ++i)
+ {
+ if ((*i)->build_dependencies_key())
+ rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->value() / (*i)->build_dependencies_key()->raw_name(),
+ (*i)->build_dependencies_key(), dep_rewrites);
+ if ((*i)->run_dependencies_key())
+ rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->value() / (*i)->run_dependencies_key()->raw_name(),
+ (*i)->run_dependencies_key(), dep_rewrites);
+ if ((*i)->post_dependencies_key())
+ rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->value() / (*i)->post_dependencies_key()->raw_name(),
+ (*i)->post_dependencies_key(), dep_rewrites);
+ if ((*i)->suggested_dependencies_key())
+ rewrite_done |= rewrite_dependencies((*i)->fs_location_key()->value() / (*i)->suggested_dependencies_key()->raw_name(),
+ (*i)->suggested_dependencies_key(), dep_rewrites);
+ }
+
+ if ("yes" != getenv_with_default("PALUDIS_CARRY_OUT_UPDATES", ""))
+ {
+ std::cout << "Some installed packages have dependencies that need rewriting for package" << std::endl;
+ std::cout << "moves. See the Paludis FAQ for how to proceed." << std::endl;
+ std::cout << std::endl;
+ }
+ }
+ }
+ catch (const Exception & e)
+ {
+ Log::get_instance()->message("e.vdb.updates.exception", ll_warning, lc_context) <<
+ "Caught exception '" << e.message() << "' (" << e.what() << ") when performing updates. This is "
+ "probably bad.";
+ }
+}
+
diff --git a/paludis/repositories/e/vdb_repository.hh b/paludis/repositories/e/vdb_repository.hh
index c5cdbee..3d39c0f 100644
--- a/paludis/repositories/e/vdb_repository.hh
+++ b/paludis/repositories/e/vdb_repository.hh
@@ -178,6 +178,8 @@ namespace paludis
const std::tr1::function<std::string (const std::string &)> &);
///\}
+
+ virtual void perform_updates();
};
/**
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..57140c7 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 &)
+{
+ 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..7ae08c0 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);
};
}
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index 29e3695..6113f43 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 &)
+{
+ 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..bf267fe 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);
};
}
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index 8c3edf0..f86afb0 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 &)
+{
+ 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..d336303 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)
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/unavailable/unavailable_repository.cc b/paludis/repositories/unavailable/unavailable_repository.cc
index 96f3c8d..2a0a3e7 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 &)
+{
+ 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..7dc2222 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);
};
}
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index ca0e0ca..8b8f3c0 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 &)
+{
+ 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..c05e4d6 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)
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.cc b/paludis/repositories/unpackaged/unpackaged_repository.cc
index 05022ca..6557dd7 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 &)
+{
+ 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..fe13511 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)
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/unwritten/unwritten_repository.cc b/paludis/repositories/unwritten/unwritten_repository.cc
index 5802238..3deba97 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 &)
+{
+ 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..55faace 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);
};
}
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 3c64417..f676e6d 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)),
@@ -237,7 +236,7 @@ InstalledVirtualsRepository::invalidate_masks()
}
HookResult
-InstalledVirtualsRepository::perform_hook(const Hook & hook) const
+InstalledVirtualsRepository::perform_hook(const Hook & hook)
{
Context context("When performing hook '" + stringify(hook.name()) + "' for repository '"
+ stringify(name()) + "':");
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.hh b/paludis/repositories/virtuals/installed_virtuals_repository.hh
index 5a72619..d99bfc2 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>
@@ -83,7 +82,7 @@ namespace paludis
virtual bool can_be_favourite_repository() const;
- HookResult perform_hook(const Hook &) const
+ HookResult perform_hook(const Hook &)
PALUDIS_ATTRIBUTE((warn_unused_result));
/* Repository */
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index 5dcbaa3..d4dacd9 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 &)
+{
+ 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..a96ec48 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)
+ 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..9e8f6b2 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)
+ 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
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index aac492b..e741c6a 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -1958,7 +1958,7 @@ ConsoleInstallTask::on_installed_paludis()
}
HookResult
-ConsoleInstallTask::perform_hook(const Hook & hook) const
+ConsoleInstallTask::perform_hook(const Hook & hook)
{
std::string resume_command(make_resume_command(true));
if (resume_command.empty())
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index f36d933..beadfdc 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -248,7 +248,7 @@ namespace paludis
void show_resume_command(const std::string &) const;
virtual std::string make_resume_command(const bool undo_failures) const = 0;
virtual void on_installed_paludis();
- virtual HookResult perform_hook(const Hook &) const;
+ virtual HookResult perform_hook(const Hook &);
///\}