repoman: unroll escaped lines so we can check the entirety of it
Sometimes people wrap long lines in their ebuilds to make it easier to
read, but this causes us issues when doing line-by-line checking. So
automatically unroll those lines before passing the full content down
to our checkers.
This seems to work, but maybe someone can suggest something simpler.
for lc in checks:
lc.new(pkg)
for num, line in enumerate(contents):
+ # Unroll multiline escaped strings so that we can check things:
+ # inherit foo bar
+ # moo
+ # cow
+ # This will merge these lines like so:
+ # inherit foo bar moo cow
+ try:
+ # A normal line will end in the two bytes: <> <
>. So decoding
+ # that will result in python thinking the <
> is being escaped
+ # and eat the single <> which makes it hard for us to detect.
+ # Instead, strip the newline (which we know all lines have), and
+ # append a <0>. Then when python escapes it, if the line ended
+ # in a <>, we'll end up with a <