[augeas-devel] Re: [PATCH] Rewrite dput.aug using inifile.aug

David Lutterkort dlutter at redhat.com
Fri Jul 25 19:01:57 UTC 2008


On Fri, 2008-07-25 at 13:54 +0200, Raphael Pinson wrote:
> # HG changeset patch
> # User Raphael Pinson <raphink at gmail.com>
> # Date 1216986841 -7200
> # Node ID f1ade288e3ea62d5799229c2a8610f6e1b4e86b2
> # Parent  f575bc6e9cbb2a04037800d5a75a75bf84a62ed6
> Rewrite dput.aug using inifile.aug
> Add a few keywords from man dput.cf
> Fix test file after rewrite

I get a test failure after applying this patch:

        galia:[7071] augeas>./src/augparse -I lenses/ lenses/tests/test_dput.aug 
        Test run encountered exception:
        lenses/tests/test_dput.aug:59.8-.25:exception: Get did not match entire input
            Error encountered here (1202 characters into string)
            <nd = /path/to/some/script\n#\n|=|>                           
        
            Tree generated so far:
            ... snipped ...
        

> diff -r f575bc6e9cbb -r f1ade288e3ea lenses/dput.aug
> --- a/lenses/dput.aug	Fri Jul 25 13:46:13 2008 +0200
> +++ b/lenses/dput.aug	Fri Jul 25 13:54:01 2008 +0200
> @@ -1,60 +1,33 @@
>  (* Dput module for Augeas                     *)
>  (* Author: Raphael Pinson <raphink at gmail.com> *)
>  (*                                            *)
> -(* Status: most settings supported            *)
>  
> 
>  module Dput =
>    autoload xfm
>  
> +    let setting = IniFile.entry "allow_non-us_software"
> +                | IniFile.entry "allow_unsigned_uploads"
> +                | IniFile.entry "check_version"
> +                | IniFile.entry "default_host_main"
> +                | IniFile.entry "default_host_non-us"

Performance-wise, the lens would be much faster if you wrote this as

     let setting_re = "allow_non-us_software"
                | "allow_unsigned_uploads"
                | "check_version"
                | "default_host_main"
                | "default_host_non-us"
                | ...

        let setting = IniFile.entry setting_re
        
        
It leads to much more compact data structurs internally.

David





More information about the augeas-devel mailing list