Joe Peterson wrote:
The comment from Vlastimil about echo not being part of the elog system is a very valid point indeed. As for how to specify that a newline should be inserted, I think that using elog switches like "-n", "-p", etc., as well as putting more than one string on a line present two problems: the newline would be "connected" with the "elog" or "ewarn" (or whatever style of output was chosen)
In the ebuild it would look like connected but in fact portage could just note that there was a newline switch and output it in whatever style it wants.
and it would also potentially make the ebuild code harder to read/debug.
Well you can always insert a completely blank line in the ebuild after a "-n" message. That's easier to read than a "eseparator" line.
For example, if you have a block of "ewarn" lines, then a blank line, then a block of "elog" lines, you would have to decide in which style to place the special switch (so portage would not have the opportunity to do auto-context coloring/formatting).
Like I said above, it still has the oportunity to do whatever it wants.
I personally would prefer a new command like "eseparator" that could be treated "smartly" by portage, taking on the appropriate color based on what is before and after. It could also avoid multiple newlines in the case in which two eseparator lines occur together due to pattern of conditional blocks in the ebuild invoked under certain circumstances (I have found this hard to code in a way that covers all possibilities, as I mentioned before). Also, separators at the very beginning or very end of all lines output by the ebuild could be handled consistently (either ignored or collapsed into an implicit separator, as appropriate) by portage to produce nice output.
That should all be possible with the switches, unless I miss something.My idea is that a switch for "post-newline" is enough, and there's no need for "pre-newline". You use that switch whenever you end a logical block of elog lines. Portage just notes you used it, and when another elog comes, newline is emitted first. Multiple newlines should not even happen (and if yes, could be easily collapsed). Last newline of the ebuild is just consumed. Or perhaps use this processing only for the elog post-processing system (which I personally think matters more), and during the build itself emit the newlines immediatelly so that non-elog output is not tied too closely to ends of elog blocks.
-- Vlastimil Babka (Caster) Gentoo/Java
signature.asc
Description: OpenPGP digital signature
