[augeas-devel] Avoiding wheel reinvention with dpkg.cfg, and setting empty things.
Robin Lee Powell
rlpowell at digitalkingdom.org
Wed Dec 31 00:19:08 UTC 2008
On Mon, Dec 29, 2008 at 09:54:13PM -0800, David Lutterkort wrote:
> > - ----------------
> >
> > (* Parsing /etc/dpkg/dpkg.cfg *)
> >
> > module Dpkg =
> > autoload xfm
> >
> > let sep_tab = Util.del_ws_tab
> > let sep_spc = Util.del_ws_spc
> > let eol = del /[ \t]*\n/ "\n"
> >
> > let comment = Util.comment
> > let empty = Util.empty
> >
> > let word = /[^,# \n\t]+/
> >
> > let bare_option = [ label "bare_option" . store word ]
> >
> > let valued_option = [ label "value_option" . store word ] . sep_spc .
> > [ label "value" . store word ]
> > let record = [ seq "option" . ( bare_option | valued_option ) . eol ]
>
> Why don't you use the name of the option as a key and store the value
> for that option as the value of the tree node ? Something along the
> lines of (untested):
>
> let record = [ key word . (sep_spc . store word)? . eol ]
>
> That would producea much more compact and readable tree.
Because I have no idea what I'm doing. :) I just grabbed the fstab
lens and flailed.
> One obvious improvement, assuming that dpkg.cfg uses a fixed set of
> option names,
FSVO "fixed"; I assume it changes from version to version.
> > I have no idea what the "seq" keyword actually *does*, for
> > example.
>
> Does http://www.augeas.net/docs/lenses.html not provide enough info ?
Ah. I misunderstood what that page was for. Yes, that helps.
> There's also some more docs on the Wiki, e.g.
> http://www.augeas.net/page/Creating_a_lens_step_by_step
I didn't see that one. I assumed that
http://www.augeas.net/docs/writing-schemas.html (with the big "TO BE
CONTINUED") was all I had to work with. Perhaps you should link
that wiki page from the documentation section?
-Robin
--
They say: "The first AIs will be built by the military as weapons."
And I'm thinking: "Does it even occur to you to try for something
other than the default outcome?" -- http://shorl.com/tydruhedufogre
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
More information about the augeas-devel
mailing list