Imported Upstream version 1.3.0
[platform/upstream/augeas.git] / lenses / aptsources.aug
1 (*
2 Module: Aptsources
3   Parsing /etc/apt/sources.list
4 *)
5
6 module Aptsources =
7   autoload xfm
8
9 (************************************************************************
10  * Group: Utility variables/functions
11  ************************************************************************)
12   (* View:  sep_ws *)
13   let sep_ws = del /[ \t]+/ " "
14
15   (* View: eol *)
16   let eol = Util.del_str "\n"
17
18   (* View: comment *)
19   let comment = Util.comment
20   (* View: empty *)
21   let empty = Util.empty
22
23   (* View: word *)
24   let word = /[^# \n\t]+/
25
26 (************************************************************************
27  * Group: Keywords
28  ************************************************************************)
29   (* View: record *)
30   let record = [ Util.indent . seq "source" . [ label "type" . store word ] . sep_ws .
31                                 [ label "uri"  . store word ] . sep_ws .
32                                 [ label "distribution" . store word ]  .
33                                 [ label "component" . sep_ws . store word ]* .
34                                 del /[ \t]*(#.*)?/ ""
35                  . eol ]
36
37 (************************************************************************
38  * Group: Lens
39  ************************************************************************)
40   (* View: lns *)
41   let lns = ( comment | empty | record ) *
42
43   (* View: filter *)
44   let filter = (incl "/etc/apt/sources.list")
45       . (incl "/etc/apt/sources.list.d/*")
46       . Util.stdexcl
47
48   let xfm = transform lns filter
49
50 (* Local Variables: *)
51 (* mode: caml *)
52 (* End: *)