2 Module: Reprepro_Uploaders
3 Parses reprepro's uploaders files
5 Author: Raphael Pinson <raphink@gmail.com>
8 This lens tries to keep as close as possible to `man 1 reprepro` where possible.
11 This file is licenced under the LGPL v2+, like the rest of Augeas.
16 About: Configuration files
17 This lens applies to reprepro's uploaders files.
20 The <Test_Reprepro_Uploaders> file contains various examples and tests.
23 module Reprepro_Uploaders =
25 (* View: logic_construct_condition
26 A logical construction for <condition> and <condition_list> *)
27 let logic_construct_condition (kw:string) (lns:lens) =
29 . [ Sep.space . key kw . Sep.space . lns ]*
31 (* View: logic_construct_field
32 A generic definition for <condition_field> *)
33 let logic_construct_field (kw:string) (sep:string) (lns:lens) =
35 . [ Build.xchgs sep kw . lns ]*
38 A condition can be of several types:
47 - architectures contain
49 While the lens technically also accepts "source contain"
50 and "byhand contain", these are not understood by reprepro.
52 The "contain" types are built by adding a "contain" subnode.
53 See the <condition_field> definition.
63 (* View: condition_field
64 A single condition field is an 'or' node.
65 It may contain several values, listed in 'or' subnodes:
67 > $reprepro/allow[1]/and/or = "architectures"
68 > $reprepro/allow[1]/and/or/or[1] = "i386"
69 > $reprepro/allow[1]/and/or/or[2] = "amd64"
70 > $reprepro/allow[1]/and/or/or[3] = "all"
74 let sto_condition = Util.del_str "'" . store /[^'\n]+/ . Util.del_str "'" in
75 [ key "not" . Sep.space ]? .
77 . [ Sep.space . key "contain" ]?
79 . logic_construct_field "or" "|" sto_condition
82 A condition is an 'and' node,
83 representing a union of <condition_fields>,
84 listed under 'or' subnodes:
86 > $reprepro/allow[1]/and
87 > $reprepro/allow[1]/and/or = "architectures"
88 > $reprepro/allow[1]/and/or/or[1] = "i386"
89 > $reprepro/allow[1]/and/or/or[2] = "amd64"
90 > $reprepro/allow[1]/and/or/or[3] = "all"
94 logic_construct_condition "or" condition_field
96 (* View: condition_list
97 A list of <conditions>, inspired by Debctrl.dependency_list
98 An upload condition list is either the wildcard '*', stored verbatim,
99 or an intersection of conditions listed under 'and' subnodes:
101 > $reprepro/allow[1]/and[1]
102 > $reprepro/allow[1]/and[1]/or = "architectures"
103 > $reprepro/allow[1]/and[1]/or/or[1] = "i386"
104 > $reprepro/allow[1]/and[1]/or/or[2] = "amd64"
105 > $reprepro/allow[1]/and[1]/or/or[3] = "all"
106 > $reprepro/allow[1]/and[2]
107 > $reprepro/allow[1]/and[2]/or = "sections"
108 > $reprepro/allow[1]/and[2]/or/contain
109 > $reprepro/allow[1]/and[2]/or/or = "main"
114 | logic_construct_condition "and" condition
117 When a key is used to authenticate packages,
118 the value can either be a key ID or "any":
120 > $reprepro/allow[1]/by/key = "ABCD1234"
121 > $reprepro/allow[2]/by/key = "any"
125 let any_key = [ store "any" . Sep.space
127 let named_key = [ key "key" . Sep.space
128 . store (Rx.word - "any") ] in
129 value "key" . (any_key | named_key)
132 <by> statements define who is allowed to upload.
133 It can be simple keywords, like "anybody" or "unsigned",
134 or a key ID, in which case a "key" subnode is added:
136 > $reprepro/allow[1]/by/key = "ABCD1234"
137 > $reprepro/allow[2]/by/key = "any"
138 > $reprepro/allow[3]/by = "anybody"
139 > $reprepro/allow[4]/by = "unsigned"
143 [ key "by" . Sep.space
144 . ( store ("anybody"|"unsigned")
148 An entry is an allow statement, e.g.:
151 > $reprepro/allow[1]/and[1]
152 > $reprepro/allow[1]/and[1]/or = "architectures"
153 > $reprepro/allow[1]/and[1]/or/or[1] = "i386"
154 > $reprepro/allow[1]/and[1]/or/or[2] = "amd64"
155 > $reprepro/allow[1]/and[1]/or/or[3] = "all"
156 > $reprepro/allow[1]/and[2]
157 > $reprepro/allow[1]/and[2]/or = "sections"
158 > $reprepro/allow[1]/and[2]/or/contain
159 > $reprepro/allow[1]/and[2]/or/or = "main"
160 > $reprepro/allow[1]/by = "key"
161 > $reprepro/allow[1]/by/key = "ABCD1234"
165 [ key "allow" . Sep.space
166 . condition_list . Sep.space
170 The lens is made of <Util.empty>, <Util.comment> and <entry> lines *)
171 let lns = (Util.empty|Util.comment|entry)*