aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-14 15:59:39 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-14 15:59:39 +0000
commitcd30ce158f149d0cd9f4b9cdc782e22de193a11c (patch)
treeff1b905994ff72b8b0bf57525c0eb7aa5736dec4
parenta026f1fd0025c786ac16460c9fe06e1d75c9785e (diff)
downloadpaludis-cd30ce158f149d0cd9f4b9cdc782e22de193a11c.tar.gz
paludis-cd30ce158f149d0cd9f4b9cdc782e22de193a11c.tar.xz
Add --dl-reinstall-targets option
-rw-r--r--paludis/tasks/install_task.cc17
-rw-r--r--paludis/tasks/install_task.hh1
-rw-r--r--src/clients/paludis/command_line.cc7
-rw-r--r--src/clients/paludis/command_line.hh1
-rw-r--r--src/clients/paludis/install.cc13
5 files changed, 36 insertions, 3 deletions
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index ae2a36f..6d53c55 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -49,6 +49,7 @@ namespace paludis
bool had_set_targets;
bool had_package_targets;
+ bool override_target_type;
Implementation<InstallTask>(Environment * const e, const DepListOptions & o,
std::tr1::shared_ptr<const DestinationsCollection> d) :
@@ -62,7 +63,8 @@ namespace paludis
pretend(false),
preserve_world(false),
had_set_targets(false),
- had_package_targets(false)
+ had_package_targets(false),
+ override_target_type(false)
{
}
};
@@ -108,7 +110,8 @@ InstallTask::add_target(const std::string & target)
throw HadBothPackageAndSetTargets();
_imp->had_set_targets = true;
- _imp->dep_list.options()->target_type = dl_target_set;
+ if (! _imp->override_target_type)
+ _imp->dep_list.options()->target_type = dl_target_set;
_imp->targets->add_child(s);
done = true;
}
@@ -123,7 +126,8 @@ InstallTask::add_target(const std::string & target)
throw HadBothPackageAndSetTargets();
_imp->had_package_targets = true;
- _imp->dep_list.options()->target_type = dl_target_package;
+ if (! _imp->override_target_type)
+ _imp->dep_list.options()->target_type = dl_target_package;
if (std::string::npos != target.find('/'))
_imp->targets->add_child(PortageDepParser::parse(target, PortageDepParser::Policy::text_is_package_dep_spec(
@@ -599,3 +603,10 @@ InstallTask::perform_hook(const Hook & hook) const
return _imp->env->perform_hook(hook);
}
+void
+InstallTask::override_target_type(const DepListTargetType t)
+{
+ _imp->override_target_type = true;
+ _imp->dep_list.options()->target_type = t;
+}
+
diff --git a/paludis/tasks/install_task.hh b/paludis/tasks/install_task.hh
index 262fd88..31761fb 100644
--- a/paludis/tasks/install_task.hh
+++ b/paludis/tasks/install_task.hh
@@ -76,6 +76,7 @@ namespace paludis
void clear();
bool had_set_targets() const;
bool had_package_targets() const;
+ void override_target_type(const DepListTargetType);
typedef libwrapiter::ForwardIterator<InstallTask, const std::string> TargetsIterator;
TargetsIterator begin_targets() const;
diff --git a/src/clients/paludis/command_line.cc b/src/clients/paludis/command_line.cc
index 4f76a51..f7d14fe 100644
--- a/src/clients/paludis/command_line.cc
+++ b/src/clients/paludis/command_line.cc
@@ -125,6 +125,13 @@ CommandLine::CommandLine() :
("daily", "If they are over a day old")
("weekly", "If they are over a week old"),
"never"),
+ dl_reinstall_targets(&dl_args, "dl-reinstall-targets", '\0', "Whether to reinstall targets",
+ args::EnumArg::EnumArgOptions
+ ("auto", "If the target is a set, never, otherwise always")
+ ("never", "Never")
+ ("always", "Always"),
+ "auto"),
+
dl_upgrade(&dl_args, "dl-upgrade", '\0', "When to upgrade packages",
args::EnumArg::EnumArgOptions
("always", "Always")
diff --git a/src/clients/paludis/command_line.hh b/src/clients/paludis/command_line.hh
index 53e82ec..e5c288d 100644
--- a/src/clients/paludis/command_line.hh
+++ b/src/clients/paludis/command_line.hh
@@ -244,6 +244,7 @@ class CommandLine :
paludis::args::EnumArg dl_reinstall;
paludis::args::EnumArg dl_reinstall_scm;
+ paludis::args::EnumArg dl_reinstall_targets;
paludis::args::EnumArg dl_upgrade;
paludis::args::EnumArg dl_new_slots;
paludis::args::EnumArg dl_downgrade;
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 0a3ced0..e278c61 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -515,6 +515,19 @@ do_install(std::tr1::shared_ptr<Environment> env)
task.set_preserve_world(CommandLine::get_instance()->a_preserve_world.specified());
task.set_safe_resume(CommandLine::get_instance()->a_safe_resume.specified());
+ if (CommandLine::get_instance()->dl_reinstall_targets.specified())
+ {
+ if (CommandLine::get_instance()->dl_reinstall_targets.argument() == "auto")
+ {
+ }
+ else if (CommandLine::get_instance()->dl_reinstall_targets.argument() == "always")
+ task.override_target_type(dl_target_package);
+ else if (CommandLine::get_instance()->dl_reinstall_scm.argument() == "never")
+ task.override_target_type(dl_target_set);
+ else
+ throw args::DoHelp("bad value for --dl-reinstall-targets");
+ }
+
if (CommandLine::get_instance()->a_add_to_world_spec.specified())
task.set_add_to_world_spec(CommandLine::get_instance()->a_add_to_world_spec.argument());