Gentoo Archives: gentoo-portage-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [RFC/PATCH] repoman: unroll escaped lines so we can check the entirety of it
Date: Thu, 24 May 2012 18:12:22
Message-Id: 201205241233.09774.vapier@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [RFC/PATCH] repoman: unroll escaped lines so we can check the entirety of it by Zac Medico
1 On Thursday 24 May 2012 00:19:45 Zac Medico wrote:
2 > On 05/23/2012 09:06 PM, Mike Frysinger wrote:
3 > > Sometimes people wrap long lines in their ebuilds to make it easier to
4 > > read, but this causes us issues when doing line-by-line checking. So
5 > > automatically unroll those lines before passing the full content down
6 > > to our checkers.
7 > >
8 > > This seems to work, but maybe someone can suggest something simpler.
9 >
10 > This code should come right after the line that says "We're not in a
11 > here-document", because we only need it to trigger when we're not in a
12 > here-document.
13
14 i was thinking this would handle wrapped lines and heredocs together better,
15 but i'll ignore that until i can come up with a concrete case.
16
17 > I think it's going to be cleaner to detect an escaped newline with a
18 > regular expression, like r'(^|[^\\])\\$'.
19
20 the reason i didn't go the regex route is because this fails with:
21 echo foo \\\\\
22 cow
23 whereas letting python take care of all the escaping works much better
24 -mike

Attachments

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