aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-28 23:31:42 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-28 23:31:42 +0000
commit1473db350d17d4501d0409a5882888bb2bb0e560 (patch)
treed6388191309f60a35a4ca64267378119ecef0cae
parent8da54ad0a2dcdacf173bdd2cb336474e41ab648f (diff)
downloadpaludis-1473db350d17d4501d0409a5882888bb2bb0e560.tar.gz
paludis-1473db350d17d4501d0409a5882888bb2bb0e560.tar.xz
Add --dl-no-unnecessary-upgrades commandline option
-rw-r--r--paludis/dep_list.cc13
-rw-r--r--paludis/dep_list.hh5
-rw-r--r--src/command_line.cc1
-rw-r--r--src/command_line.hh3
-rw-r--r--src/install.cc1
5 files changed, 23 insertions, 0 deletions
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 1b6b7eb..759bb89 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -109,6 +109,7 @@ namespace paludis
bool drop_all;
bool ignore_installed;
bool reinstall;
+ bool no_unnecessary_upgrades;
///}
///\name Stack
@@ -333,6 +334,12 @@ DepList::visit(const PackageDepAtom * const p)
PackageDatabaseEntryCollection::ConstPointer installed(
_imp->environment->package_database()->query(*p, is_installed_only));
+ /* if we're installed and we don't want to upgrade unnecessarily,
+ * stop if we're not on a top level target */
+ if ((! installed->empty()) && (_imp->no_unnecessary_upgrades))
+ if (0 != _imp->current_package)
+ return;
+
/* are we already on the merge list? */
{
std::list<DepListEntry>::iterator i;
@@ -821,3 +828,9 @@ DepList::set_reinstall(const bool value)
_imp->reinstall = value;
}
+void
+DepList::set_no_unnecessary_upgrades(const bool value)
+{
+ _imp->no_unnecessary_upgrades = value;
+}
+
diff --git a/paludis/dep_list.hh b/paludis/dep_list.hh
index 9fd17a6..5c549d5 100644
--- a/paludis/dep_list.hh
+++ b/paludis/dep_list.hh
@@ -374,6 +374,11 @@ namespace paludis
* Behaviour: set whether we reinstall first level deps.
*/
void set_reinstall(const bool value);
+
+ /**
+ * Behaviour: set whether we upgrade unnecessarily.
+ */
+ void set_no_unnecessary_upgrades(const bool value);
};
}
diff --git a/src/command_line.cc b/src/command_line.cc
index d99b665..7a68895 100644
--- a/src/command_line.cc
+++ b/src/command_line.cc
@@ -78,6 +78,7 @@ CommandLine::CommandLine() :
a_dl_ignore_installed(&dl_args, "dl-ignore-installed", 'e', "Ignore installed packages"),
a_dl_no_recursive_deps(&dl_args, "dl-no-recursive-deps", '\0', "Don't check runtime dependencies for installed packages"),
a_dl_max_stack_depth(&dl_args, "dl-max-stack-depth", '\0', "Maximum stack depth (default 100)"),
+ a_dl_no_unnecessary_upgrades(&dl_args, "dl-no-unnecessary-upgrades", 'U', "Don't upgrade installed packages except where necessary as a dependency of another package"),
list_args(this, "List options"),
a_repository(&list_args, "repository", '\0', "Matches with this repository name only"),
diff --git a/src/command_line.hh b/src/command_line.hh
index 61d0968..fad52ea 100644
--- a/src/command_line.hh
+++ b/src/command_line.hh
@@ -193,6 +193,9 @@ class CommandLine :
/// --dl-max-stack-depth
paludis::args::IntegerArg a_dl_max_stack_depth;
+ /// --dl-no-unnecessary-upgrades
+ paludis::args::SwitchArg a_dl_no_unnecessary_upgrades;
+
/// }
/// \name List arguments
diff --git a/src/install.cc b/src/install.cc
index 14474b9..d981bdc 100644
--- a/src/install.cc
+++ b/src/install.cc
@@ -81,6 +81,7 @@ do_install()
dep_list.set_ignore_installed(CommandLine::get_instance()->a_dl_ignore_installed.specified());
dep_list.set_recursive_deps(! CommandLine::get_instance()->a_dl_no_recursive_deps.specified());
dep_list.set_max_stack_depth(CommandLine::get_instance()->a_dl_max_stack_depth.argument());
+ dep_list.set_no_unnecessary_upgrades(CommandLine::get_instance()->a_dl_no_unnecessary_upgrades.specified());
if (CommandLine::get_instance()->a_dl_rdepend_post.argument() == "always")
dep_list.set_rdepend_post(p::dlro_always);