aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-11-22 22:52:48 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-11-22 22:52:48 +0000
commitf946430c361864a353707eb91b48209ba7b52550 (patch)
treecb29a164a4756b92b23d97e40cef7ac880ef08c1
parent01456e93f0e6e5dd4ce3632b1590e3cf4609b646 (diff)
downloadpaludis-f946430c361864a353707eb91b48209ba7b52550.tar.gz
paludis-f946430c361864a353707eb91b48209ba7b52550.tar.xz
Split up fetching, and give it its own job
-rw-r--r--doc/api/cplusplus/examples/example_action.cc3
-rw-r--r--paludis/action-fwd.hh4
-rw-r--r--paludis/action.hh14
-rw-r--r--paludis/action.se19
-rw-r--r--paludis/install_task.cc6
-rw-r--r--paludis/repositories/e/e_repository.cc10
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc6
-rw-r--r--paludis/resolver/job-fwd.hh1
-rw-r--r--paludis/resolver/job.cc72
-rw-r--r--paludis/resolver/job.hh25
-rw-r--r--paludis/resolver/jobs.cc10
-rw-r--r--paludis/resolver/orderer.cc22
-rw-r--r--paludis/resolver/resolver_test.cc5
-rw-r--r--python/action.cc14
-rwxr-xr-xpython/action_TEST.py3
-rw-r--r--ruby/action.cc11
-rw-r--r--ruby/action_TEST.rb4
-rw-r--r--src/clients/accerso/accerso.cc3
-rw-r--r--src/clients/appareo/appareo.cc3
-rw-r--r--src/clients/cave/cmd_display_resolution.cc6
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc32
-rw-r--r--src/clients/cave/cmd_perform.cc17
22 files changed, 230 insertions, 60 deletions
diff --git a/doc/api/cplusplus/examples/example_action.cc b/doc/api/cplusplus/examples/example_action.cc
index bb78116..aff7939 100644
--- a/doc/api/cplusplus/examples/example_action.cc
+++ b/doc/api/cplusplus/examples/example_action.cc
@@ -79,8 +79,7 @@ int main(int argc, char * argv[])
FetchAction fetch_action(make_named_values<FetchActionOptions>(
value_for<n::errors>(failures),
value_for<n::exclude_unmirrorable>(false),
- value_for<n::fetch_regulars_only>(false),
- value_for<n::fetch_unneeded>(false),
+ value_for<n::fetch_parts>(FetchParts() + fp_regulars + fp_extras),
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-fwd.hh b/paludis/action-fwd.hh
index 2fc0aac..fc05946 100644
--- a/paludis/action-fwd.hh
+++ b/paludis/action-fwd.hh
@@ -21,7 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_ACTION_FWD_HH 1
#include <paludis/util/attributes.hh>
-#include <tr1/memory>
+#include <paludis/util/options-fwd.hh>
#include <iosfwd>
/** \file
@@ -58,6 +58,8 @@ namespace paludis
#include <paludis/action-se.hh>
+ typedef Options<FetchPart> FetchParts;
+
}
#endif
diff --git a/paludis/action.hh b/paludis/action.hh
index 85675a0..8537538 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -30,6 +30,7 @@
#include <paludis/util/sequence-fwd.hh>
#include <paludis/util/named_value.hh>
#include <paludis/util/fs_entry-fwd.hh>
+#include <paludis/util/options.hh>
#include <paludis/output_manager-fwd.hh>
#include <paludis/util/type_list.hh>
#include <tr1/functional>
@@ -54,8 +55,7 @@ namespace paludis
struct exclude_unmirrorable;
struct failed_automatic_fetching;
struct failed_integrity_checks;
- struct fetch_regulars_only;
- struct fetch_unneeded;
+ struct fetch_parts;
struct if_for_install_id;
struct ignore_for_unmerge;
struct ignore_unfetched;
@@ -91,17 +91,11 @@ namespace paludis
NamedValue<n::exclude_unmirrorable, bool> exclude_unmirrorable;
/**
- * Avoid fetching for non-regular packages like -scm. If this is specified, the fetch
- * must be background-safe.
+ * Which parts to fetch.
*
* \since 0.43
*/
- NamedValue<n::fetch_regulars_only, bool> fetch_regulars_only;
-
- /**
- * Fetch things in non-enabled flag? () blocks
- */
- NamedValue<n::fetch_unneeded, bool> fetch_unneeded;
+ NamedValue<n::fetch_parts, FetchParts> fetch_parts;
/**
* Ignore any unfetched packages. Verify digests for anything that's
diff --git a/paludis/action.se b/paludis/action.se
index 5983830..41cefb2 100644
--- a/paludis/action.se
+++ b/paludis/action.se
@@ -19,3 +19,22 @@ make_enum_WantPhase()
END
}
+make_enum_FetchPart()
+{
+ prefix fp
+
+ key fp_regulars "Fetch regular parts (backgroundable)"
+ key fp_extras "Fetch extra parts (not backgroundable or separable)"
+ key fp_unneeded "Also fetch untaken foo? ( ... ) sections etc"
+
+ doxygen_comment << "END"
+ /**
+ * Which bits to fetch for a FetchAction.
+ *
+ * \see FetchActionOptions
+ * \ingroup g_repository
+ * \since 0.43
+ */
+END
+}
+
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index 91166af..0235d54 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -759,8 +759,7 @@ InstallTask::_pretend()
FetchActionOptions options(make_named_values<FetchActionOptions>(
value_for<n::errors>(make_shared_ptr(new Sequence<FetchActionFailure>)),
value_for<n::exclude_unmirrorable>(false),
- value_for<n::fetch_regulars_only>(false),
- value_for<n::fetch_unneeded>(false),
+ value_for<n::fetch_parts>(FetchParts() + fp_regulars + fp_extras),
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)
@@ -1924,8 +1923,7 @@ InstallTask::make_fetch_action_options(const DepListEntry &, OutputManagerFromEn
return make_named_values<FetchActionOptions>(
value_for<n::errors>(make_shared_ptr(new Sequence<FetchActionFailure>)),
value_for<n::exclude_unmirrorable>(false),
- value_for<n::fetch_regulars_only>(false),
- value_for<n::fetch_unneeded>(false),
+ value_for<n::fetch_parts>(FetchParts() + fp_regulars + fp_extras),
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/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 7d7cad4..4101f44 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -1944,7 +1944,7 @@ ERepository::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
std::tr1::shared_ptr<OutputManager> output_manager(fetch_action.options.make_output_manager()(fetch_action));
CheckFetchedFilesVisitor c(_imp->params.environment(), id, _imp->params.distdir(),
- fetch_action.options.fetch_unneeded(), fetch_restrict,
+ fetch_action.options.fetch_parts()[fp_unneeded], fetch_restrict,
((_imp->layout->package_directory(id->name())) / "Manifest"),
_imp->params.use_manifest(),
output_manager, fetch_action.options.exclude_unmirrorable(),
@@ -1959,10 +1959,10 @@ ERepository::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
stringify((*_imp->params.master_repositories()->begin())->name()) :
stringify(name()));
- if (! fetch_action.options.ignore_unfetched())
+ if (fetch_action.options.fetch_parts()[fp_regulars] && ! fetch_action.options.ignore_unfetched())
{
FetchVisitor f(_imp->params.environment(), id, *id->eapi(),
- _imp->params.distdir(), fetch_action.options.fetch_unneeded(),
+ _imp->params.distdir(), fetch_action.options.fetch_parts()[fp_unneeded],
fetch_userpriv_ok, mirrors_name,
id->fetches_key()->initial_label(), fetch_action.options.safe_resume(),
output_manager);
@@ -1972,7 +1972,7 @@ ERepository::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
id->fetches_key()->value()->root()->accept(c);
}
- if ( (! fetch_action.options.fetch_regulars_only()) && ((c.need_nofetch()) ||
+ if ( (fetch_action.options.fetch_parts()[fp_extras]) && ((c.need_nofetch()) ||
((! fetch_action.options.ignore_unfetched()) && (! id->eapi()->supported()->ebuild_phases()->ebuild_fetch_extra().empty()))))
{
bool userpriv_ok((! userpriv_restrict) && (_imp->params.environment()->reduced_gid() != getgid()) &&
@@ -2108,7 +2108,7 @@ ERepository::pretend_fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
if (id->fetches_key())
{
PretendFetchVisitor f(_imp->params.environment(), id, *id->eapi(),
- params().distdir(), a.options.fetch_unneeded(),
+ params().distdir(), a.options.fetch_parts()[fp_unneeded],
id->fetches_key()->initial_label(), a);
id->fetches_key()->value()->root()->accept(f);
}
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 6412f04..411cb63 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -934,8 +934,7 @@ namespace test_cases
FetchAction action(make_named_values<FetchActionOptions>(
value_for<n::errors>(make_shared_ptr(new Sequence<FetchActionFailure>)),
value_for<n::exclude_unmirrorable>(false),
- value_for<n::fetch_regulars_only>(false),
- value_for<n::fetch_unneeded>(false),
+ value_for<n::fetch_parts>(FetchParts() + fp_regulars + fp_extras),
value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(true)
@@ -1042,8 +1041,7 @@ namespace test_cases
FetchAction action(make_named_values<FetchActionOptions>(
value_for<n::errors>(make_shared_ptr(new Sequence<FetchActionFailure>)),
value_for<n::exclude_unmirrorable>(false),
- value_for<n::fetch_regulars_only>(false),
- value_for<n::fetch_unneeded>(false),
+ value_for<n::fetch_parts>(FetchParts() + fp_regulars + fp_extras),
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/resolver/job-fwd.hh b/paludis/resolver/job-fwd.hh
index 5f7f71e..3e19e0c 100644
--- a/paludis/resolver/job-fwd.hh
+++ b/paludis/resolver/job-fwd.hh
@@ -28,6 +28,7 @@ namespace paludis
struct SimpleInstallJob;
struct PretendJob;
+ struct FetchJob;
struct NoChangeJob;
struct SyncPointJob;
struct UntakenInstallJob;
diff --git a/paludis/resolver/job.cc b/paludis/resolver/job.cc
index 2a29bb2..1126075 100644
--- a/paludis/resolver/job.cc
+++ b/paludis/resolver/job.cc
@@ -63,6 +63,22 @@ namespace paludis
};
template <>
+ struct Implementation<FetchJob>
+ {
+ const std::tr1::shared_ptr<const Resolution> resolution;
+ const std::tr1::shared_ptr<const ChangesToMakeDecision> decision;
+ const std::tr1::shared_ptr<ArrowSequence> arrows;
+
+ Implementation(const std::tr1::shared_ptr<const Resolution> & r,
+ const std::tr1::shared_ptr<const ChangesToMakeDecision> & d) :
+ resolution(r),
+ decision(d),
+ arrows(new ArrowSequence)
+ {
+ }
+ };
+
+ template <>
struct Implementation<SimpleInstallJob>
{
const std::tr1::shared_ptr<const Resolution> resolution;
@@ -152,6 +168,15 @@ Job::deserialise(Deserialisation & d)
));
do_arrows(result, v);
}
+ else if (d.class_name() == "FetchJob")
+ {
+ Deserialisator v(d, "FetchJob");
+ result.reset(new FetchJob(
+ v.member<std::tr1::shared_ptr<Resolution> >("resolution"),
+ v.member<std::tr1::shared_ptr<ChangesToMakeDecision> >("decision")
+ ));
+ do_arrows(result, v);
+ }
else if (d.class_name() == "UntakenInstallJob")
{
Deserialisator v(d, "UntakenInstallJob");
@@ -258,6 +283,52 @@ PretendJob::serialise(Serialiser & s) const
;
}
+FetchJob::FetchJob(const std::tr1::shared_ptr<const Resolution> & r,
+ const std::tr1::shared_ptr<const ChangesToMakeDecision> & d) :
+ PrivateImplementationPattern<FetchJob>(new Implementation<FetchJob>(r, d))
+{
+}
+
+FetchJob::~FetchJob()
+{
+}
+
+const std::tr1::shared_ptr<const Resolution>
+FetchJob::resolution() const
+{
+ return _imp->resolution;
+}
+
+const std::tr1::shared_ptr<const ChangesToMakeDecision>
+FetchJob::decision() const
+{
+ return _imp->decision;
+}
+
+const std::tr1::shared_ptr<ArrowSequence>
+FetchJob::arrows() const
+{
+ return _imp->arrows;
+}
+
+const JobID
+FetchJob::id() const
+{
+ return make_named_values<JobID>(
+ value_for<n::string_id>("f:" + stringify(resolution()->resolvent()))
+ );
+}
+
+void
+FetchJob::serialise(Serialiser & s) const
+{
+ s.object("FetchJob")
+ .member(SerialiserFlags<serialise::might_be_null, serialise::container>(), "arrows", arrows())
+ .member(SerialiserFlags<serialise::might_be_null>(), "decision", decision())
+ .member(SerialiserFlags<serialise::might_be_null>(), "resolution", resolution())
+ ;
+}
+
SimpleInstallJob::SimpleInstallJob(const std::tr1::shared_ptr<const Resolution> & r,
const std::tr1::shared_ptr<const ChangesToMakeDecision> & d) :
PrivateImplementationPattern<SimpleInstallJob>(new Implementation<SimpleInstallJob>(r, d))
@@ -382,6 +453,7 @@ SyncPointJob::serialise(Serialiser & s) const
template class PrivateImplementationPattern<resolver::NoChangeJob>;
template class PrivateImplementationPattern<resolver::PretendJob>;
+template class PrivateImplementationPattern<resolver::FetchJob>;
template class PrivateImplementationPattern<resolver::SimpleInstallJob>;
template class PrivateImplementationPattern<resolver::SyncPointJob>;
template class PrivateImplementationPattern<resolver::UntakenInstallJob>;
diff --git a/paludis/resolver/job.hh b/paludis/resolver/job.hh
index c2c68f6..0c29846 100644
--- a/paludis/resolver/job.hh
+++ b/paludis/resolver/job.hh
@@ -39,7 +39,7 @@ namespace paludis
{
class PALUDIS_VISIBLE Job :
public virtual DeclareAbstractAcceptMethods<Job, MakeTypeList<
- NoChangeJob, SimpleInstallJob, PretendJob, UntakenInstallJob, SyncPointJob>::Type>
+ NoChangeJob, SimpleInstallJob, PretendJob, FetchJob, UntakenInstallJob, SyncPointJob>::Type>
{
public:
virtual ~Job() = 0;
@@ -97,6 +97,28 @@ namespace paludis
virtual void serialise(Serialiser &) const;
};
+ class PALUDIS_VISIBLE FetchJob :
+ public Job,
+ public ImplementAcceptMethods<Job, FetchJob>,
+ private PrivateImplementationPattern<FetchJob>
+ {
+ public:
+ FetchJob(
+ const std::tr1::shared_ptr<const Resolution> &,
+ const std::tr1::shared_ptr<const ChangesToMakeDecision> &);
+ ~FetchJob();
+
+ virtual const JobID id() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::tr1::shared_ptr<ArrowSequence> arrows()
+ const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ const std::tr1::shared_ptr<const Resolution> resolution() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ const std::tr1::shared_ptr<const ChangesToMakeDecision> decision() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual void serialise(Serialiser &) const;
+ };
+
class PALUDIS_VISIBLE SimpleInstallJob :
public Job,
public ImplementAcceptMethods<Job, SimpleInstallJob>,
@@ -161,6 +183,7 @@ namespace paludis
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
extern template class PrivateImplementationPattern<resolver::NoChangeJob>;
extern template class PrivateImplementationPattern<resolver::PretendJob>;
+ extern template class PrivateImplementationPattern<resolver::FetchJob>;
extern template class PrivateImplementationPattern<resolver::SimpleInstallJob>;
extern template class PrivateImplementationPattern<resolver::SyncPointJob>;
extern template class PrivateImplementationPattern<resolver::UntakenInstallJob>;
diff --git a/paludis/resolver/jobs.cc b/paludis/resolver/jobs.cc
index 2a78ee2..2f31c78 100644
--- a/paludis/resolver/jobs.cc
+++ b/paludis/resolver/jobs.cc
@@ -87,6 +87,11 @@ namespace
jobs_list_by_resolvent_index.insert(std::make_pair(j.resolution()->resolvent(), i));
}
+ void visit(const FetchJob & j)
+ {
+ jobs_list_by_resolvent_index.insert(std::make_pair(j.resolution()->resolvent(), i));
+ }
+
void visit(const SyncPointJob &)
{
}
@@ -115,6 +120,11 @@ namespace
return false;
}
+ bool visit(const FetchJob &) const
+ {
+ return false;
+ }
+
bool visit(const UntakenInstallJob &) const
{
return true;
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index fcfd9c2..a06b3e6 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -190,12 +190,22 @@ namespace
lists->jobs()->add(pretend_job);
lists->unordered_job_ids()->push_back(pretend_job->id());
+ const std::tr1::shared_ptr<FetchJob> fetch_job(new FetchJob(resolution,
+ d.shared_from_this()));
+ lists->jobs()->add(fetch_job);
+ lists->unordered_job_ids()->push_back(fetch_job->id());
+
const std::tr1::shared_ptr<SimpleInstallJob> install_job(new SimpleInstallJob(resolution,
d.shared_from_this()));
lists->jobs()->add(install_job);
lists->unordered_job_ids()->push_back(install_job->id());
- /* we can't do any installs until all pretends have passed */
+ /* we can't do any fetches or installs until all pretends have passed */
+ fetch_job->arrows()->push_back(make_named_values<Arrow>(
+ value_for<n::comes_after>(common_jobs.done_pretends()->id()),
+ value_for<n::maybe_reason>(make_null_shared_ptr())
+ ));
+
install_job->arrows()->push_back(make_named_values<Arrow>(
value_for<n::comes_after>(common_jobs.done_pretends()->id()),
value_for<n::maybe_reason>(make_null_shared_ptr())
@@ -212,6 +222,12 @@ namespace
value_for<n::comes_after>(install_job->id()),
value_for<n::maybe_reason>(make_null_shared_ptr())
));
+
+ /* we can't install until we've fetched */
+ install_job->arrows()->push_back(make_named_values<Arrow>(
+ value_for<n::comes_after>(fetch_job->id()),
+ value_for<n::maybe_reason>(make_null_shared_ptr())
+ ));
}
else
{
@@ -438,6 +454,10 @@ namespace
add_dep_arrows(c.resolution());
}
+ void visit(const FetchJob &)
+ {
+ }
+
void visit(const PretendJob &)
{
}
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index f32176f..0e2893e 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -509,6 +509,11 @@ namespace
return make_null_shared_ptr();
}
+ std::tr1::shared_ptr<const Resolution> visit(const FetchJob &) const
+ {
+ return make_null_shared_ptr();
+ }
+
std::tr1::shared_ptr<const Resolution> visit(const PretendJob &) const
{
return make_null_shared_ptr();
diff --git a/python/action.cc b/python/action.cc
index 53ef9d6..dc9d943 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -123,11 +123,15 @@ namespace
const bool safe_resume
)
{
+ FetchParts parts;
+ parts = parts + fp_regulars + fp_extras;
+ if (fetch_unneeded)
+ parts += fp_unneeded;
+
return new FetchActionOptions(make_named_values<FetchActionOptions>(
value_for<n::errors>(make_shared_ptr(new Sequence<FetchActionFailure>)),
value_for<n::exclude_unmirrorable>(exclude_unmirrorable),
- value_for<n::fetch_regulars_only>(false),
- value_for<n::fetch_unneeded>(fetch_unneeded),
+ value_for<n::fetch_parts>(parts),
value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(safe_resume)
@@ -261,12 +265,6 @@ void expose_action()
"[rw] bool"
)
- .add_property("fetch_unneeded",
- &named_values_getter<FetchActionOptions, n::fetch_unneeded, bool, &FetchActionOptions::fetch_unneeded>,
- &named_values_setter<FetchActionOptions, n::fetch_unneeded, bool, &FetchActionOptions::fetch_unneeded>,
- "[rw] bool"
- )
-
.add_property("safe_resume",
&named_values_getter<FetchActionOptions, n::safe_resume, bool, &FetchActionOptions::safe_resume>,
&named_values_setter<FetchActionOptions, n::safe_resume, bool, &FetchActionOptions::safe_resume>,
diff --git a/python/action_TEST.py b/python/action_TEST.py
index 6b86b0e..900b0a1 100755
--- a/python/action_TEST.py
+++ b/python/action_TEST.py
@@ -52,15 +52,12 @@ class TestCase_02_FetchActionOptions(unittest.TestCase):
fao = FetchActionOptions(True, True, True)
self.assertEquals(fao.exclude_unmirrorable, True)
- self.assertEquals(fao.fetch_unneeded, True)
self.assertEquals(fao.safe_resume, True)
fao.exclude_unmirrorable = False
- fao.fetch_unneeded = False
fao.safe_resume = False
self.assertEquals(fao.exclude_unmirrorable, False)
- self.assertEquals(fao.fetch_unneeded, False)
self.assertEquals(fao.safe_resume, False)
class TestCase_04_InstallAction(unittest.TestCase):
diff --git a/ruby/action.cc b/ruby/action.cc
index 04d86d9..9febae1 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -248,11 +248,15 @@ namespace
rb_raise(rb_eArgError, "FetchActionOptions expects one or three arguments, but got %d",argc);
}
+ FetchParts parts;
+ parts = parts + fp_regulars + fp_extras;
+ if (v_fetch_unneeded)
+ parts += fp_unneeded;
+
ptr = new FetchActionOptions(make_named_values<FetchActionOptions>(
value_for<n::errors>(make_shared_ptr(new Sequence<FetchActionFailure>)),
value_for<n::exclude_unmirrorable>(v_exclude_unmirrorable),
- value_for<n::fetch_regulars_only>(false),
- value_for<n::fetch_unneeded>(v_fetch_unneeded),
+ value_for<n::fetch_parts>(parts),
value_for<n::ignore_unfetched>(false),
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(v_safe_resume)
@@ -743,9 +747,6 @@ namespace
c_fetch_action_options = rb_define_class_under(paludis_module(), "FetchActionOptions", rb_cObject);
rb_define_singleton_method(c_fetch_action_options, "new", RUBY_FUNC_CAST(&fetch_action_options_new), -1);
rb_define_method(c_fetch_action_options, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
- rb_define_method(c_fetch_action_options, "fetch_unneeded?",
- RUBY_FUNC_CAST((&NVFetch<FetchActionOptions, n::fetch_unneeded, bool,
- &FetchActionOptions::fetch_unneeded>::fetch)), 0);
rb_define_method(c_fetch_action_options, "safe_resume?",
RUBY_FUNC_CAST((&NVFetch<FetchActionOptions, n::safe_resume, bool,
&FetchActionOptions::safe_resume>::fetch)), 0);
diff --git a/ruby/action_TEST.rb b/ruby/action_TEST.rb
index 0b5fd3c..57e6bda 100644
--- a/ruby/action_TEST.rb
+++ b/ruby/action_TEST.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# vim: set sw=4 sts=4 et tw=80 :
#
-# Copyright (c) 2007, 2008 Ciaran McCreesh
+# Copyright (c) 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
@@ -167,12 +167,10 @@ module Paludis
def test_options
a = FetchAction.new(FetchActionOptions.new(false, true, false))
assert_kind_of FetchActionOptions, a.options
- assert !a.options.fetch_unneeded?
assert a.options.safe_resume?
a = FetchAction.new(FetchActionOptions.new({:safe_resume => false, :fetch_unneeded => true, :exclude_unmirrorable => false}))
assert_kind_of FetchActionOptions, a.options
- assert a.options.fetch_unneeded?
assert !a.options.safe_resume?
assert !a.options.exclude_unmirrorable?
end
diff --git a/src/clients/accerso/accerso.cc b/src/clients/accerso/accerso.cc
index 2ef1be6..bfa221c 100644
--- a/src/clients/accerso/accerso.cc
+++ b/src/clients/accerso/accerso.cc
@@ -145,8 +145,7 @@ main(int argc, char *argv[])
FetchAction a(make_named_values<FetchActionOptions>(
value_for<n::errors>(make_shared_ptr(new Sequence<FetchActionFailure>)),
value_for<n::exclude_unmirrorable>(true),
- value_for<n::fetch_regulars_only>(true),
- value_for<n::fetch_unneeded>(true),
+ value_for<n::fetch_parts>(FetchParts() + fp_regulars + fp_unneeded),
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 13a5f04..2fdccd8 100644
--- a/src/clients/appareo/appareo.cc
+++ b/src/clients/appareo/appareo.cc
@@ -105,8 +105,7 @@ namespace
FetchAction a(make_named_values<FetchActionOptions>(
value_for<n::errors>(failures),
value_for<n::exclude_unmirrorable>(false),
- value_for<n::fetch_regulars_only>(false),
- value_for<n::fetch_unneeded>(true),
+ value_for<n::fetch_parts>(FetchParts() + fp_regulars + fp_extras + fp_unneeded),
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/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 34273e8..c6bffa4 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -392,6 +392,12 @@ namespace
}
const std::tr1::shared_ptr<const Resolution> visit(
+ const FetchJob &) const
+ {
+ return make_null_shared_ptr();
+ }
+
+ const std::tr1::shared_ptr<const Resolution> visit(
const SyncPointJob &) const
{
return make_null_shared_ptr();
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index b2206ff..a25df94 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -166,12 +166,12 @@ namespace
const std::tr1::shared_ptr<Environment> &,
const ExecuteResolutionCommandLine & cmdline,
const ChangesToMakeDecision & decision,
- const int x, const int y)
+ const int x, const int y, bool normal_only)
{
const std::tr1::shared_ptr<const PackageID> id(decision.origin_id());
Context context("When fetching for '" + stringify(*id) + "':");
- starting_action("fetch", decision, x, y);
+ starting_action("fetch (" + std::string(normal_only ? "regular parts" : "extra parts") + ")", decision, x, y);
std::string command(cmdline.program_options.a_perform_program.argument());
if (command.empty())
@@ -181,10 +181,13 @@ namespace
command.append(stringify(id->uniquely_identifying_spec()));
command.append(" --x-of-y '" + stringify(x) + " of " + stringify(y) + "'");
+ if (normal_only)
+ command.append(" --regulars-only");
+
paludis::Command cmd(command);
int retcode(run_command(cmd));
- done_action("fetch", decision, 0 == retcode);
+ done_action("fetch (" + std::string(normal_only ? "regular parts" : "extra parts") + ")", decision, 0 == retcode);
return retcode;
}
@@ -290,6 +293,10 @@ namespace
void visit(const SimpleInstallJob &)
{
++y_installs;
+ }
+
+ void visit(const FetchJob &)
+ {
++y_fetches;
}
@@ -364,12 +371,27 @@ namespace
throw ActionAbortedError("Aborted by hook");
}
- retcode |= do_fetch(env, cmdline, *job.decision(), ++counts.x_fetches, counts.y_fetches);
+ ++counts.x_installs;
+
+ /* not all of the fetch is done in the background */
+ retcode |= do_fetch(env, cmdline, *job.decision(), counts.x_installs, counts.y_installs, false);
if (0 != retcode)
return false;
retcode |= do_install(env, cmdline, job.resolution(),
- *job.decision(), ++counts.x_installs, counts.y_installs);
+ *job.decision(), counts.x_installs, counts.y_installs);
+ if (0 != retcode)
+ return false;
+
+ return true;
+ }
+
+ bool visit(const FetchJob & job)
+ {
+ if (0 != retcode)
+ return false;
+
+ retcode |= do_fetch(env, cmdline, *job.decision(), ++counts.x_fetches, counts.y_fetches, true);
if (0 != retcode)
return false;
diff --git a/src/clients/cave/cmd_perform.cc b/src/clients/cave/cmd_perform.cc
index 2f592e1..2beba54 100644
--- a/src/clients/cave/cmd_perform.cc
+++ b/src/clients/cave/cmd_perform.cc
@@ -83,6 +83,7 @@ namespace
args::SwitchArg a_exclude_unmirrorable;
args::SwitchArg a_fetch_unneeded;
args::SwitchArg a_ignore_unfetched;
+ args::SwitchArg a_regulars_only;
args::ArgsGroup g_install_action_options;
args::StringArg a_destination;
@@ -116,6 +117,9 @@ namespace
a_ignore_unfetched(&g_fetch_action_options, "ignore-unfetched", '\0',
"Do not fetch any component that has not already been downloaded (but do verify "
"components that have already been downloaded", true),
+ a_regulars_only(&g_fetch_action_options, "regulars-only", '\0',
+ "Only fetch regular components. If this option is not specified, the job cannot safely "
+ "be backgrounded or run in parallel with installs", true),
g_install_action_options(main_options_section(), "Install Action Options",
"Options for if the action is 'install'"),
@@ -315,6 +319,13 @@ PerformCommand::run(
if (cmdline.a_background.specified())
exclusivity = oe_background;
+ FetchParts parts;
+ parts += fp_regulars;
+ if (! cmdline.a_regulars_only.specified())
+ parts += fp_extras;
+ if (cmdline.a_fetch_unneeded.specified())
+ parts += fp_unneeded;
+
if (action == "config")
{
if (cmdline.a_if_supported.specified() && ! id->supports_action(SupportsActionTest<ConfigAction>()))
@@ -336,8 +347,7 @@ PerformCommand::run(
FetchActionOptions options(make_named_values<FetchActionOptions>(
value_for<n::errors>(make_shared_ptr(new Sequence<FetchActionFailure>)),
value_for<n::exclude_unmirrorable>(cmdline.a_exclude_unmirrorable.specified()),
- value_for<n::fetch_regulars_only>(false),
- value_for<n::fetch_unneeded>(cmdline.a_fetch_unneeded.specified()),
+ value_for<n::fetch_parts>(parts),
value_for<n::ignore_unfetched>(cmdline.a_ignore_unfetched.specified()),
value_for<n::make_output_manager>(std::tr1::ref(output_manager_holder)),
value_for<n::safe_resume>(true)
@@ -354,8 +364,7 @@ PerformCommand::run(
FetchActionOptions options(make_named_values<FetchActionOptions>(
value_for<n::errors>(make_shared_ptr(new Sequence<FetchActionFailure>)),
value_for<n::exclude_unmirrorable>(cmdline.a_exclude_unmirrorable.specified()),
- value_for<n::fetch_regulars_only>(false),
- value_for<n::fetch_unneeded>(cmdline.a_fetch_unneeded.specified()),
+ value_for<n::fetch_parts>(parts),
value_for<n::ignore_unfetched>(cmdline.a_ignore_unfetched.specified()),
value_for<n::make_output_manager>(std::tr1::ref(output_manager_holder)),
value_for<n::safe_resume>(true)