[augeas-devel] Creating a custom lense

Dean Wilson dean.wilson at gmail.com
Wed Apr 23 21:33:01 UTC 2008


On 23/04/2008, David Lutterkort <dlutter at redhat.com> wrote:

> The invocation should be
>         augparse -I SOME_DIR tests/test_aptsource.aug
>  where SOME_DIR contains your aptsources.aug.tests/test_aptsource.aug

Ah, when I was running it as augparse aptsource.aug
tests/test_aptsource.aug I was getting syntax errors but not the ones
your invocation command displays.

I'll go through the other points, thank you.


>       * The regexps used some constructs that are not supported; in
>         particular, you can't use '^' to anchor to the beginning of the
>         line (it's never needed in lenses, anyway, since they need to
>         match the entire string) and you can't use '\s' as an
>         abbreviation for '[ \t]' - for better or worse, the regexps use
>         extended POSIX syntax (if you want to see them in all their
>         glory, have a look at regex(7))

Ahah, noted.

>       * The definition of sep_ws was enclosed in '[ .. ]' which created
>         a bunch of spurious nodes with NULL labels (the reason I use
>         that construct for toplevel comments in hosts.aug and similar is
>         a little subtle, and has to do with how comments are preserved
>         when entries are deleted; it's probably the most arcane aspect
>         of writing lenses. I need to describe that better ;)

OK, I'll be careful when I do that next time. Must not cargo cult.

>  The way you fixed it is the right one: just have one lens 'comment' that
>  matches actual comments and blank lines.

For the archive, this doesn't preserve blank lines though so you end
up with a much shorter config file in some cases.


> With that, I am going for most arcane error message, ever.

I've probably written worse - the difference is I assumed they were clear ;)

> I attach your files with changes that at least make the tests with
>  augparse pass; I'll have a look at the 'short split' issue after lunch.

It's fine and fixed, the results are being written out correctly now
I've added your corrections.

One that does stick out to me - why the {} {} {} in the
test_aptsources.aug file?

  Dean
-- 
Dean Wilson               http://www.unixdaemon.net
Profanity is the one language all programmers understand
--- Anon




More information about the augeas-devel mailing list