[augeas-devel] Lens for new gentoo /etc/conf.d/net format

Doug Warner doug at warner.fm
Thu Jun 2 19:46:50 UTC 2011


On 06/01/2011 01:42 PM, Doug Warner wrote:
> I'm trying to get a lens that will work for gentoo's new /etc/conf.d/net file
> (http://www.gentoo.org/doc/en/openrc-migration.xml) that uses variables that
> /look/ like shellvars, but separates things by newlines.
> 
> It look like the Shellvars_list lens might be close, but it separates on any
> whitespace and not just newlines.  I'm not sure exactly how to modify it since
> it makes use of a recursive function.
> 
> Any tips on how to proceed?
> 
> -Doug

Here's what I've been working on so far; I'm getting stuck on this parse error
currently:


$ augparse -I . gentooconf_net.aug
Syntax error in lens definition
gentooconf_net.aug:27.2-.79:Failed to compile squote_arr
gentooconf_net.aug:23.6-.43:exception: ambiguous iteration
      Iterated regexp: /([ \t]*\n)([^'\n]+)/
      '\nA \nA' can be split into
      '\nA|=| \nA'

     and
      '\nA |=|\nA'

    Iterated lens: gentooconf_net.aug:23.6-.42:


I believe I want to completely absorb that space in there, but the problem I'm
running into is I don't know where the best place to do that is.  If I change
the "eol" in my iterated lens to "nl" (newline only, no whitespace) this error
goes away, but I get a parse error on the bigger picture:


$ augparse -I . gentooconf_net.aug
Syntax error in lens definition
gentooconf_net.aug:37.2-.80:Failed to compile kv
gentooconf_net.aug:37.13-.78:exception: ambiguous concatenation
      First regexp:
/([A-Za-z0-9_]+)(=)(((('))(((([^'\n]+))(((\n)([^'\n]+))*))?)('))|(((\"))(((([^\"\n]+))(((\n)([^\"\n]+))*))?)(\"))|((((([^\"'\n]+)+))?)))/
      Second regexp: /[ \t]*\n/
      'A= \n' can be split into
      'A=|=| \n'

     and
      'A= |=|\n'

    First lens: gentooconf_net.aug:37.13-.71:
    Second lens: /usr/share/augeas/lenses/dist/util.aug:54.12-.31:


This is obviously not what I want; I don't want a trailing space to be
considered a value at all.

-Doug
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gentooconf_net.aug
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110602/1aa12353/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_gentooconf_net.aug
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110602/1aa12353/attachment-0001.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110602/1aa12353/attachment.sig>


More information about the augeas-devel mailing list