aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-06 21:09:05 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-06 21:09:05 +0000
commit76a110f31951af7d9accbbb025ce6f5ef43dae42 (patch)
tree9c12b1a01f9d988bede2323895bf30cd010db55c
parent39b389e80f87ff78cb9d54190ea1a548e62f9f5e (diff)
downloadpaludis-76a110f31951af7d9accbbb025ce6f5ef43dae42.tar.gz
paludis-76a110f31951af7d9accbbb025ce6f5ef43dae42.tar.xz
Improve error message displayed when [use] dependencies aren't met
-rw-r--r--paludis/dep_atom.cc9
-rw-r--r--paludis/dep_atom.hh5
-rw-r--r--paludis/dep_list.cc16
-rw-r--r--paludis/dep_list.hh34
-rw-r--r--src/install.cc14
5 files changed, 78 insertions, 0 deletions
diff --git a/paludis/dep_atom.cc b/paludis/dep_atom.cc
index c8c03d9..86a0dd0 100644
--- a/paludis/dep_atom.cc
+++ b/paludis/dep_atom.cc
@@ -278,3 +278,12 @@ UseRequirements::state(const UseFlagName & u) const
return i->second;
}
+PackageDepAtom::Pointer
+PackageDepAtom::without_use_requirements() const
+{
+ std::string s(text());
+ if (std::string::npos != s.find('['))
+ s.erase(s.find('['));
+ return Pointer(new PackageDepAtom(s));
+}
+
diff --git a/paludis/dep_atom.hh b/paludis/dep_atom.hh
index 87510d7..830ac11 100644
--- a/paludis/dep_atom.hh
+++ b/paludis/dep_atom.hh
@@ -386,6 +386,11 @@ namespace paludis
{
_tag = s;
}
+
+ /**
+ * Fetch a copy of ourself without the USE requirements.
+ */
+ Pointer without_use_requirements() const;
};
/**
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index d715f86..5348392 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -71,6 +71,12 @@ AllMaskedError::AllMaskedError(const std::string & query) throw () :
{
}
+UseRequirementsNotMetError::UseRequirementsNotMetError(const std::string & query) throw () :
+ DepListError("Error searching for '" + query + "': use requirements are not met"),
+ _query(query)
+{
+}
+
BlockError::BlockError(const std::string & msg) throw () :
DepListError("Block: " + msg)
{
@@ -440,6 +446,16 @@ DepList::visit(const PackageDepAtom * const p)
else
return;
}
+ else if (p->use_requirements_ptr())
+ {
+ /* if we *could* have a match except for the AllMaskedError,
+ * throw a UseRequirementsNotMetError error instead. */
+ if (! _imp->environment->package_database()->query(
+ p->without_use_requirements(), is_either)->empty())
+ throw UseRequirementsNotMetError(stringify(*p));
+ else
+ throw AllMaskedError(stringify(*p));
+ }
else
throw AllMaskedError(stringify(*p));
}
diff --git a/paludis/dep_list.hh b/paludis/dep_list.hh
index 5c549d5..8855924 100644
--- a/paludis/dep_list.hh
+++ b/paludis/dep_list.hh
@@ -193,6 +193,40 @@ namespace paludis
};
/**
+ * Thrown if all versions of a particular atom are masked,
+ * but would not be if use requirements were not in effect.
+ *
+ * \ingroup grpdepresolver
+ * \ingroup grpexceptions
+ */
+ class UseRequirementsNotMetError : public DepListError
+ {
+ private:
+ std::string _query;
+
+ public:
+ /**
+ * Constructor.
+ */
+ UseRequirementsNotMetError(const std::string & query) throw ();
+
+ /**
+ * Destructor.
+ */
+ virtual ~UseRequirementsNotMetError() throw ()
+ {
+ }
+
+ /**
+ * Our query.
+ */
+ const std::string & query() const
+ {
+ return _query;
+ }
+ };
+
+ /**
* Thrown if a block is encountered.
*
* \ingroup grpdepresolver
diff --git a/src/install.cc b/src/install.cc
index 5958625..17942be 100644
--- a/src/install.cc
+++ b/src/install.cc
@@ -628,6 +628,20 @@ do_install()
return 1;
}
+ catch (const p::UseRequirementsNotMetError & e)
+ {
+ cout << endl;
+ cerr << "DepList USE requirements not met error:" << endl;
+ cerr << " * " << e.backtrace("\n * ") << e.message() << endl;
+ cerr << endl;
+ cerr << "This error usually indicates that one of the packages you are trying to" << endl;
+ cerr << "install requires that another package be built with particular USE flags" << endl;
+ cerr << "enabled or disabled. You may be able to work around this restriction by" << endl;
+ cerr << "adjusting your use.conf." << endl;
+ cerr << endl;
+
+ return_code |= 1;
+ }
catch (const p::DepListStackTooDeepError & e)
{
cout << endl;