Parses reprepro’s uploaders files
Author: Raphael Pinson rap@gmai l.com hink
Reprepro_Uploaders | Parses reprepro’s uploaders files |
Reference | This lens tries to keep as close as possible to `man 1 reprepro` where possible. |
License | This file is licenced under the LGPL v2+, like the rest of Augeas. |
Lens Usage | See lns. |
Configuration files | This lens applies to reprepro’s uploaders files. |
Examples | The Test_Reprepro_Uploaders file contains various examples and tests. |
Augeas Lenses | |
logic_construct_condition | A logical construction for condition and condition_list |
logic_construct_field | A generic definition for condition_field |
condition_re | |
condition_field | A single condition field is an ‘or’ node. |
condition | A condition is an ‘and’ node, representing a union of condition_fields, listed under ‘or’ subnodes: |
condition_list | A list of conditions, inspired by Debctrl.dependency_list An upload condition list is either the wildcard ‘*’, stored verbatim, or an intersection of conditions listed under ‘and’ subnodes: |
by_key | When a key is used to authenticate packages, the value can either be a key ID or “any”: |
by | by statements define who is allowed to upload. |
entry | |
lns | The lens is made of Util.empty, Util.comment and entry lines |
See lns.
The Test_Reprepro_Uploaders file contains various examples and tests.
let logic_construct_condition (kw:string) (lns:lens) = [ label kw . lns ] . [ Sep.space . key kw . Sep.space . lns ]*
A logical construction for condition and condition_list
let logic_construct_field (kw:string) (sep:string) (lns:lens) = [ label kw . lns ] . [ Build.xchgs sep kw . lns ]*
A generic definition for condition_field
let condition_re = "source" | "byhand" | "sections" | "binaries" | "architectures"
While the lens technically also accepts “source contain” and “byhand contain”, these are not understood by reprepro.
The “contain” types are built by adding a “contain” subnode. See the condition_field definition.
let condition_field = let sto_condition = Util.del_str "'" . store /[^'\n]+/ . Util.del_str "'" in [ key "not" . Sep.space ]? . store condition_re . [ Sep.space . key "contain" ]? . Sep.space . logic_construct_field "or" "|" sto_condition
A single condition field is an ‘or’ node. It may contain several values, listed in ‘or’ subnodes:
$reprepro/allow[1]/and/or = "architectures" $reprepro/allow[1]/and/or/or[1] = "i386" $reprepro/allow[1]/and/or/or[2] = "amd64" $reprepro/allow[1]/and/or/or[3] = "all"
let condition = logic_construct_condition "or" condition_field
A condition is an ‘and’ node, representing a union of condition_fields, listed under ‘or’ subnodes:
$reprepro/allow[1]/and $reprepro/allow[1]/and/or = "architectures" $reprepro/allow[1]/and/or/or[1] = "i386" $reprepro/allow[1]/and/or/or[2] = "amd64" $reprepro/allow[1]/and/or/or[3] = "all"
let condition_list = store "*" | logic_construct_condition "and" condition
A list of conditions, inspired by Debctrl.dependency_list An upload condition list is either the wildcard ‘*’, stored verbatim, or an intersection of conditions listed under ‘and’ subnodes:
$reprepro/allow[1]/and[1] $reprepro/allow[1]/and[1]/or = "architectures" $reprepro/allow[1]/and[1]/or/or[1] = "i386" $reprepro/allow[1]/and[1]/or/or[2] = "amd64" $reprepro/allow[1]/and[1]/or/or[3] = "all" $reprepro/allow[1]/and[2] $reprepro/allow[1]/and[2]/or = "sections" $reprepro/allow[1]/and[2]/or/contain $reprepro/allow[1]/and[2]/or/or = "main"
let by_key = let any_key = [ store "any" . Sep.space . key "key" ] in let named_key = [ key "key" . Sep.space . store (Rx.word - "any") ] in value "key" . (any_key | named_key)
When a key is used to authenticate packages, the value can either be a key ID or “any”:
$reprepro/allow[1]/by/key = "ABCD1234" $reprepro/allow[2]/by/key = "any"
let by = [ key "by" . Sep.space . ( store ("anybody"|"unsigned") | by_key ) ]
by statements define who is allowed to upload. It can be simple keywords, like “anybody” or “unsigned”, or a key ID, in which case a “key” subnode is added:
$reprepro/allow[1]/by/key = "ABCD1234" $reprepro/allow[2]/by/key = "any" $reprepro/allow[3]/by = "anybody" $reprepro/allow[4]/by = "unsigned"
let entry = [ key "allow" . Sep.space . condition_list . Sep.space . by . Util.eol ]
$reprepro/allow[1] $reprepro/allow[1]/and[1] $reprepro/allow[1]/and[1]/or = "architectures" $reprepro/allow[1]/and[1]/or/or[1] = "i386" $reprepro/allow[1]/and[1]/or/or[2] = "amd64" $reprepro/allow[1]/and[1]/or/or[3] = "all" $reprepro/allow[1]/and[2] $reprepro/allow[1]/and[2]/or = "sections" $reprepro/allow[1]/and[2]/or/contain $reprepro/allow[1]/and[2]/or/or = "main" $reprepro/allow[1]/by = "key" $reprepro/allow[1]/by/key = "ABCD1234"
let lns = (Util.empty|Util.comment|entry)*
The lens is made of Util.empty, Util.comment and entry lines
The lens is made of Util.empty, Util.comment and entry lines
let lns = (Util.empty|Util.comment|entry)*
A logical construction for condition and condition_list
let logic_construct_condition (kw:string) (lns:lens) = [ label kw . lns ] . [ Sep.space . key kw . Sep.space . lns ]*
A condition is an ‘and’ node, representing a union of condition_fields, listed under ‘or’ subnodes:
let condition = logic_construct_condition "or" condition_field
A list of conditions, inspired by Debctrl.dependency_list An upload condition list is either the wildcard ‘*’, stored verbatim, or an intersection of conditions listed under ‘and’ subnodes:
let condition_list = store "*" | logic_construct_condition "and" condition
A generic definition for condition_field
let logic_construct_field (kw:string) (sep:string) (lns:lens) = [ label kw . lns ] . [ Build.xchgs sep kw . lns ]*
A single condition field is an ‘or’ node.
let condition_field = let sto_condition = Util.del_str "'" . store /[^'\n]+/ . Util.del_str "'" in [ key "not" . Sep.space ]? . store condition_re . [ Sep.space . key "contain" ]? . Sep.space . logic_construct_field "or" "|" sto_condition
let condition_re = "source" | "byhand" | "sections" | "binaries" | "architectures"
When a key is used to authenticate packages, the value can either be a key ID or “any”:
let by_key = let any_key = [ store "any" . Sep.space . key "key" ] in let named_key = [ key "key" . Sep.space . store (Rx.word - "any") ] in value "key" . (any_key | named_key)
by statements define who is allowed to upload.
let by = [ key "by" . Sep.space . ( store ("anybody"|"unsigned") | by_key ) ]
let entry = [ key "allow" . Sep.space . condition_list . Sep.space . by . Util.eol ]
Map empty lines, including empty comments
let empty = empty_generic empty_generic_re
Map comments into “#comment” nodes
let comment = comment_generic /[ \t]*#[ \t]*/ "# "