aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Stephen P. Bennett <spb@exherbo.org> 2006-01-17 20:13:28 +0000
committerAvatar Stephen P. Bennett <spb@exherbo.org> 2006-01-17 20:13:28 +0000
commita6a485c803a80f4c7e8296e908a69aaaa1fa2e75 (patch)
tree0821680efa8a6eec9bb8692b30799bc69cf01867
parent496f06a2698725ed6ba7e955d812d872024416b1 (diff)
downloadpaludis-a6a485c803a80f4c7e8296e908a69aaaa1fa2e75.tar.gz
paludis-a6a485c803a80f4c7e8296e908a69aaaa1fa2e75.tar.xz
Changed --dl-rdepend-post to an enum. Options are never, always, and as-needed.
-rw-r--r--paludis/dep_list.cc29
-rw-r--r--paludis/dep_list.hh27
-rw-r--r--src/install.cc11
3 files changed, 49 insertions, 18 deletions
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 808159e..c911f5c 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -62,7 +62,7 @@ namespace paludis
const PackageDatabaseEntry * current_package;
int stack_depth;
- bool rdepend_post;
+ DepListRdependOption rdepend_post;
bool drop_circular;
bool drop_self_circular;
bool ignore_installed;
@@ -76,7 +76,7 @@ namespace paludis
match_found(false),
current_package(0),
stack_depth(0),
- rdepend_post(false),
+ rdepend_post(dlro_as_needed),
drop_circular(false),
drop_self_circular(false),
ignore_installed(false),
@@ -185,7 +185,7 @@ DepList::visit(const PackageDepAtom * const p)
Context context("When resolving package dependency '" + stringify(*p) + "':");
bool already_there = false;
- bool do_rdepend_post = false;
+ bool do_rdepend_post = (_implementation->rdepend_post == dlro_always);
/* are we already installed? */
if ((! _implementation->ignore_installed) &&
@@ -274,16 +274,19 @@ DepList::visit(const PackageDepAtom * const p)
/* merge dependencies */
_add_in_role(DepParser::parse(metadata->get(vmk_depend)), "DEPEND");
- try
- {
- _add_in_role(DepParser::parse(metadata->get(vmk_rdepend)), "RDEPEND");
- }
- catch (const CircularDependencyError &)
+ if (_implementation->rdepend_post != dlro_always)
{
- if (_implementation->rdepend_post)
- do_rdepend_post = true;
- else
- throw;
+ try
+ {
+ _add_in_role(DepParser::parse(metadata->get(vmk_rdepend)), "RDEPEND");
+ }
+ catch (const CircularDependencyError &)
+ {
+ if (_implementation->rdepend_post != dlro_never)
+ do_rdepend_post = true;
+ else
+ throw;
+ }
}
}
@@ -442,7 +445,7 @@ DepList::visit(const BlockDepAtom * const d)
}
void
-DepList::set_rdepend_post(const bool value)
+DepList::set_rdepend_post(const DepListRdependOption value)
{
_implementation->rdepend_post = value;
}
diff --git a/paludis/dep_list.hh b/paludis/dep_list.hh
index e3dcf8b..5baaa1e 100644
--- a/paludis/dep_list.hh
+++ b/paludis/dep_list.hh
@@ -31,6 +31,28 @@
namespace paludis
{
/**
+ * Used in DepList::set_rdepend_post
+ */
+ enum DepListRdependOption
+ {
+ /**
+ * RDEPENDs are always merged before the package; abort if this fails.
+ */
+ dlro_never,
+
+ /**
+ * RDEPENDs can be merged after the package, just before PDEPEND, if this is
+ * necessary for correct resolution
+ */
+ dlro_as_needed,
+
+ /**
+ * RDEPENDs are always merged with PDEPENDs.
+ */
+ dlro_always
+ };
+
+ /**
* Holds a list of dependencies in merge order.
*/
class DepList :
@@ -86,10 +108,9 @@ namespace paludis
Iterator end() const;
/**
- * Behaviour: if set, RDEPEND entries can be treated as PDEPEND
- * where necessary.
+ * Behaviour: determines when RDEPEND entries can be treated as PDEPEND.
*/
- void set_rdepend_post(const bool value);
+ void set_rdepend_post(const DepListRdependOption value);
/**
* Behaviour: if set, a package that depends directly upon itself
diff --git a/src/install.cc b/src/install.cc
index 4b9687b..8b737a0 100644
--- a/src/install.cc
+++ b/src/install.cc
@@ -61,13 +61,20 @@ do_install()
}
p::DepList dep_list(env);
- dep_list.set_rdepend_post(CommandLine::get_instance()->a_dl_rdepend_post.specified());
dep_list.set_drop_self_circular(CommandLine::get_instance()->a_dl_drop_self_circular.specified());
dep_list.set_drop_circular(CommandLine::get_instance()->a_dl_drop_circular.specified());
dep_list.set_ignore_installed(CommandLine::get_instance()->a_dl_ignore_installed.specified());
dep_list.set_recursive_deps(CommandLine::get_instance()->a_dl_recursive_deps.specified());
dep_list.set_max_stack_depth(CommandLine::get_instance()->a_dl_max_stack_depth.argument());
+ if (CommandLine::get_instance()->a_dl_rdepend_post.argument() == "always")
+ dep_list.set_rdepend_post(p::dlro_always);
+ else if (CommandLine::get_instance()->a_dl_rdepend_post.argument() == "never")
+ dep_list.set_rdepend_post(p::dlro_never);
+ else
+ dep_list.set_rdepend_post(p::dlro_as_needed);
+
+
try
{
dep_list.add(targets);
@@ -129,7 +136,7 @@ do_install()
<< e.what() << ")" << endl;
cerr << endl;
- dep_list.set_rdepend_post(true);
+// dep_list.set_rdepend_post(true);
try
{
dep_list.add(targets);