3 Parsing /etc/apt/sources.list
9 (************************************************************************
10 * Group: Utility variables/functions
11 ************************************************************************)
13 let sep_ws = Sep.space
16 let eol = Util.del_str "\n"
19 let comment = Util.comment
21 let empty = Util.empty
24 let word = /[^][# \n\t]+/
28 let protocol = /[a-z+]+:/
29 in let path = /\/[^] \t]*/
30 in let path_brack = /\[[^]]+\]\/?/
32 | protocol . path_brack
34 (************************************************************************
36 ************************************************************************)
39 let option_sep = [ label "operation" . store /[+-]/]? . Sep.equal
40 in let option = Build.key_value /arch|trusted/ option_sep (store Rx.word)
41 in let options = [ label "options"
42 . Util.del_str "[" . Sep.opt_space
43 . Build.opt_list option Sep.space
44 . Sep.opt_space . Util.del_str "]"
46 in [ Util.indent . seq "source"
47 . [ label "type" . store word ] . sep_ws
49 . [ label "uri" . store uri ] . sep_ws
50 . [ label "distribution" . store word ]
51 . [ label "component" . sep_ws . store word ]*
52 . del /[ \t]*(#.*)?/ ""
55 (************************************************************************
57 ************************************************************************)
59 let lns = ( comment | empty | record ) *
62 let filter = (incl "/etc/apt/sources.list")
63 . (incl "/etc/apt/sources.list.d/*")
66 let xfm = transform lns filter
68 (* Local Variables: *)