Aptsources822

Augeas module for sources list (Deb822 style) for Apt package manager

Authors

James Valleroy jval.nosp@m.leroy@mailb.nosp@m.ox.org Sunil Mohan Adapa su.nosp@m.nil@medha.nosp@m.s.org

Summary
Aptsources822Augeas module for sources list (Deb822 style) for Apt package manager
Referencehttps://manpages.debian.org/bullseye/dpkg-dev/deb822.5.en.html 2.
LicenseThis file is licensed under the LGPLv2+, like the rest of Augeas.
Configuration filesThis lens applies to files in /etc/apt/sources.list.d/ ending with the extension .sources.
Augeas Variables
single_value_field_nameNames of known fields for which only a single value is allowed.
multi_value_field_nameNames of known fields for which multiple values are allowed and are assumed to contain multiple values These fields also allow the form FieldName-Add: extra_value FieldName-Remove: delete_this_value This is an explicit list of allowed field names
field_valueValue that a field can contain.
text_valueValue for the embedded public-key format for Signed-By Includes all text on the line except leading-spaces and trailing-spaces
empty_lineLens for an empty line separating two stanzas.
name_value_separatorLens for separating a name and value.
single_value_fieldLens for a field (field name, separator and field value) with only a single value.
multi_value_fieldLens for a field (field name, separator and field value) with multiple values or can run over multiple lines, ie.
stanzaLens for a stanza that describes one or more sources for apt.
lnsLens for parsing the entire apt sources file in Deb822 format.
filterAll files in the sources.list.d directory are files describing sources.

License

This file is licensed under the LGPLv2+, like the rest of Augeas.

Configuration files

This lens applies to files in /etc/apt/sources.list.d/ ending with the extension .sources.  See filter.

Augeas Variables

single_value_field_name

let single_value_field_name = /(Enabled|PDiffs|By-Hash|Allow-Insecure|Allow-Weak|Allow-Downgrade-To-Insecure|Trusted|Check-Valid-Until|Valid-Until-Min|Valid-Until-Max|Check-Date|Date-Max-Future|InRelease-Path|Snapshot)/

Names of known fields for which only a single value is allowed.

multi_value_field_name

let multi_value_field_name = /(URIs|Types|Components|Suites|Architectures|Include|Exclude|Languages|Targets|Signed-By)(-Add|-Remove)?/

Names of known fields for which multiple values are allowed and are assumed to contain multiple values These fields also allow the form FieldName-Add: extra_value FieldName-Remove: delete_this_value This is an explicit list of allowed field names

field_value

let field_value = /[!-~]+/

Value that a field can contain.  Deb822 styles sources list files defines these fields to have multiple values separated by space, tab or a newline.

text_value

let text_value = /[!-~](.*[!-~])?/

Value for the embedded public-key format for Signed-By Includes all text on the line except leading-spaces and trailing-spaces

empty_line

let empty_line = Util.doseol

Lens for an empty line separating two stanzas.  It can’t be a comment.  Only tabs and spaces are allowed.

name_value_separator

let name_value_separator = Sep.colon . del Rx.opt_space " "

Lens for separating a name and value.  Field name is followed by a ‘:’ and then optionally space.  The file format also allow for a value to be on a new line when the new line starts with space or a tab.

single_value_field

let single_value_field = [ key single_value_field_name . name_value_separator . store field_value . Util.doseol ]

Lens for a field (field name, separator and field value) with only a single value.

multi_value_field

let multi_value_field = [ key multi_value_field_name . name_value_separator . ( ( counter "item" . [ seq "item". store field_value . del /[ \t]+/ " " ]* . [ seq "item". store field_value ] . Util.doseol ) | ( [ label "text" . del "\n" "\n" . counter "item" . [ del /^[ ]/ " " . seq "item" . store text_value . Util.doseol ]+ ] ) ) ]

Lens for a field (field name, separator and field value) with multiple values or can run over multiple lines, ie.  SignedBy

stanza

Lens for a stanza that describes one or more sources for apt.

lns

let lns = ( stanza . empty_line )* . stanza

Lens for parsing the entire apt sources file in Deb822 format.

filter

All files in the sources.list.d directory are files describing sources.  However, only those ending with .sources extension are in Deb822 format.

let single_value_field_name = /(Enabled|PDiffs|By-Hash|Allow-Insecure|Allow-Weak|Allow-Downgrade-To-Insecure|Trusted|Check-Valid-Until|Valid-Until-Min|Valid-Until-Max|Check-Date|Date-Max-Future|InRelease-Path|Snapshot)/
Names of known fields for which only a single value is allowed.
let multi_value_field_name = /(URIs|Types|Components|Suites|Architectures|Include|Exclude|Languages|Targets|Signed-By)(-Add|-Remove)?/
Names of known fields for which multiple values are allowed and are assumed to contain multiple values These fields also allow the form FieldName-Add: extra_value FieldName-Remove: delete_this_value This is an explicit list of allowed field names
let field_value = /[!-~]+/
Value that a field can contain.
let text_value = /[!-~](.*[!-~])?/
Value for the embedded public-key format for Signed-By Includes all text on the line except leading-spaces and trailing-spaces
let empty_line = Util.doseol
Lens for an empty line separating two stanzas.
let name_value_separator = Sep.colon . del Rx.opt_space " "
Lens for separating a name and value.
let single_value_field = [ key single_value_field_name . name_value_separator . store field_value . Util.doseol ]
Lens for a field (field name, separator and field value) with only a single value.
let multi_value_field = [ key multi_value_field_name . name_value_separator . ( ( counter "item" . [ seq "item". store field_value . del /[ \t]+/ " " ]* . [ seq "item". store field_value ] . Util.doseol ) | ( [ label "text" . del "\n" "\n" . counter "item" . [ del /^[ ]/ " " . seq "item" . store text_value . Util.doseol ]+ ] ) ) ]
Lens for a field (field name, separator and field value) with multiple values or can run over multiple lines, ie.
let lns = ( stanza . empty_line )* . stanza
Lens for parsing the entire apt sources file in Deb822 format.
All files in the sources.list.d directory are files describing sources.
Close