Imported Upstream version 1.7.0
[platform/upstream/augeas.git] / lenses / yum.aug
1 (* Parsing yum's config files *)
2 module Yum =
3   autoload xfm
4
5 (************************************************************************
6  * INI File settings
7  *************************************************************************)
8
9 let comment  = IniFile.comment "#" "#"
10 let sep      = IniFile.sep "=" "="
11 let empty    = Util.empty
12 let eol      = IniFile.eol
13
14 (************************************************************************
15  *                        ENTRY
16  *************************************************************************)
17
18 let list_entry (list_key:string)  =
19   let list_value = store /[^# \t\r\n,][^ \t\r\n,]*[^# \t\r\n,]|[^# \t\r\n,]/ in
20   let list_sep = del /([ \t]*(,[ \t]*|\r?\n[ \t]+))|[ \t]+/ "\n\t" in
21   [ key list_key . sep . Sep.opt_space . list_value ]
22   . (list_sep . Build.opt_list [ label list_key . list_value ] list_sep)?
23   . eol
24
25 let entry_re = IniFile.entry_re - ("baseurl" | "gpgkey" | "exclude")
26
27 let entry       = IniFile.entry entry_re sep comment
28                 | empty
29
30 let entries =
31      let list_entry_elem (k:string) = list_entry k . entry*
32   in entry*
33    | entry* . Build.combine_three_opt
34                 (list_entry_elem "baseurl")
35                 (list_entry_elem "gpgkey")
36                 (list_entry_elem "exclude")
37
38
39 (***********************************************************************a
40  *                         TITLE
41  *************************************************************************)
42 let title       = IniFile.title IniFile.record_re
43 let record      = [ title . entries ]
44
45
46 (************************************************************************
47  *                         LENS & FILTER
48  *************************************************************************)
49 let lns    = (empty | comment)* . record*
50
51   let filter = (incl "/etc/yum.conf")
52       . (incl "/etc/yum.repos.d/*.repo")
53       . (incl "/etc/yum/yum-cron*.conf") 
54       . (incl "/etc/yum/pluginconf.d/*")
55       . (excl "/etc/yum/pluginconf.d/versionlock.list")
56       . Util.stdexcl
57
58   let xfm = transform lns filter
59
60 (* Local Variables: *)
61 (* mode: caml       *)
62 (* End:             *)