1 (* Dput module for Augeas
2 Author: Raphael Pinson <raphink@gmail.com>
5 Reference: dput uses Python's ConfigParser:
6 http://docs.python.org/lib/module-ConfigParser.html
14 (************************************************************************
16 *************************************************************************)
17 let comment = IniFile.comment IniFile.comment_re IniFile.comment_default
19 let sep = IniFile.sep IniFile.sep_re IniFile.sep_default
22 let setting = "allow_dcut"
23 | "allow_non-us_software"
24 | "allow_unsigned_uploads"
27 | "default_host_non-us"
34 | "post_upload_command"
35 | "pre_upload_command"
36 | "progress_indicator"
40 | "ssh_config_options"
41 | "allowed_distributions"
43 (************************************************************************
44 * "name: value" entries, with continuations in the style of RFC 822;
45 * "name=value" is also accepted
46 * leading whitespace is removed from values
47 *************************************************************************)
48 let entry = IniFile.entry setting sep comment
51 (************************************************************************
52 * sections, led by a "[section]" header
53 * We can't use titles as node names here since they could contain "/"
54 * We remove #comment from possible keys
55 * since it is used as label for comments
56 * We also remove / as first character
57 * because augeas doesn't like '/' keys (although it is legal in INI Files)
58 *************************************************************************)
59 let title = IniFile.title_label "target" IniFile.record_label_re
60 let record = IniFile.record title entry
62 let lns = IniFile.lns record comment
64 let filter = (incl "/etc/dput.cf")
65 . (incl (Sys.getenv("HOME") . "/.dput.cf"))
67 let xfm = transform lns filter