1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// {{{ Copyright (c) Paul R. Tagliamonte <paultag@debian.org>, 2024
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. }}}
//! The `control` module contains support for parsing Debian RFC 2822-style
//! files into our conventional formats.
//!
//! | What | File Type | Struct |
//! | ----------------------- | ---------------------------------------------- | ------------------------ |
//! | Package Upload | `.changes`. | [package::Changes] |
//! | Source Package | `.dsc` | [package::Dsc] |
//! | Build Info | `.buildinfo` | [package::Buildinfo] |
//! | Binary Package Control | `DEBIAN/control` | [package::BinaryControl] |
//! | Binary Archive Release | `dists/*/InRelease` | [archive::Release] |
//! | Binary Archive Index | `dists/*/*/binary-*/Packages*` | [archive::Package] |
//! | `apt` `sources.list` | `/etc/apt/sources.list/*.sources` | [apt::SourcesList] |
//! | `dak` command | `*.dak-commands` | [dak::Command] |
//!
//! # Feature `serde`
//!
//! ⚠️ Support for directly using [ser] and [de] to encode and decode
//! arbitrary Debian-flavored RFC2822 files is possible but not recommended
//! yet. The Serializer and Deserializer implementation is very strict on
//! what it will encode or decode, and the only first-class targets at
//! the moment are the files this crate itself parses. Over time, as this
//! crate matures, this warning will be removed.
//!
//! ## Restrictions / Rules on `serde` support
//!
//! ### Use of `#[serde(flatten)]`
//!
//! The Debian RFC 2822-like format is *not* "self describing". There's no
//! way to know the type of a value except to have knowledge of the type
//! for a given key.
//!
//! There's a long-standing issue due to implementation choices made during
//! the creation of `flatten` that, when `flatten`ing structs,
//! the `serde` internals will dispatch to the `_any` helper for the values,
//! rather than the typed helpers, unlike for a normal deserialization.
//!
//! I can't see any real useful workarounds and I don't think serde is going
//! to fix this anytime soon. As a result, I left the `_any` helper to call
//! back with `_str`; so flatten will work IFF all fiends are string-based
//! Deserilizations. Weirdly things will break if you use a prim non-String
//! type (like i32 or a bool) in the inner struct while using `flatten`.
//!
//! ### Multiline Behavior
//!
//! There are three types of Debian RFC2822-style key/value types. Those
//! types are `simple` (the field must be on all one line), `folded` (multiple
//! lines, but no semantic meaning), and `multiline` (repeated continuation
//! lines of a specific format following a possible value on the same line
//! as the key).
//!
//! This crate treats `simple` and `folded` fields as the same. This may
//! break with a strict intepreation of control files, but it is only more
//! lax in what it produces. This may change in the future, do not rely
//! on this behavior.
//!
//! `multiline` fields will be treated as a `simple` or `folded` field if
//! they're unpacked into most fields, with the exception of unpacking a
//! `multiline` into a `Vec<_>`, which will parse each line into the provided
//! `Deserialize` traited target. *`multiline` files with a leading value on
//! the same line as the key are not supported as of right now*. If you're
//! parsing such a file, your best bet is to implement [serde::Deserialize]
//! yourself until this crate matures.
//!
//! This will export two modules from this package - [ser] and [de].
//! Additionally the crate will add [serde::Serialize] and [serde::Deserialize]
//! derives as required.
//!
//! # Feature `sequoia`
//!
//! This will add *very* basic OpenPGP support in a non-exported and
//! private module, as well as one additional function which is exported
//! if `serde` support is enabled as well under [de::from_clearsigned_str].
//!
//! # Feature `tokio`
//!
//! This will add support for reading [crate::control] files from a
//! [tokio::io::AsyncRead], via [de::from_reader_async]
pub use Architectures;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Number;
pub use ;
pub use ;
use def_serde_traits_for;
use ;
pub use ;
// vim: foldmethod=marker