aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-13 05:56:13 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-13 05:56:13 +0000
commitb4413cb1c30bd9cffb5fe04978779775e178db26 (patch)
tree6fa155455bb5291515c7dbbdd52d726f68febb47
parente2e9b46618a384d46faace0f16c27008bd818608 (diff)
downloadpaludis-b4413cb1c30bd9cffb5fe04978779775e178db26.tar.gz
paludis-b4413cb1c30bd9cffb5fe04978779775e178db26.tar.xz
Add InstallTask::add_exact_package. Only run FetchAction on IDs that support it.
-rw-r--r--paludis/install_task.cc39
-rw-r--r--paludis/install_task.hh2
2 files changed, 39 insertions, 2 deletions
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index 15e0dbe..0fcca73 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -206,6 +206,37 @@ InstallTask::add_target(const std::string & target)
}
void
+InstallTask::add_exact_package(const tr1::shared_ptr<const PackageID> & target)
+{
+ Context context("When adding install target '" + stringify(*target) + "' from ID:");
+
+ if (_imp->had_set_targets)
+ {
+ _imp->had_resolution_failures = true;
+ throw HadBothPackageAndSetTargets();
+ }
+
+ _imp->had_package_targets = true;
+ if (! _imp->override_target_type)
+ _imp->dep_list.options()->target_type = dl_target_package;
+
+ tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
+ tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(target->name())),
+ tr1::shared_ptr<CategoryNamePart>(),
+ tr1::shared_ptr<PackageNamePart>(),
+ make_equal_to_version_requirements(target->version()),
+ vr_and,
+ tr1::shared_ptr<SlotName>(new SlotName(target->slot())),
+ tr1::shared_ptr<RepositoryName>(new RepositoryName(target->repository()->name()))));
+
+ spec->set_tag(tr1::shared_ptr<const DepTag>(new TargetDepTag));
+ _imp->targets->add(tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(
+ new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+
+ _imp->raw_targets.push_back(stringify(*spec));
+}
+
+void
InstallTask::_build_dep_list()
{
Context context("When building dependency list:");
@@ -405,8 +436,12 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
/* fetch / install one item */
try
{
- FetchAction fetch_action(_imp->fetch_options);
- dep->package_id->perform_action(fetch_action);
+ SupportsActionTest<FetchAction> test_fetch;
+ if (dep->package_id->supports_action(test_fetch))
+ {
+ FetchAction fetch_action(_imp->fetch_options);
+ dep->package_id->perform_action(fetch_action);
+ }
if (! _imp->fetch_only)
{
diff --git a/paludis/install_task.hh b/paludis/install_task.hh
index 5bbe3e9..44c800d 100644
--- a/paludis/install_task.hh
+++ b/paludis/install_task.hh
@@ -103,6 +103,8 @@ namespace paludis
///\{
void add_target(const std::string &);
+ void add_exact_package(const tr1::shared_ptr<const PackageID> &);
+
void clear();
bool had_set_targets() const PALUDIS_ATTRIBUTE((warn_unused_result));
bool had_package_targets() const PALUDIS_ATTRIBUTE((warn_unused_result));