[augeas-devel] First tests with aug mv

Nicolas Valcarcel nvalcarcel at ubuntu.com
Tue Jul 29 12:03:15 UTC 2008


WoW, those are awesome news! I really love that feature, did we have
also a cp feature or should we work on it? Given that the mv is already
done i don't think a cp will we hard to deploy. 
        
Thank you David! That's why we love you!!

On Tue, 2008-07-29 at 13:04 +0200, =?ISO-8859-1?Q? Rapha=EBl_Pinson _
wrote:
> Hi there,
> 
> David implemented the "mv" function yesterday so I'm playing a bit
> with it today. 
> 
> 
> ============================================================
> module CommentTest =
> 
>    autoload xfm
> 
>    let c_key (kw:string) = Util.del_str kw . label ("." . kw)
> 
>    let entry   = [ key "field" . Util.del_str "=" . store /.*/ .
> Util.del_str "\n" ]
>    let c_entry = [ Util.del_str "#" . c_key "field" . Util.del_str
> "=" . store /.*/ . Util.del_str "\n" ]
> 
>    let lns = (entry | c_entry)*
> 
> 
>    let filter = (incl "/commenttest")
> 
>    let xfm = transform lns filter
> ============================================================
> 
> $ cat fakeroot/commenttest
> field=toto
> field=titi
> 
> $ augtool -I . -r fakeroot/
> augtool> print /files/commenttest/
> /files/commenttest
> /files/commenttest/field[1] = "toto"
> /files/commenttest/field[2] = "titi"
> augtool> mv /files/commenttest/field[1] /files/commenttest/.field
> augtool> save
> augeas.c:908 Fixme: Multiple transforms for /files
> augeas.c:908 Fixme: Multiple transforms for /files
> Saving failed
> augtool> quit
> 
>  $ cat fakeroot/commenttest
> field=titi
> #field=toto
> 
> ============================================================
> 
> 
> There's a few things to note here:
> * mv works ! Thank you David :)
> * save works but is not happy :(
> * "field=toto" got moved from 1st place to 2nd placed when it got
> commented. This is a side effect to this (un)commenting method I
> hadn't considered.
> * dealing with key in the lens is quite tricky. While it's possible to
> declare a c_key function, it will only take a string, since the
> contents of Util.del_str kw cannot be assigned to label currently. The
> following will NOT work:
> 
> ============================================================
> let entry_gen (kw:string) = [ key kw . Util.del_str "=" . store /.*/ .
> Util.del_str "\n" ]
> let c_entry_gen (kw:string) = [ Util.del_str "#" . c_key kw .
> Util.del_str "=" . store /.*/ . Util.del_str "\n" ]
> 
> let field = "field1"
>             | "field2"
> 
> let entry = entry_gen field
> let c_entry = c_entry_gen field
> ============================================================
> 
> The reason why it doesn't work is quite obvious: field is not a
> string, but a regexp. For it to work, entry_gen and c_entry_gen would
> have to take regexps instead of strings, but then c_key would have to
> take a regexp, too, which is not possible.
> 
> 
> 
> Just a few thoughts...
> 
> 
> 
> Raphaël
> 
> _______________________________________________
> augeas-devel mailing list
> augeas-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/augeas-devel
-- 
aka nxvl
Key fingerprint = BCE4 27A0 D03E 55DE DA2D  BE06 891D 8DEE 6545 97FE
gpg --keyserver keyserver.ubuntu.com --recv-keys 654597FE

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080729/6f818af4/attachment.sig>


More information about the augeas-devel mailing list