aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-03 22:16:11 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-03 22:16:11 +0000
commit62090354aff70bbc6d49e6bcc83ef6c9a0636377 (patch)
treec3fe04df02194d326095ac92a9455ccac29778f8
parenta273d4a37a4eb622a4dfe390731f8797c6bd5227 (diff)
downloadpaludis-62090354aff70bbc6d49e6bcc83ef6c9a0636377.tar.gz
paludis-62090354aff70bbc6d49e6bcc83ef6c9a0636377.tar.xz
Add --dl-new-slots control
-rw-r--r--NEWS4
-rw-r--r--paludis/dep_list/dep_list.cc18
-rw-r--r--paludis/dep_list/dep_list.hh11
-rw-r--r--paludis/dep_list/dep_list.sr1
-rw-r--r--src/clients/paludis/command_line.cc5
-rw-r--r--src/clients/paludis/command_line.hh1
-rw-r--r--src/clients/paludis/install.cc10
7 files changed, 50 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index cb16e89..0dff5ef 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,10 @@ of every change, see the ChangeLog.
0.14.1:
* Versions can include -rx.y, -rx.y.z etc.
+ * Paludis can now be told to pull in new slots only where really necessary,
+ via --dl-new-slots as-needed. This must be used in conjunction with the
+ existing --dl-upgrade.
+
0.14.0:
* The merge and unmerge utilities are now called with an explicit path.
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index 5f6a5e6..00dcd65 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -70,6 +70,7 @@ DepListOptions::DepListOptions() :
reinstall_scm(dl_reinstall_scm_never),
target_type(dl_target_package),
upgrade(dl_upgrade_always),
+ new_slots(dl_new_slots_always),
fall_back(dl_fall_back_as_needed_except_targets),
installed_deps_pre(dl_deps_discard),
installed_deps_runtime(dl_deps_try_post),
@@ -491,6 +492,23 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
Log::get_instance()->message(ll_debug, lc_context, "Not taking installed package '"
+ stringify(*already_installed_in_same_slot->last()) + "' over '" + stringify(*best_visible_candidate) + "'");
}
+ else if ((! already_installed->empty()) && (dl_new_slots_as_needed == d->_imp->opts.new_slots))
+ {
+ /* we have an already installed, but not in the same slot, and our options
+ * allow us to take this. */
+ if (d->prefer_installed_over_uninstalled(*already_installed->last(), *best_visible_candidate))
+ {
+ Log::get_instance()->message(ll_debug, lc_context, "Taking installed package '"
+ + stringify(*already_installed->last()) + "' over '" + stringify(*best_visible_candidate)
+ + "' (in different slot)");
+ d->add_already_installed_package(*already_installed->last(), a->tag());
+ return;
+ }
+ else
+ Log::get_instance()->message(ll_debug, lc_context, "Not taking installed package '"
+ + stringify(*already_installed->last()) + "' over '" + stringify(*best_visible_candidate)
+ + "' (in different slot)");
+ }
else
Log::get_instance()->message(ll_debug, lc_context, "No installed packages in SLOT '"
+ stringify(slot) + "', taking uninstalled package '" + stringify(*best_visible_candidate) + "'");
diff --git a/paludis/dep_list/dep_list.hh b/paludis/dep_list/dep_list.hh
index f1d9f54..3601bdf 100644
--- a/paludis/dep_list/dep_list.hh
+++ b/paludis/dep_list/dep_list.hh
@@ -95,6 +95,17 @@ namespace paludis
};
/**
+ * When should we pull in a new slot.
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListNewSlotsOption
+ {
+ dl_new_slots_always,
+ dl_new_slots_as_needed
+ };
+
+ /**
* How should we handle a dep class.
*
* \ingroup grpdepresolver
diff --git a/paludis/dep_list/dep_list.sr b/paludis/dep_list/dep_list.sr
index 211dc3f..0f55fdd 100644
--- a/paludis/dep_list/dep_list.sr
+++ b/paludis/dep_list/dep_list.sr
@@ -7,6 +7,7 @@ make_class_DepListOptions()
key reinstall_scm DepListReinstallScmOption
key target_type DepListTargetType
key upgrade DepListUpgradeOption
+ key new_slots DepListNewSlotsOption
key fall_back DepListFallBackOption
key installed_deps_pre DepListDepsOption
diff --git a/src/clients/paludis/command_line.cc b/src/clients/paludis/command_line.cc
index c7c05dc..5dd28c2 100644
--- a/src/clients/paludis/command_line.cc
+++ b/src/clients/paludis/command_line.cc
@@ -122,6 +122,11 @@ CommandLine::CommandLine() :
("always", "Always")
("as-needed", "As needed"),
"always"),
+ dl_new_slots(&dl_args, "dl-new-slots", '\0', "When to pull in new slots (works with --dl-upgrade)",
+ args::EnumArg::EnumArgOptions
+ ("always", "Always")
+ ("as-needed", "As needed"),
+ "always"),
dl_deps_default(&dl_args, "dl-deps-default", '\0',
"Override default behaviour for all dependency classes",
diff --git a/src/clients/paludis/command_line.hh b/src/clients/paludis/command_line.hh
index 30386a0..1ea703b 100644
--- a/src/clients/paludis/command_line.hh
+++ b/src/clients/paludis/command_line.hh
@@ -226,6 +226,7 @@ class CommandLine :
paludis::args::EnumArg dl_reinstall;
paludis::args::EnumArg dl_reinstall_scm;
paludis::args::EnumArg dl_upgrade;
+ paludis::args::EnumArg dl_new_slots;
paludis::args::DepsOptionArg dl_deps_default;
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 019a379..c43e0db 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -315,6 +315,16 @@ do_install()
throw args::DoHelp("bad value for --dl-upgrade");
}
+ if (CommandLine::get_instance()->dl_new_slots.specified())
+ {
+ if (CommandLine::get_instance()->dl_new_slots.argument() == "as-needed")
+ options.new_slots = dl_new_slots_as_needed;
+ else if (CommandLine::get_instance()->dl_new_slots.argument() == "always")
+ options.new_slots = dl_new_slots_always;
+ else
+ throw args::DoHelp("bad value for --dl-new-slots");
+ }
+
if (CommandLine::get_instance()->dl_circular.specified())
{
if (CommandLine::get_instance()->dl_circular.argument() == "discard")