aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-26 22:24:18 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-26 22:24:18 +0000
commit122deff0405e27bf99a4ba04dcc9019cc9eb50d1 (patch)
tree54362b2c3f932f37c8e2d30e51396421be6c533f
parent5792dd3cc81e6099ca98a6c7d76183aee6f3d596 (diff)
downloadpaludis-122deff0405e27bf99a4ba04dcc9019cc9eb50d1.tar.gz
paludis-122deff0405e27bf99a4ba04dcc9019cc9eb50d1.tar.xz
Catch fetch errors at pretend time.
Fixes: ticket:685
-rw-r--r--doc/api/cplusplus/examples/example_action.cc1
-rw-r--r--paludis/action.hh11
-rw-r--r--paludis/environments/paludis/default_output.conf4
-rw-r--r--paludis/environments/paludis/output_conf.cc19
-rw-r--r--paludis/environments/paludis/output_managers/Makefile.am1
-rw-r--r--paludis/environments/paludis/output_managers/standard_on_failure.conf6
-rw-r--r--paludis/files.m43
-rw-r--r--paludis/forward_on_failure_output_manager-fwd.hh28
-rw-r--r--paludis/forward_on_failure_output_manager.cc119
-rw-r--r--paludis/forward_on_failure_output_manager.hh62
-rw-r--r--paludis/install_task.cc55
-rw-r--r--paludis/output_manager_factory.cc2
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc14
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.hh3
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc2
-rw-r--r--paludis/repositories/e/ebuild_entries.cc20
-rw-r--r--paludis/util/tribool-fwd.hh4
-rw-r--r--paludis/util/tribool.cc51
-rw-r--r--python/action.cc1
-rw-r--r--ruby/action.cc1
-rw-r--r--src/clients/accerso/accerso.cc1
-rw-r--r--src/clients/appareo/appareo.cc1
-rw-r--r--src/output/console_install_task.cc3
23 files changed, 389 insertions, 23 deletions
diff --git a/doc/api/cplusplus/examples/example_action.cc b/doc/api/cplusplus/examples/example_action.cc
index 45eacd8..6e84a45 100644
--- a/doc/api/cplusplus/examples/example_action.cc
+++ b/doc/api/cplusplus/examples/example_action.cc
@@ -76,6 +76,7 @@ int main(int argc, char * argv[])
FetchAction fetch_action(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(false),
+ value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(true)
));
diff --git a/paludis/action.hh b/paludis/action.hh
index 57587bb..7472e88 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -55,6 +55,7 @@ namespace paludis
struct failed_integrity_checks;
struct fetch_unneeded;
struct if_for_install_id;
+ struct ignore_unfetched;
struct is_overwrite;
struct make_output_manager;
struct perform_uninstall;
@@ -82,6 +83,15 @@ namespace paludis
NamedValue<n::fetch_unneeded, bool> fetch_unneeded;
/**
+ * Ignore any unfetched packages. Verify digests for anything that's
+ * already there, and if we know for sure manual fetching will be
+ * required, raise the appropriate error.
+ *
+ * \since 0.36
+ */
+ NamedValue<n::ignore_unfetched, bool> ignore_unfetched;
+
+ /**
* This is a function to avoid chicken / egg problems when using
* Environment::create_output_manager.
*
@@ -90,6 +100,7 @@ namespace paludis
NamedValue<n::make_output_manager, std::tr1::function<std::tr1::shared_ptr<OutputManager> (
const FetchAction &)> > make_output_manager;
+
NamedValue<n::safe_resume, bool> safe_resume;
};
diff --git a/paludis/environments/paludis/default_output.conf b/paludis/environments/paludis/default_output.conf
index 21ab224..863880e 100644
--- a/paludis/environments/paludis/default_output.conf
+++ b/paludis/environments/paludis/default_output.conf
@@ -13,3 +13,7 @@ type = * output_exclusivity = background : quiet
type = package action = pretend : standard
+# We only want to show pretend-time fetch verification if it failed.
+
+type = package action = fetch ignore_unfetched = true : standard_on_failure
+
diff --git a/paludis/environments/paludis/output_conf.cc b/paludis/environments/paludis/output_conf.cc
index feee537..5b30b47 100644
--- a/paludis/environments/paludis/output_conf.cc
+++ b/paludis/environments/paludis/output_conf.cc
@@ -32,6 +32,8 @@
#include <paludis/util/destringify.hh>
#include <paludis/util/options.hh>
#include <paludis/util/make_shared_copy.hh>
+#include <paludis/util/tribool.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/create_output_manager_info.hh>
#include <paludis/package_id.hh>
@@ -48,6 +50,7 @@ namespace paludis
namespace n
{
struct action_requirement;
+ struct ignore_unfetched_requirement;
struct manager;
struct matches_requirement;
struct name_requirement;
@@ -61,6 +64,7 @@ namespace
struct Rule
{
NamedValue<n::action_requirement, std::string> action_requirement;
+ NamedValue<n::ignore_unfetched_requirement, Tribool> ignore_unfetched_requirement;
NamedValue<n::manager, std::string> manager;
NamedValue<n::matches_requirement, std::tr1::shared_ptr<PackageDepSpec> > matches_requirement;
NamedValue<n::name_requirement, std::string> name_requirement;
@@ -110,6 +114,8 @@ namespace
v, env, UserPackageDepSpecOptions() + updso_allow_wildcards + updso_no_disambiguation));
else if (k == "action")
rule.action_requirement() = v;
+ else if (k == "ignore_unfetched")
+ rule.ignore_unfetched_requirement() = destringify<Tribool>(v);
else
throw PaludisConfigError("Unknown rule '" + k + "'");
}
@@ -143,6 +149,9 @@ namespace
if (rule.matches_requirement())
return false;
+ if (! rule.ignore_unfetched_requirement().is_indeterminate())
+ return false;
+
return true;
}
@@ -165,6 +174,15 @@ namespace
*i.package_id(), MatchPackageOptions()))
return false;
+ if (! rule.ignore_unfetched_requirement().is_indeterminate())
+ {
+ const FetchAction * const fetch_action(simple_visitor_cast<const FetchAction>(i.action()));
+ if (! fetch_action)
+ return false;
+ if (fetch_action->options.ignore_unfetched() != rule.ignore_unfetched_requirement().is_true())
+ return false;
+ }
+
return true;
}
};
@@ -205,6 +223,7 @@ OutputConf::add(const FSEntry & filename)
Rule rule(make_named_values<Rule>(
value_for<n::action_requirement>("*"),
+ value_for<n::ignore_unfetched_requirement>(indeterminate),
value_for<n::manager>("unset"),
value_for<n::matches_requirement>(make_null_shared_ptr()),
value_for<n::name_requirement>("*"),
diff --git a/paludis/environments/paludis/output_managers/Makefile.am b/paludis/environments/paludis/output_managers/Makefile.am
index b2fdadb..46cf87b 100644
--- a/paludis/environments/paludis/output_managers/Makefile.am
+++ b/paludis/environments/paludis/output_managers/Makefile.am
@@ -15,6 +15,7 @@ dist_shareenvpaludis_DATA = \
logged.conf \
quiet.conf \
standard.conf \
+ standard_on_failure.conf \
keep_messages.part.conf \
keep_stdout_as_messages.part.conf \
logged_only.part.conf \
diff --git a/paludis/environments/paludis/output_managers/standard_on_failure.conf b/paludis/environments/paludis/output_managers/standard_on_failure.conf
new file mode 100644
index 0000000..f6dd6e0
--- /dev/null
+++ b/paludis/environments/paludis/output_managers/standard_on_failure.conf
@@ -0,0 +1,6 @@
+# This handler saves up output (in memory, so don't use it for big processes)
+# and displays it to standard only if an error occurs.
+
+handler = forward_on_failure
+child = standard
+
diff --git a/paludis/files.m4 b/paludis/files.m4
index a3492e8..7e76c4e 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -36,8 +36,9 @@ add(`filter', `hh', `cc', `fwd', `test')
add(`filter_handler', `hh', `cc', `fwd')
add(`filtered_generator', `hh', `cc', `fwd', `test')
add(`find_unused_packages_task', `hh', `cc')
-add(`fuzzy_finder', `hh', `cc', `test')
add(`formatter', `hh', `fwd', `cc')
+add(`forward_on_failure_output_manager', `hh', `fwd', `cc')
+add(`fuzzy_finder', `hh', `cc', `test')
add(`generator', `hh', `cc', `fwd', `test')
add(`generator_handler', `hh', `cc', `fwd')
add(`handled_information', `hh', `fwd', `cc')
diff --git a/paludis/forward_on_failure_output_manager-fwd.hh b/paludis/forward_on_failure_output_manager-fwd.hh
new file mode 100644
index 0000000..c3c8ec8
--- /dev/null
+++ b/paludis/forward_on_failure_output_manager-fwd.hh
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_FORWARD_ON_FAILURE_OUTPUT_MANAGER_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_FORWARD_ON_FAILURE_OUTPUT_MANAGER_FWD_HH 1
+
+namespace paludis
+{
+ class ForwardOnFailureOutputManager;
+}
+
+#endif
diff --git a/paludis/forward_on_failure_output_manager.cc b/paludis/forward_on_failure_output_manager.cc
new file mode 100644
index 0000000..2113544
--- /dev/null
+++ b/paludis/forward_on_failure_output_manager.cc
@@ -0,0 +1,119 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/forward_on_failure_output_manager.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/destringify.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/stringify.hh>
+
+using namespace paludis;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<ForwardOnFailureOutputManager>
+ {
+ std::stringstream stdout_stream;
+ std::stringstream stderr_stream;
+ const std::tr1::shared_ptr<OutputManager> child;
+ bool success;
+
+ Implementation(
+ const std::tr1::shared_ptr<OutputManager> & m
+ ) :
+ child(m),
+ success(false)
+ {
+ }
+ };
+}
+
+ForwardOnFailureOutputManager::ForwardOnFailureOutputManager(const std::tr1::shared_ptr<OutputManager> & m) :
+ PrivateImplementationPattern<ForwardOnFailureOutputManager>(new Implementation<ForwardOnFailureOutputManager>(m))
+{
+}
+
+ForwardOnFailureOutputManager::~ForwardOnFailureOutputManager()
+{
+ if (! _imp->success)
+ {
+ std::copy((std::istreambuf_iterator<char>(_imp->stdout_stream)),
+ std::istreambuf_iterator<char>(),
+ std::ostreambuf_iterator<char>(_imp->child->stdout_stream()));
+ std::copy((std::istreambuf_iterator<char>(_imp->stderr_stream)),
+ std::istreambuf_iterator<char>(),
+ std::ostreambuf_iterator<char>(_imp->child->stderr_stream()));
+ }
+}
+
+std::ostream &
+ForwardOnFailureOutputManager::stdout_stream()
+{
+ return _imp->stdout_stream;
+}
+
+std::ostream &
+ForwardOnFailureOutputManager::stderr_stream()
+{
+ return _imp->stderr_stream;
+}
+
+void
+ForwardOnFailureOutputManager::succeeded()
+{
+ _imp->success = true;
+}
+
+void
+ForwardOnFailureOutputManager::message(const MessageType, const std::string &)
+{
+}
+
+const std::tr1::shared_ptr<const Set<std::string> >
+ForwardOnFailureOutputManager::factory_managers()
+{
+ std::tr1::shared_ptr<Set<std::string> > result(new Set<std::string>);
+ result->insert("forward_on_failure");
+ return result;
+}
+
+const std::tr1::shared_ptr<OutputManager>
+ForwardOnFailureOutputManager::factory_create(
+ const OutputManagerFactory::KeyFunction & key_func,
+ const OutputManagerFactory::CreateChildFunction & create_child_function,
+ const OutputManagerFactory::ReplaceVarsFunc &)
+{
+ std::string child_s(key_func("child"));
+
+ if (child_s.empty())
+ throw ConfigurationError("Key 'child' not specified when creating a forward_on_failure output manager");
+
+ std::tr1::shared_ptr<OutputManager> child(create_child_function(child_s));
+
+ return make_shared_ptr(new ForwardOnFailureOutputManager(child));
+}
+
+template class PrivateImplementationPattern<ForwardOnFailureOutputManager>;
+
+
diff --git a/paludis/forward_on_failure_output_manager.hh b/paludis/forward_on_failure_output_manager.hh
new file mode 100644
index 0000000..a5e0611
--- /dev/null
+++ b/paludis/forward_on_failure_output_manager.hh
@@ -0,0 +1,62 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_FORWARD_ON_FAILURE_OUTPUT_MANAGER_HH
+#define PALUDIS_GUARD_PALUDIS_FORWARD_ON_FAILURE_OUTPUT_MANAGER_HH 1
+
+#include <paludis/file_output_manager-fwd.hh>
+#include <paludis/output_manager.hh>
+#include <paludis/output_manager_factory.hh>
+#include <paludis/util/set-fwd.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <tr1/memory>
+#include <tr1/functional>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE ForwardOnFailureOutputManager :
+ private PrivateImplementationPattern<ForwardOnFailureOutputManager>,
+ public OutputManager
+ {
+ public:
+ ForwardOnFailureOutputManager(const std::tr1::shared_ptr<OutputManager> & child);
+ ~ForwardOnFailureOutputManager();
+
+ virtual std::ostream & stdout_stream() PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual std::ostream & stderr_stream() PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual void succeeded();
+ virtual void message(const MessageType, const std::string &);
+
+ static const std::tr1::shared_ptr<const Set<std::string> > factory_managers()
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const std::tr1::shared_ptr<OutputManager> factory_create(
+ const OutputManagerFactory::KeyFunction &,
+ const OutputManagerFactory::CreateChildFunction &,
+ const OutputManagerFactory::ReplaceVarsFunc &)
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<ForwardOnFailureOutputManager>;
+#endif
+}
+
+#endif
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index bce25ce..adb91bb 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -671,28 +671,62 @@ InstallTask::_pretend()
on_pretend_all_pre();
SupportsActionTest<PretendAction> pretend_action_query;
+ SupportsActionTest<FetchAction> fetch_action_query;
for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
dep != dep_end ; ++dep)
{
if ((dlk_package != dep->kind()) || already_done(*dep))
continue;
- if (dep->package_id()->supports_action(pretend_action_query))
+ if (dep->package_id()->supports_action(pretend_action_query) ||
+ dep->package_id()->supports_action(fetch_action_query))
{
on_pretend_pre(*dep);
OutputManagerFromEnvironment output_manager_holder(_imp->env, dep->package_id(), oe_exclusive);
- PretendActionOptions options(make_named_values<PretendActionOptions>(
- value_for<n::make_output_manager>(std::tr1::ref(output_manager_holder))
- ));
- PretendAction pretend_action(options);
- dep->package_id()->perform_action(pretend_action);
- if (pretend_action.failed())
+
+ bool success(true);
+ if (dep->package_id()->supports_action(pretend_action_query))
{
- pretend_failed = true;
- dep->handled().reset(new DepListEntryHandledFailed);
+ PretendActionOptions options(make_named_values<PretendActionOptions>(
+ value_for<n::make_output_manager>(std::tr1::ref(output_manager_holder))
+ ));
+ PretendAction pretend_action(options);
+ dep->package_id()->perform_action(pretend_action);
+ if (pretend_action.failed())
+ {
+ pretend_failed = true;
+ success = false;
+ dep->handled().reset(new DepListEntryHandledFailed);
+ }
}
- else
+
+ if (dep->package_id()->supports_action(fetch_action_query))
+ {
+ FetchActionOptions options(make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(false),
+ value_for<n::fetch_unneeded>(false),
+ value_for<n::ignore_unfetched>(true),
+ value_for<n::make_output_manager>(std::tr1::ref(output_manager_holder)),
+ value_for<n::safe_resume>(_imp->safe_resume)
+ ));
+ FetchAction fetch_action(options);
+ try
+ {
+ dep->package_id()->perform_action(fetch_action);
+ }
+ catch (const FetchActionError & e)
+ {
+ pretend_failed = true;
+ success = false;
+ if (output_manager_holder.output_manager_if_constructed())
+ on_fetch_action_error(output_manager_holder.output_manager_if_constructed(), e);
+ else
+ on_fetch_action_error(make_shared_ptr(new StandardOutputManager), e);
+ }
+ }
+
+ if (success)
{
if (output_manager_holder.output_manager_if_constructed())
output_manager_holder.output_manager_if_constructed()->succeeded();
@@ -1796,6 +1830,7 @@ InstallTask::make_fetch_action_options(const DepListEntry &, OutputManagerFromEn
return make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(false),
+ value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(std::tr1::ref(o)),
value_for<n::safe_resume>(_imp->safe_resume)
);
diff --git a/paludis/output_manager_factory.cc b/paludis/output_manager_factory.cc
index c5ad781..66b0df0 100644
--- a/paludis/output_manager_factory.cc
+++ b/paludis/output_manager_factory.cc
@@ -35,6 +35,7 @@
#include <list>
#include <paludis/file_output_manager.hh>
+#include <paludis/forward_on_failure_output_manager.hh>
#include <paludis/messages_to_stdout_output_handler.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/tee_output_manager.hh>
@@ -87,6 +88,7 @@ OutputManagerFactory::OutputManagerFactory() :
{
/* we might want to make this plugin loadable at some point */
add_manager(FileOutputManager::factory_managers(), FileOutputManager::factory_create);
+ add_manager(ForwardOnFailureOutputManager::factory_managers(), ForwardOnFailureOutputManager::factory_create);
add_manager(MessagesToStdoutOutputManager::factory_managers(), MessagesToStdoutOutputManager::factory_create);
add_manager(StandardOutputManager::factory_managers(), StandardOutputManager::factory_create);
add_manager(TeeOutputManager::factory_managers(), TeeOutputManager::factory_create);
diff --git a/paludis/repositories/e/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
index 2f69de2..48d57e1 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.cc
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -63,6 +63,7 @@ namespace paludis
const FSEntry distdir;
const bool check_unneeded;
const bool exclude_unmirrorable;
+ const bool ignore_unfetched;
std::set<std::string> done;
const std::tr1::shared_ptr<Sequence<FetchActionFailure> > failures;
@@ -82,12 +83,14 @@ namespace paludis
const FSEntry & m2,
const UseManifest um,
const std::tr1::shared_ptr<OutputManager> & md,
- const bool x) :
+ const bool x,
+ const bool u) :
env(e),
id(i),
distdir(d),
check_unneeded(c),
exclude_unmirrorable(x),
+ ignore_unfetched(u),
failures(new Sequence<FetchActionFailure>),
need_nofetch(false),
in_nofetch(n),
@@ -108,8 +111,9 @@ CheckFetchedFilesVisitor::CheckFetchedFilesVisitor(
const FSEntry & m2,
const UseManifest um,
const std::tr1::shared_ptr<OutputManager> & md,
- const bool x) :
- PrivateImplementationPattern<CheckFetchedFilesVisitor>(new Implementation<CheckFetchedFilesVisitor>(e, i, d, c, n, m2, um, md, x))
+ const bool x,
+ const bool u) :
+ PrivateImplementationPattern<CheckFetchedFilesVisitor>(new Implementation<CheckFetchedFilesVisitor>(e, i, d, c, n, m2, um, md, x, u))
{
}
@@ -384,7 +388,7 @@ CheckFetchedFilesVisitor::visit(const FetchableURISpecTree::NodeType<FetchableUR
));
}
}
- else
+ else if (! _imp->ignore_unfetched)
{
Log::get_instance()->message("e.check_fetched_files.does_not_exist", ll_debug, lc_context)
<< "Automatic fetch failed for '" << node.spec()->filename() << "'";
@@ -396,6 +400,8 @@ CheckFetchedFilesVisitor::visit(const FetchableURISpecTree::NodeType<FetchableUR
value_for<n::target_file>(node.spec()->filename())
));
}
+ else
+ _imp->output_manager->stdout_stream() << "not fetched yet";
}
else if (0 == (_imp->distdir / node.spec()->filename()).file_size())
{
diff --git a/paludis/repositories/e/check_fetched_files_visitor.hh b/paludis/repositories/e/check_fetched_files_visitor.hh
index 90f4b49..138ead8 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.hh
+++ b/paludis/repositories/e/check_fetched_files_visitor.hh
@@ -52,7 +52,8 @@ namespace paludis
const FSEntry & m2,
const UseManifest um,
const std::tr1::shared_ptr<OutputManager> & output_manager,
- const bool exclude_unmirrorable);
+ const bool exclude_unmirrorable,
+ const bool ignore_unfetched);
~CheckFetchedFilesVisitor();
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 2772a9d..edef15c 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -930,6 +930,7 @@ namespace test_cases
FetchAction action(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(false),
+ value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(true)
));
@@ -1035,6 +1036,7 @@ namespace test_cases
FetchAction action(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(false),
+ value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(true)
));
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 32bbe7d..5d91abd 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -435,17 +435,23 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
(_imp->e_repository->params().master_repositories() && ! _imp->e_repository->params().master_repositories()->empty()) ?
stringify((*_imp->e_repository->params().master_repositories()->begin())->name()) :
stringify(_imp->e_repository->name()));
- FetchVisitor f(_imp->params.environment(), id, *id->eapi(),
- _imp->e_repository->params().distdir(), fetch_action.options.fetch_unneeded(),
- fetch_userpriv_ok, mirrors_name,
- id->fetches_key()->initial_label(), fetch_action.options.safe_resume(),
- output_manager);
- id->fetches_key()->value()->root()->accept(f);
+
+ if (! fetch_action.options.ignore_unfetched())
+ {
+ FetchVisitor f(_imp->params.environment(), id, *id->eapi(),
+ _imp->e_repository->params().distdir(), fetch_action.options.fetch_unneeded(),
+ fetch_userpriv_ok, mirrors_name,
+ id->fetches_key()->initial_label(), fetch_action.options.safe_resume(),
+ output_manager);
+ id->fetches_key()->value()->root()->accept(f);
+ }
+
CheckFetchedFilesVisitor c(_imp->environment, id, _imp->e_repository->params().distdir(),
fetch_action.options.fetch_unneeded(), fetch_restrict,
((_imp->e_repository->layout()->package_directory(id->name())) / "Manifest"),
_imp->e_repository->params().use_manifest(),
- output_manager, fetch_action.options.exclude_unmirrorable());
+ output_manager, fetch_action.options.exclude_unmirrorable(),
+ fetch_action.options.ignore_unfetched());
id->fetches_key()->value()->root()->accept(c);
if (c.need_nofetch())
diff --git a/paludis/util/tribool-fwd.hh b/paludis/util/tribool-fwd.hh
index b536c90..ae4cb67 100644
--- a/paludis/util/tribool-fwd.hh
+++ b/paludis/util/tribool-fwd.hh
@@ -22,6 +22,7 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/no_type.hh>
+#include <iosfwd>
namespace paludis
{
@@ -30,6 +31,9 @@ namespace paludis
typedef NoType<0u> * (* TriboolIndeterminateValueType) (const NoType<0u> * const);
NoType<0u> * indeterminate(const NoType<0u> * const) PALUDIS_VISIBLE;
+
+ std::ostream & operator<< (std::ostream &, const Tribool) PALUDIS_VISIBLE;
+ std::istream & operator>> (std::istream &, Tribool &) PALUDIS_VISIBLE;
}
#endif
diff --git a/paludis/util/tribool.cc b/paludis/util/tribool.cc
index 9b639c6..b1bcf16 100644
--- a/paludis/util/tribool.cc
+++ b/paludis/util/tribool.cc
@@ -18,6 +18,11 @@
*/
#include <paludis/util/tribool.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/stringify.hh>
+#include <string>
+#include <istream>
+#include <ostream>
using namespace paludis;
@@ -60,3 +65,49 @@ paludis::indeterminate(const NoType<0u> * const)
return 0;
}
+std::ostream &
+paludis::operator<< (std::ostream & s, const Tribool v)
+{
+ if (v.is_true())
+ s << "true";
+ else if (v.is_false())
+ s << "false";
+ else if (v.is_indeterminate())
+ s << "indeterminate";
+ else
+ throw InternalError(PALUDIS_HERE, "Bad tribool");
+ return s;
+}
+
+std::istream &
+paludis::operator>> (std::istream & s, Tribool & a)
+{
+ std::string value;
+ s >> value;
+
+ do
+ {
+ if (value == "true")
+ {
+ a = true;
+ break;
+ }
+
+ if (value == "false")
+ {
+ a = false;
+ break;
+ }
+
+ if (value == "indeterminate")
+ {
+ a = indeterminate;
+ break;
+ }
+
+ s.setstate(std::ios::badbit);
+ } while (false);
+
+ return s;
+}
+
diff --git a/python/action.cc b/python/action.cc
index 862993a..88fa194 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -120,6 +120,7 @@ namespace
return new FetchActionOptions(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(exclude_unmirrorable),
value_for<n::fetch_unneeded>(fetch_unneeded),
+ value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(safe_resume)
));
diff --git a/ruby/action.cc b/ruby/action.cc
index 8c9c079..700291c 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -255,6 +255,7 @@ namespace
ptr = new FetchActionOptions(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(v_exclude_unmirrorable),
value_for<n::fetch_unneeded>(v_fetch_unneeded),
+ value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(v_safe_resume)
));
diff --git a/src/clients/accerso/accerso.cc b/src/clients/accerso/accerso.cc
index 54615cc..1e2ebc5 100644
--- a/src/clients/accerso/accerso.cc
+++ b/src/clients/accerso/accerso.cc
@@ -145,6 +145,7 @@ main(int argc, char *argv[])
FetchAction a(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(true),
value_for<n::fetch_unneeded>(true),
+ value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(std::tr1::ref(output_manager_holder)),
value_for<n::safe_resume>(true)
));
diff --git a/src/clients/appareo/appareo.cc b/src/clients/appareo/appareo.cc
index 29e9387..0c51a71 100644
--- a/src/clients/appareo/appareo.cc
+++ b/src/clients/appareo/appareo.cc
@@ -104,6 +104,7 @@ namespace
FetchAction a(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(true),
+ value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(true)
));
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 9fd1128..bab32b1 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -435,6 +435,9 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
void
ConsoleInstallTask::on_pretend_all_pre()
{
+ output_endl();
+ output_activity_start_message("Checking for possible errors...");
+ output_activity_end_message();
}
void