1 |
commit: 7af8dcf3997cfaf1def14dbfb090242a0751f6a9 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Feb 4 17:17:46 2011 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Feb 4 17:17:46 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7af8dcf3 |
7 |
|
8 |
ebuild(1): ensure REQUIRED_USE is satisfied |
9 |
|
10 |
--- |
11 |
pym/portage/package/ebuild/doebuild.py | 27 +++++++++++++++++++++++++-- |
12 |
1 files changed, 25 insertions(+), 2 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
15 |
index bbc3a4a..2eb9f11 100644 |
16 |
--- a/pym/portage/package/ebuild/doebuild.py |
17 |
+++ b/pym/portage/package/ebuild/doebuild.py |
18 |
@@ -39,9 +39,10 @@ from portage.data import portage_gid, portage_uid, secpass, \ |
19 |
uid, userpriv_groups |
20 |
from portage.dbapi.porttree import _parse_uri_map |
21 |
from portage.dbapi.virtual import fakedbapi |
22 |
-from portage.dep import Atom, paren_enclose, use_reduce |
23 |
+from portage.dep import Atom, check_required_use, \ |
24 |
+ human_readable_required_use, paren_enclose, use_reduce |
25 |
from portage.eapi import eapi_exports_KV, eapi_exports_merge_type, \ |
26 |
- eapi_exports_replace_vars, \ |
27 |
+ eapi_exports_replace_vars, eapi_has_required_use, \ |
28 |
eapi_has_src_prepare_and_src_configure, eapi_has_pkg_pretend |
29 |
from portage.elog import elog_process |
30 |
from portage.elog.messages import eerror, eqawarn |
31 |
@@ -1056,6 +1057,28 @@ def _validate_deps(mysettings, myroot, mydo, mydbapi): |
32 |
if mydo not in invalid_dep_exempt_phases: |
33 |
return 1 |
34 |
|
35 |
+ if not pkg.built and pkg.metadata["REQUIRED_USE"] and \ |
36 |
+ eapi_has_required_use(pkg.metadata["EAPI"]): |
37 |
+ result = check_required_use(pkg.metadata["REQUIRED_USE"], |
38 |
+ pkg.use.enabled, pkg.iuse.is_valid_flag) |
39 |
+ if not result: |
40 |
+ reduced_noise = result.tounicode() |
41 |
+ writemsg("\n %s\n" % _("The following REQUIRED_USE flag" + \ |
42 |
+ " constraints are unsatisfied:"), noiselevel=-1) |
43 |
+ writemsg(" %s\n" % reduced_noise, |
44 |
+ noiselevel=-1) |
45 |
+ normalized_required_use = \ |
46 |
+ " ".join(pkg.metadata["REQUIRED_USE"].split()) |
47 |
+ if reduced_noise != normalized_required_use: |
48 |
+ writemsg("\n %s\n" % _("The above constraints " + \ |
49 |
+ "are a subset of the following complete expression:"), |
50 |
+ noiselevel=-1) |
51 |
+ writemsg(" %s\n" % \ |
52 |
+ human_readable_required_use(normalized_required_use), |
53 |
+ noiselevel=-1) |
54 |
+ writemsg("\n", noiselevel=-1) |
55 |
+ return 1 |
56 |
+ |
57 |
return os.EX_OK |
58 |
|
59 |
# XXX This would be to replace getstatusoutput completely. |