# Reprepro_Uploaders

Parses reprepro’s uploaders files

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

Summary

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.
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_group | Authenticate packages by a groupname.
by | by statements define who is allowed to upload.
allow |
group | A group declaration
entry | An entry is either an allow statement or a group definition.
lns | The 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. About: 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" | "distribution"

#### 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_group

> let by_group = value "group" . [ key "group" . Sep.space . store Rx.word ]

Authenticate packages by a groupname.

>     $reprepro/allow[1]/by/group = "groupname"

### by

> let by = [ key "by" . Sep.space . ( store ("anybody"|"unsigned") | by_key | by_group ) ]

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"

### allow

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

#### An allow entry, 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"

### group

> let group = let add = [ key "add" . Sep.space . store Rx.word ] in let contains = [ key "contains" . Sep.space . store Rx.word ] in let empty = [ key "empty" ] in let unused = [ key "unused" ] in [ key "group" . Sep.space . store Rx.word . Sep.space . (add | contains | empty | unused) . Util.eol ]

A group declaration

### entry

> let entry = allow | group

An entry is either an allow statement or a group definition.

### lns

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

> 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_group = value "group" . [ key "group" . Sep.space . store Rx.word ]

Authenticate packages by a groupname.

> let by = [ key "by" . Sep.space . ( store ("anybody"|"unsigned") | by_key | by_group ) ]

by statements define who is allowed to upload.

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

> let group = let add = [ key "add" . Sep.space . store Rx.word ] in let contains = [ key "contains" . Sep.space . store Rx.word ] in let empty = [ key "empty" ] in let unused = [ key "unused" ] in [ key "group" . Sep.space . store Rx.word . Sep.space . (add | contains | empty | unused) . Util.eol ]

A group declaration

> let entry = allow | group

An entry is either an allow statement or a group definition.

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

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

> 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