1 |
Author: zmedico |
2 |
Date: 2008-06-29 08:50:36 +0000 (Sun, 29 Jun 2008) |
3 |
New Revision: 10847 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/__init__.py |
7 |
Log: |
8 |
Split out a _check_build_log() function from spawnebuild(). |
9 |
|
10 |
|
11 |
Modified: main/trunk/pym/portage/__init__.py |
12 |
=================================================================== |
13 |
--- main/trunk/pym/portage/__init__.py 2008-06-29 08:23:17 UTC (rev 10846) |
14 |
+++ main/trunk/pym/portage/__init__.py 2008-06-29 08:50:36 UTC (rev 10847) |
15 |
@@ -4198,74 +4198,8 @@ |
16 |
|
17 |
if phase_retval == os.EX_OK: |
18 |
if mydo == "install" and logfile: |
19 |
- try: |
20 |
- f = open(logfile, 'rb') |
21 |
- except EnvironmentError: |
22 |
- pass |
23 |
- else: |
24 |
- am_maintainer_mode = [] |
25 |
+ _check_build_log(mysettings) |
26 |
|
27 |
- bash_command_not_found = [] |
28 |
- bash_command_not_found_re = re.compile( |
29 |
- r'(.*): line (\d*): (.*): command not found$') |
30 |
- |
31 |
- configure_opts_warn = [] |
32 |
- configure_opts_warn_re = re.compile( |
33 |
- r'^configure: WARNING: Unrecognized options: .*') |
34 |
- am_maintainer_mode_re = re.compile(r'.*/missing --run .*') |
35 |
- am_maintainer_mode_exclude_re = \ |
36 |
- re.compile(r'.*/missing --run (autoheader|makeinfo)') |
37 |
- try: |
38 |
- for line in f: |
39 |
- if am_maintainer_mode_re.search(line) is not None and \ |
40 |
- am_maintainer_mode_exclude_re.search(line) is None: |
41 |
- am_maintainer_mode.append(line.rstrip("\n")) |
42 |
- |
43 |
- if bash_command_not_found_re.match(line) is not None: |
44 |
- bash_command_not_found.append(line.rstrip("\n")) |
45 |
- |
46 |
- if configure_opts_warn_re.match(line) is not None: |
47 |
- configure_opts_warn.append(line.rstrip("\n")) |
48 |
- finally: |
49 |
- f.close() |
50 |
- |
51 |
- from portage.elog.messages import eqawarn |
52 |
- def _eqawarn(lines): |
53 |
- for line in lines: |
54 |
- eqawarn(line, phase=mydo, key=mysettings.mycpv) |
55 |
- from textwrap import wrap |
56 |
- wrap_width = 70 |
57 |
- |
58 |
- if am_maintainer_mode: |
59 |
- msg = ["QA Notice: Automake \"maintainer mode\" detected:"] |
60 |
- msg.append("") |
61 |
- msg.extend("\t" + line for line in am_maintainer_mode) |
62 |
- msg.append("") |
63 |
- msg.extend(wrap( |
64 |
- "If you patch Makefile.am, " + \ |
65 |
- "configure.in, or configure.ac then you " + \ |
66 |
- "should use autotools.eclass and " + \ |
67 |
- "eautomake or eautoreconf. Exceptions " + \ |
68 |
- "are limited to system packages " + \ |
69 |
- "for which it is impossible to run " + \ |
70 |
- "autotools during stage building. " + \ |
71 |
- "See http://www.gentoo.org/p" + \ |
72 |
- "roj/en/qa/autofailure.xml for more information.", |
73 |
- wrap_width)) |
74 |
- _eqawarn(msg) |
75 |
- |
76 |
- if bash_command_not_found: |
77 |
- msg = ["QA Notice: command not found:"] |
78 |
- msg.append("") |
79 |
- msg.extend("\t" + line for line in bash_command_not_found) |
80 |
- _eqawarn(msg) |
81 |
- |
82 |
- if configure_opts_warn: |
83 |
- msg = ["QA Notice: Unrecognized configure options:"] |
84 |
- msg.append("") |
85 |
- msg.extend("\t" + line for line in configure_opts_warn) |
86 |
- _eqawarn(msg) |
87 |
- |
88 |
if mydo == "install": |
89 |
_post_src_install_uid_fix(mysettings) |
90 |
qa_retval = _spawn_misc_sh(mysettings, ["install_qa_check", |
91 |
@@ -4276,6 +4210,83 @@ |
92 |
return qa_retval |
93 |
return phase_retval |
94 |
|
95 |
+def _check_build_log(mysettings): |
96 |
+ """ |
97 |
+ Search the content of $PORTAGE_LOG_FILE if it exists |
98 |
+ and generate the following QA Notices when appropriate: |
99 |
+ |
100 |
+ * Automake "maintainer mode" |
101 |
+ * command not found |
102 |
+ * Unrecognized configure options |
103 |
+ """ |
104 |
+ logfile = mysettings.get("PORTAGE_LOG_FILE", None) |
105 |
+ try: |
106 |
+ f = open(logfile, 'rb') |
107 |
+ except EnvironmentError: |
108 |
+ return |
109 |
+ |
110 |
+ am_maintainer_mode = [] |
111 |
+ bash_command_not_found = [] |
112 |
+ bash_command_not_found_re = re.compile( |
113 |
+ r'(.*): line (\d*): (.*): command not found$') |
114 |
+ |
115 |
+ configure_opts_warn = [] |
116 |
+ configure_opts_warn_re = re.compile( |
117 |
+ r'^configure: WARNING: Unrecognized options: .*') |
118 |
+ am_maintainer_mode_re = re.compile(r'.*/missing --run .*') |
119 |
+ am_maintainer_mode_exclude_re = \ |
120 |
+ re.compile(r'.*/missing --run (autoheader|makeinfo)') |
121 |
+ try: |
122 |
+ for line in f: |
123 |
+ if am_maintainer_mode_re.search(line) is not None and \ |
124 |
+ am_maintainer_mode_exclude_re.search(line) is None: |
125 |
+ am_maintainer_mode.append(line.rstrip("\n")) |
126 |
+ |
127 |
+ if bash_command_not_found_re.match(line) is not None: |
128 |
+ bash_command_not_found.append(line.rstrip("\n")) |
129 |
+ |
130 |
+ if configure_opts_warn_re.match(line) is not None: |
131 |
+ configure_opts_warn.append(line.rstrip("\n")) |
132 |
+ finally: |
133 |
+ f.close() |
134 |
+ |
135 |
+ from portage.elog.messages import eqawarn |
136 |
+ def _eqawarn(lines): |
137 |
+ for line in lines: |
138 |
+ eqawarn(line, phase="install", key=mysettings.mycpv) |
139 |
+ from textwrap import wrap |
140 |
+ wrap_width = 70 |
141 |
+ |
142 |
+ if am_maintainer_mode: |
143 |
+ msg = ["QA Notice: Automake \"maintainer mode\" detected:"] |
144 |
+ msg.append("") |
145 |
+ msg.extend("\t" + line for line in am_maintainer_mode) |
146 |
+ msg.append("") |
147 |
+ msg.extend(wrap( |
148 |
+ "If you patch Makefile.am, " + \ |
149 |
+ "configure.in, or configure.ac then you " + \ |
150 |
+ "should use autotools.eclass and " + \ |
151 |
+ "eautomake or eautoreconf. Exceptions " + \ |
152 |
+ "are limited to system packages " + \ |
153 |
+ "for which it is impossible to run " + \ |
154 |
+ "autotools during stage building. " + \ |
155 |
+ "See http://www.gentoo.org/p" + \ |
156 |
+ "roj/en/qa/autofailure.xml for more information.", |
157 |
+ wrap_width)) |
158 |
+ _eqawarn(msg) |
159 |
+ |
160 |
+ if bash_command_not_found: |
161 |
+ msg = ["QA Notice: command not found:"] |
162 |
+ msg.append("") |
163 |
+ msg.extend("\t" + line for line in bash_command_not_found) |
164 |
+ _eqawarn(msg) |
165 |
+ |
166 |
+ if configure_opts_warn: |
167 |
+ msg = ["QA Notice: Unrecognized configure options:"] |
168 |
+ msg.append("") |
169 |
+ msg.extend("\t" + line for line in configure_opts_warn) |
170 |
+ _eqawarn(msg) |
171 |
+ |
172 |
def _post_src_install_uid_fix(mysettings): |
173 |
""" |
174 |
Files in $D with user and group bits that match the "portage" |
175 |
|
176 |
-- |
177 |
gentoo-commits@l.g.o mailing list |