Reprepro_Uploaders

Parses reprepro’s uploaders files

Author: Raphael Pinson rap.nosp@m.hink@gmai.nosp@m.l.com

Summary
Reprepro_UploadersParses reprepro’s uploaders files
ReferenceThis lens tries to keep as close as possible to `man 1 reprepro` where possible.
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageSee lns.
Configuration filesThis lens applies to reprepro’s uploaders files.
ExamplesThe Test_Reprepro_Uploaders file contains various examples and tests.
Augeas Lenses
logic_construct_conditionA logical construction for condition and condition_list
logic_construct_fieldA generic definition for condition_field
condition_re
condition_fieldA single condition field is an ‘or’ node.
conditionA condition is an ‘and’ node, representing a union of condition_fields, listed under ‘or’ subnodes:
condition_listA 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_keyWhen a key is used to authenticate packages, the value can either be a key ID or “any”:
byby statements define who is allowed to upload.
entry
lnsThe lens is made of Util.empty, Util.comment and entry lines

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

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

logic_construct_field

let logic_construct_field (kw:string) (sep:string) (lns:lens) = [ label kw . lns ] . [ Build.xchgs sep kw . lns ]*

A generic definition for condition_field

condition_re

let condition_re = "source" | "byhand" | "sections" | "binaries" | "architectures"

A condition can be of several types

  • source
  • byhand
  • sections
  • sections contain
  • binaries
  • binaries contain
  • architectures
  • architectures contain

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.

condition_field

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"

condition

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"

condition_list

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"

by_key

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"

by

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"

entry

let entry = [ key "allow" . Sep.space . condition_list . Sep.space . by . Util.eol ]

An entry is an allow statement, e.g.

$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"

lns

let lns = (Util.empty|Util.comment|entry)*

The lens is made of Util.empty, Util.comment and entry lines

let lns = (Util.empty|Util.comment|entry)*
The lens is made of Util.empty, Util.comment and entry lines
Provides unit tests and examples for the Reprepro_Uploaders lens.
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 condition = logic_construct_condition "or" condition_field
A condition is an ‘and’ node, representing a union of condition_fields, listed under ‘or’ subnodes:
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:
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_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.
let condition_re = "source" | "byhand" | "sections" | "binaries" | "architectures"
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”:
let by = [ key "by" . Sep.space . ( store ("anybody"|"unsigned") | by_key ) ]
by statements define who is allowed to upload.
let entry = [ key "allow" . Sep.space . condition_list . Sep.space . by . Util.eol ]
let empty = empty_generic empty_generic_re
Map empty lines, including empty comments
let comment = comment_generic /[ \t]*#[ \t]*/ "# "
Map comments into “#comment” nodes
Close