1 |
Author: grobian |
2 |
Date: 2009-05-02 09:18:01 +0000 (Sat, 02 May 2009) |
3 |
New Revision: 13591 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/man/ebuild.5 |
7 |
main/branches/prefix/pym/_emerge/__init__.py |
8 |
main/branches/prefix/pym/portage/__init__.py |
9 |
main/branches/prefix/pym/portage/output.py |
10 |
main/branches/prefix/pym/repoman/checks.py |
11 |
Log: |
12 |
Merged from trunk -r13405:13414 |
13 |
|
14 |
| 13406 | Bug #267104 - If the statvfs f_bavail field shows | |
15 |
| zmedico | insufficient free space and userfetch is not enabled, | |
16 |
| | recalculate using the f_bfree field. | |
17 |
|
18 |
| 13407 | Bug #267810 - Don't sort C/CXX/LDFLAGS in emerge --info | |
19 |
| zmedico | output since these variables aren't really sortable in that | |
20 |
| | way. | |
21 |
|
22 |
| 13408 | Fix the code from bug #267104 to account non-root users. | |
23 |
| zmedico | | |
24 |
|
25 |
| 13409 | Bug #267860 - Make JobStatusDisplay respect | |
26 |
| zmedico | FEATURES=notitles. | |
27 |
|
28 |
| 13410 | Make xtermTitle() use a global variable to cache the result | |
29 |
| zmedico | of the TERM check. | |
30 |
|
31 |
| 13411 | Make EbuildWhitespace ignore here-documents. Thanks to Diego | |
32 |
| zmedico | Petten?\195?\178 <flameeyes@g.o> for reporting. | |
33 |
|
34 |
| 13412 | Move the here-document code from the EbuildWhitespace check | |
35 |
| zmedico | to the run_checks() function, so that all checks ignore the | |
36 |
| | content of here-documents. | |
37 |
|
38 |
| 13413 | Warn about sed and epatch calls which should be moved from | |
39 |
| zmedico | src_unpack to src_prepare. Thanks to Markus Meier | |
40 |
| | <maekke@g.o> for the initial patch. | |
41 |
|
42 |
| 13414 | Clarify RESTRICT=bindist docs by referring to 'built' | |
43 |
| zmedico | packages. Thanks to Thomas Sachau <tommy@g.o> for reporting. | |
44 |
|
45 |
|
46 |
Modified: main/branches/prefix/man/ebuild.5 |
47 |
=================================================================== |
48 |
--- main/branches/prefix/man/ebuild.5 2009-05-02 09:16:10 UTC (rev 13590) |
49 |
+++ main/branches/prefix/man/ebuild.5 2009-05-02 09:18:01 UTC (rev 13591) |
50 |
@@ -424,7 +424,7 @@ |
51 |
see the \fBQA CONTROL VARIABLES\fR section for more specific exemptions. |
52 |
.TP |
53 |
.I bindist |
54 |
-Distribution of binary packages is restricted. |
55 |
+Distribution of built packages is restricted. |
56 |
.TP |
57 |
.I fetch |
58 |
like \fImirror\fR but the files will not be fetched via \fBSRC_URI\fR either. |
59 |
|
60 |
Modified: main/branches/prefix/pym/_emerge/__init__.py |
61 |
=================================================================== |
62 |
--- main/branches/prefix/pym/_emerge/__init__.py 2009-05-02 09:16:10 UTC (rev 13590) |
63 |
+++ main/branches/prefix/pym/_emerge/__init__.py 2009-05-02 09:18:01 UTC (rev 13591) |
64 |
@@ -9890,9 +9890,10 @@ |
65 |
'newline' : 'nel', |
66 |
} |
67 |
|
68 |
- def __init__(self, out=sys.stdout, quiet=False): |
69 |
+ def __init__(self, out=sys.stdout, quiet=False, xterm_titles=True): |
70 |
object.__setattr__(self, "out", out) |
71 |
object.__setattr__(self, "quiet", quiet) |
72 |
+ object.__setattr__(self, "xterm_titles", xterm_titles) |
73 |
object.__setattr__(self, "maxval", 0) |
74 |
object.__setattr__(self, "merges", 0) |
75 |
object.__setattr__(self, "_changed", False) |
76 |
@@ -10112,7 +10113,8 @@ |
77 |
else: |
78 |
self._update(color_output.getvalue()) |
79 |
|
80 |
- xtermTitle(" ".join(plain_output.split())) |
81 |
+ if self.xterm_titles: |
82 |
+ xtermTitle(" ".join(plain_output.split())) |
83 |
|
84 |
class ProgressHandler(object): |
85 |
def __init__(self): |
86 |
@@ -10256,7 +10258,8 @@ |
87 |
# being in a fragile state. For example, see bug #259954. |
88 |
self._unsatisfied_system_deps = set() |
89 |
|
90 |
- self._status_display = JobStatusDisplay() |
91 |
+ self._status_display = JobStatusDisplay( |
92 |
+ xterm_titles=('notitles' not in settings.features)) |
93 |
self._max_load = myopts.get("--load-average") |
94 |
max_jobs = myopts.get("--jobs") |
95 |
if max_jobs is None: |
96 |
@@ -13927,9 +13930,6 @@ |
97 |
global_vals = {} |
98 |
pkgsettings = portage.config(clone=settings) |
99 |
|
100 |
- for myvar in mydesiredvars: |
101 |
- global_vals[myvar] = set(settings.get(myvar, "").split()) |
102 |
- |
103 |
# Loop through each package |
104 |
# Only print settings if they differ from global settings |
105 |
header_title = "Package Settings" |
106 |
@@ -13945,18 +13945,7 @@ |
107 |
installed=True, metadata=izip(Package.metadata_keys, |
108 |
(metadata.get(x, '') for x in Package.metadata_keys)), |
109 |
root_config=root_config, type_name='installed') |
110 |
- valuesmap = {} |
111 |
- for k in auxkeys: |
112 |
- valuesmap[k] = set(metadata[k].split()) |
113 |
|
114 |
- diff_values = {} |
115 |
- for myvar in mydesiredvars: |
116 |
- # If the package variable doesn't match the |
117 |
- # current global variable, something has changed |
118 |
- # so set diff_found so we know to print |
119 |
- if valuesmap[myvar] != global_vals[myvar]: |
120 |
- diff_values[myvar] = valuesmap[myvar] |
121 |
- |
122 |
print "\n%s was built with the following:" % \ |
123 |
colorize("INFORM", str(pkg.cpv)) |
124 |
|
125 |
@@ -14011,15 +14000,9 @@ |
126 |
print '%s="%s"' % (varname, ' '.join(str(f) for f in flags)), |
127 |
print |
128 |
|
129 |
- # If a difference was found, print the info for |
130 |
- # this package. |
131 |
- if diff_values: |
132 |
- # Print package info |
133 |
- for myvar in mydesiredvars: |
134 |
- if myvar in diff_values: |
135 |
- mylist = list(diff_values[myvar]) |
136 |
- mylist.sort() |
137 |
- print "%s=\"%s\"" % (myvar, " ".join(mylist)) |
138 |
+ for myvar in mydesiredvars: |
139 |
+ if metadata[myvar].split() != settings.get(myvar, '').split(): |
140 |
+ print "%s=\"%s\"" % (myvar, metadata[myvar]) |
141 |
print |
142 |
|
143 |
if metadata['DEFINED_PHASES']: |
144 |
|
145 |
Modified: main/branches/prefix/pym/portage/__init__.py |
146 |
=================================================================== |
147 |
--- main/branches/prefix/pym/portage/__init__.py 2009-05-02 09:16:10 UTC (rev 13590) |
148 |
+++ main/branches/prefix/pym/portage/__init__.py 2009-05-02 09:18:01 UTC (rev 13591) |
149 |
@@ -3969,9 +3969,18 @@ |
150 |
mysize = 0 |
151 |
if (size - mysize + vfs_stat.f_bsize) >= \ |
152 |
(vfs_stat.f_bsize * vfs_stat.f_bavail): |
153 |
- writemsg("!!! Insufficient space to store %s in %s\n" % (myfile, mysettings["DISTDIR"]), noiselevel=-1) |
154 |
- has_space = False |
155 |
+ if secpass < 2: |
156 |
+ has_space = False |
157 |
+ elif userfetch: |
158 |
+ has_space = False |
159 |
+ elif (size - mysize + vfs_stat.f_bfree) >= \ |
160 |
+ (vfs_stat.f_bfree * vfs_stat.f_bavail): |
161 |
+ has_space = False |
162 |
|
163 |
+ if not has_space: |
164 |
+ writemsg("!!! Insufficient space to store %s in %s\n" % \ |
165 |
+ (myfile, mysettings["DISTDIR"]), noiselevel=-1) |
166 |
+ |
167 |
if distdir_writable and use_locks: |
168 |
|
169 |
if locks_in_subdir: |
170 |
|
171 |
Modified: main/branches/prefix/pym/portage/output.py |
172 |
=================================================================== |
173 |
--- main/branches/prefix/pym/portage/output.py 2009-05-02 09:16:10 UTC (rev 13590) |
174 |
+++ main/branches/prefix/pym/portage/output.py 2009-05-02 09:18:01 UTC (rev 13591) |
175 |
@@ -247,22 +247,26 @@ |
176 |
tmp = re.sub(esc_seq + "^m]+m", "", mystr); |
177 |
return len(tmp) |
178 |
|
179 |
+_legal_terms_re = re.compile(r'^(xterm|xterm-color|Eterm|aterm|rxvt|screen|kterm|rxvt-unicode|gnome|interix)') |
180 |
+_disable_xtermTitle = None |
181 |
+_max_xtermTitle_len = 253 |
182 |
+ |
183 |
def xtermTitle(mystr, raw=False): |
184 |
- if dotitles and "TERM" in os.environ and sys.stderr.isatty(): |
185 |
+ global _disable_xtermTitle |
186 |
+ if _disable_xtermTitle is None: |
187 |
+ _disable_xtermTitle = not (sys.stderr.isatty() and \ |
188 |
+ 'TERM' in os.environ and \ |
189 |
+ _legal_terms_re.match(os.environ['TERM']) is not None) |
190 |
+ |
191 |
+ if dotitles and not _disable_xtermTitle: |
192 |
# If the title string is too big then the terminal can |
193 |
# misbehave. Therefore, truncate it if it's too big. |
194 |
- max_len = 253 |
195 |
- if len(mystr) > max_len: |
196 |
- mystr = mystr[:max_len] |
197 |
- myt=os.environ["TERM"] |
198 |
- legal_terms = ["xterm","xterm-color","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode","gnome","interix"] |
199 |
- for term in legal_terms: |
200 |
- if myt.startswith(term): |
201 |
- if not raw: |
202 |
- mystr = "\x1b]0;%s\x07" % mystr |
203 |
- sys.stderr.write(mystr) |
204 |
- sys.stderr.flush() |
205 |
- break |
206 |
+ if len(mystr) > _max_xtermTitle_len: |
207 |
+ mystr = mystr[:_max_xtermTitle_len] |
208 |
+ if not raw: |
209 |
+ mystr = '\x1b]0;%s\x07' % mystr |
210 |
+ sys.stderr.write(mystr) |
211 |
+ sys.stderr.flush() |
212 |
|
213 |
default_xterm_title = None |
214 |
|
215 |
|
216 |
Modified: main/branches/prefix/pym/repoman/checks.py |
217 |
=================================================================== |
218 |
--- main/branches/prefix/pym/repoman/checks.py 2009-05-02 09:16:10 UTC (rev 13590) |
219 |
+++ main/branches/prefix/pym/repoman/checks.py 2009-05-02 09:18:01 UTC (rev 13591) |
220 |
@@ -73,12 +73,11 @@ |
221 |
trailing_whitespace = re.compile(r'.*([\S]$)') |
222 |
|
223 |
def check(self, num, line): |
224 |
- if not self.leading_spaces.match(line): |
225 |
+ if self.leading_spaces.match(line) is None: |
226 |
return errors.LEADING_SPACES_ERROR |
227 |
- if not self.trailing_whitespace.match(line): |
228 |
+ if self.trailing_whitespace.match(line) is None: |
229 |
return errors.TRAILING_WHITESPACE_ERROR |
230 |
|
231 |
- |
232 |
class EbuildQuote(LineCheck): |
233 |
"""Ensure ebuilds have valid quoting around things like D,FILESDIR, etc...""" |
234 |
|
235 |
@@ -230,6 +229,38 @@ |
236 |
elif self.inherit_re.match(line) is not None: |
237 |
self.inherit_line = line |
238 |
|
239 |
+class SrcUnpackPatches(LineCheck): |
240 |
+ repoman_check_name = 'ebuild.minorsyn' |
241 |
+ |
242 |
+ src_unpack_re = re.compile(r'^src_unpack\(\)') |
243 |
+ func_end_re = re.compile(r'^\}$') |
244 |
+ src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s') |
245 |
+ |
246 |
+ def new(self, pkg): |
247 |
+ if pkg.metadata['EAPI'] not in ('0', '1'): |
248 |
+ self.eapi = pkg.metadata['EAPI'] |
249 |
+ else: |
250 |
+ self.eapi = None |
251 |
+ self.in_src_unpack = None |
252 |
+ |
253 |
+ def check(self, num, line): |
254 |
+ |
255 |
+ if self.eapi is not None: |
256 |
+ |
257 |
+ if self.in_src_unpack is None and \ |
258 |
+ self.src_unpack_re.match(line) is not None: |
259 |
+ self.in_src_unpack = True |
260 |
+ |
261 |
+ if self.in_src_unpack is True and \ |
262 |
+ self.func_end_re.match(line) is not None: |
263 |
+ self.in_src_unpack = False |
264 |
+ |
265 |
+ if self.in_src_unpack: |
266 |
+ m = self.src_prepare_tools_re.search(line) |
267 |
+ if m is not None: |
268 |
+ return ("'%s'" % m.group(1)) + \ |
269 |
+ " call should be moved to src_prepare from line: %d" |
270 |
+ |
271 |
class EbuildPatches(LineCheck): |
272 |
"""Ensure ebuilds use bash arrays for PATCHES to ensure white space safety""" |
273 |
repoman_check_name = 'ebuild.patches' |
274 |
@@ -369,20 +400,36 @@ |
275 |
EbuildPatches, EbuildQuotedA, EapiDefinition, |
276 |
IUseUndefined, ImplicitRuntimeDeps, InheritAutotools, |
277 |
EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, |
278 |
- DeprecatedBindnowFlags, WantAutoDefaultValue))) |
279 |
+ DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue))) |
280 |
|
281 |
+_here_doc_re = re.compile(r'.*\s<<[-]?(\w+)$') |
282 |
+ |
283 |
def run_checks(contents, pkg): |
284 |
checks = _constant_checks |
285 |
+ here_doc_delim = None |
286 |
|
287 |
for lc in checks: |
288 |
lc.new(pkg) |
289 |
for num, line in enumerate(contents): |
290 |
- for lc in checks: |
291 |
- ignore = lc.ignore_line |
292 |
- if not ignore or not ignore.match(line): |
293 |
- e = lc.check(num, line) |
294 |
- if e: |
295 |
- yield lc.repoman_check_name, e % (num + 1) |
296 |
+ |
297 |
+ # Check if we're inside a here-document. |
298 |
+ if here_doc_delim is not None: |
299 |
+ if here_doc_delim.match(line): |
300 |
+ here_doc_delim = None |
301 |
+ if here_doc_delim is None: |
302 |
+ here_doc = _here_doc_re.match(line) |
303 |
+ if here_doc is not None: |
304 |
+ here_doc_delim = re.compile('^%s$' % here_doc.group(1)) |
305 |
+ |
306 |
+ if here_doc_delim is None: |
307 |
+ # We're not in a here-document. |
308 |
+ for lc in checks: |
309 |
+ ignore = lc.ignore_line |
310 |
+ if not ignore or not ignore.match(line): |
311 |
+ e = lc.check(num, line) |
312 |
+ if e: |
313 |
+ yield lc.repoman_check_name, e % (num + 1) |
314 |
+ |
315 |
for lc in checks: |
316 |
i = lc.end() |
317 |
if i is not None: |