Code review!

On Thu, Jun 09, 2011 at 12:16:30PM -0000, [email protected] wrote:
> Author: lslezak
> Date: Thu Jun  9 14:16:29 2011
> New Revision: 64276
> 
> URL: http://svn.opensuse.org/viewcvs/yast?rev=64276&view=rev
> Log:
> - correctly display download progress in DownloadInAdvance
>   libzypp mode (bnc#616708) (backported commits 62714,
>   partly 54940)
> 
> Added:
>     branches/tmp/lslezak/SP2/packager/agents/etc_zypp_conf.scr
> Modified:
>     branches/tmp/lslezak/SP2/packager/agents/Makefile.am
>     branches/tmp/lslezak/SP2/packager/package/yast2-packager.changes
>     branches/tmp/lslezak/SP2/packager/src/modules/PackageSlideShow.ycp
>     branches/tmp/lslezak/SP2/packager/src/modules/SlideShowCallbacks.ycp
> 
> Added: branches/tmp/lslezak/SP2/packager/agents/etc_zypp_conf.scr
> URL: 
> http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/SP2/packager/agents/etc_zypp_conf.scr?rev=64276&view=auto
> ==============================================================================
> --- branches/tmp/lslezak/SP2/packager/agents/etc_zypp_conf.scr (added)
> +++ branches/tmp/lslezak/SP2/packager/agents/etc_zypp_conf.scr Thu Jun  9 
> 14:16:29 2011
> @@ -0,0 +1,130 @@
> +/**
> + * File:
> + *   etc_zypp_conf.scr
> + * Summary:
> + *   SCR Agent for reading/writing /etc/zypp/zypp.conf file
> + *   using the ini-agent
> + * Access:
> + *   read/write
> + * Authors:
> + *   Ladislav Slezak <[email protected]>
> + * Example:
> + *
> + *   Read list of available files
> + *   SCR::Dir(.etc.zypp_conf)
> + *
> + *   Read list of sections in a file
> + *   
> SCR::Dir(.etc.policykit.section."/etc/PolicyKit/privilege.d/hal-power-hibernate.privilege")
> + *   (["Privilege"])
> + *
> + *   Read list of options in a section
> + *   
> SCR::Dir(.etc.policykit.value."/etc/PolicyKit/privilege.d/hal-power-hibernate.privilege"."Privilege")
> + *   (["RequiredPrivileges", "SufficientPrivileges", "Allow", "Deny", 
> "CanObtain", "CanGrant", "ObtainRequireRoot"])
> + *
> + *   Read an option
> + *   
> SCR::Read(.etc.policykit.value."/etc/PolicyKit/privilege.d/hal-power-hibernate.privilege"."Privilege"."RequiredPrivileges")
> + *   ("desktop-console")
> + *
> + *
> + *   Write an option
> + *   
> SCR::Write(.etc.policykit.value."/etc/PolicyKit/privilege.d/hal-power-hibernate.privilege"."Privilege"."RequiredPrivileges",
>  "")
> + *   (true)

The above example usage is irrelevant.

> + *
> + *
> + *   Flush the changes
> + *   SCR::Write(.etc.zypp_conf, nil)
> + *
> + *
> + *   Fore more information see the INI-agent documentation
> + *
> + * $Id$
> + */
> +
> +.etc.zypp_conf
> +
> +`ag_ini(
> +    `IniAgent( "/etc/zypp/zypp.conf" , $[
> +     "options" : [ "no_nested_sections", "line_can_continue", 
> "comments_last" ],
> +     "comments": [
> +         "^[ \t]*$",         // empty line
> +         "^[ \t]*#.*$",      // comment char
> +     ],
> +     "sections" : [
> +         $[
> +             "begin" : [ "^[ \t]*\\[[ \t]*(.*[^ \t])[ \t]*\\][ \t]*", "[%s]" 
> ],
> +         ]
> +     ],
> +     "params" : [
> +         $[
> +             "match" : [ "^[ \t]*([^=]*[^ \t=])[ \t]*=[ \t]*(.*[^ \t]|)[ 
> \t]*$" , "%s=%s"],
> +         ]
> +     ]
> +    ]
> +  )
> +)
> +

The file contents is duplicated.

> +/**
> + * File:
> + *   etc_zypp_conf.scr
[...]
> +             "match" : [ "^[ \t]*([^=]*[^ \t=])[ \t]*=[ \t]*(.*[^ \t]|)[ 
> \t]*$" , "%s=%s"],
> +         ]
> +     ]
> +    ]
> +  )
> +)
> +
-- 
Martin Vidner, YaST developer
http://en.opensuse.org/User:Mvidner

Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu

Attachment: pgpqyOdwS1Z4n.pgp
Description: PGP signature

Reply via email to