summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-02-04 09:17:46 -0800
committerZac Medico <zmedico@gentoo.org>2011-02-04 09:17:46 -0800
commit7af8dcf3997cfaf1def14dbfb090242a0751f6a9 (patch)
tree92adfd5f7fb97806c4d5ff24c6819cfc08fd03e0
parent6503980e0e3bcfce9fbaff85c33d87f616e955a9 (diff)
downloadportage-7af8dcf3997cfaf1def14dbfb090242a0751f6a9.tar.gz
portage-7af8dcf3997cfaf1def14dbfb090242a0751f6a9.tar.bz2
portage-7af8dcf3997cfaf1def14dbfb090242a0751f6a9.zip
ebuild(1): ensure REQUIRED_USE is satisfied
-rw-r--r--pym/portage/package/ebuild/doebuild.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index bbc3a4a12..2eb9f11bc 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -39,9 +39,10 @@ from portage.data import portage_gid, portage_uid, secpass, \
uid, userpriv_groups
from portage.dbapi.porttree import _parse_uri_map
from portage.dbapi.virtual import fakedbapi
-from portage.dep import Atom, paren_enclose, use_reduce
+from portage.dep import Atom, check_required_use, \
+ human_readable_required_use, paren_enclose, use_reduce
from portage.eapi import eapi_exports_KV, eapi_exports_merge_type, \
- eapi_exports_replace_vars, \
+ eapi_exports_replace_vars, eapi_has_required_use, \
eapi_has_src_prepare_and_src_configure, eapi_has_pkg_pretend
from portage.elog import elog_process
from portage.elog.messages import eerror, eqawarn
@@ -1056,6 +1057,28 @@ def _validate_deps(mysettings, myroot, mydo, mydbapi):
if mydo not in invalid_dep_exempt_phases:
return 1
+ if not pkg.built and pkg.metadata["REQUIRED_USE"] and \
+ eapi_has_required_use(pkg.metadata["EAPI"]):
+ result = check_required_use(pkg.metadata["REQUIRED_USE"],
+ pkg.use.enabled, pkg.iuse.is_valid_flag)
+ if not result:
+ reduced_noise = result.tounicode()
+ writemsg("\n %s\n" % _("The following REQUIRED_USE flag" + \
+ " constraints are unsatisfied:"), noiselevel=-1)
+ writemsg(" %s\n" % reduced_noise,
+ noiselevel=-1)
+ normalized_required_use = \
+ " ".join(pkg.metadata["REQUIRED_USE"].split())
+ if reduced_noise != normalized_required_use:
+ writemsg("\n %s\n" % _("The above constraints " + \
+ "are a subset of the following complete expression:"),
+ noiselevel=-1)
+ writemsg(" %s\n" % \
+ human_readable_required_use(normalized_required_use),
+ noiselevel=-1)
+ writemsg("\n", noiselevel=-1)
+ return 1
+
return os.EX_OK
# XXX This would be to replace getstatusoutput completely.