Gentoo Archives: gentoo-dev

From: Vlastimil Babka <caster@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: Default blank lines for error, elog, einfo, etc
Date: Sat, 07 Jun 2008 00:22:49
Message-Id: 4849D4D1.6070007@gentoo.org
In Reply to: Re: [gentoo-dev] Re: Default blank lines for error, elog, einfo, etc by Joe Peterson
1 Joe Peterson wrote:
2 > The comment from Vlastimil about echo not being part of the elog system
3 > is a very valid point indeed. As for how to specify that a newline
4 > should be inserted, I think that using elog switches like "-n", "-p",
5 > etc., as well as putting more than one string on a line present two
6 > problems: the newline would be "connected" with the "elog" or "ewarn"
7 > (or whatever style of output was chosen)
8
9 In the ebuild it would look like connected but in fact portage could
10 just note that there was a newline switch and output it in whatever
11 style it wants.
12
13 > and it would also potentially
14 > make the ebuild code harder to read/debug.
15
16 Well you can always insert a completely blank line in the ebuild after a
17 "-n" message. That's easier to read than a "eseparator" line.
18
19 > For example, if you have a
20 > block of "ewarn" lines, then a blank line, then a block of "elog" lines,
21 > you would have to decide in which style to place the special switch (so
22 > portage would not have the opportunity to do auto-context
23 > coloring/formatting).
24
25 Like I said above, it still has the oportunity to do whatever it wants.
26
27 > I personally would prefer a new command like "eseparator" that could be
28 > treated "smartly" by portage, taking on the appropriate color based on
29 > what is before and after. It could also avoid multiple newlines in the
30 > case in which two eseparator lines occur together due to pattern of
31 > conditional blocks in the ebuild invoked under certain circumstances (I
32 > have found this hard to code in a way that covers all possibilities, as
33 > I mentioned before). Also, separators at the very beginning or very end
34 > of all lines output by the ebuild could be handled consistently (either
35 > ignored or collapsed into an implicit separator, as appropriate) by
36 > portage to produce nice output.
37
38 That should all be possible with the switches, unless I miss something.
39 My idea is that a switch for "post-newline" is enough, and there's no
40 need for "pre-newline". You use that switch whenever you end a logical
41 block of elog lines. Portage just notes you used it, and when another
42 elog comes, newline is emitted first. Multiple newlines should not even
43 happen (and if yes, could be easily collapsed). Last newline of the
44 ebuild is just consumed.
45 Or perhaps use this processing only for the elog post-processing system
46 (which I personally think matters more), and during the build itself
47 emit the newlines immediatelly so that non-elog output is not tied too
48 closely to ends of elog blocks.
49 --
50 Vlastimil Babka (Caster)
51 Gentoo/Java

Attachments

File name MIME type
signature.asc application/pgp-signature