deb 0.5.20

Utilities for working with files and formats commonly found when working with Debian's project tooling, or infrastructure.
Documentation
// {{{ 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. }}}

use super::{CommonSourceControl, PackageList};
use crate::control::{FileDigestMd5, FileDigestSha1, FileDigestSha256};

#[cfg(feature = "serde")]
use ::serde::{Deserialize, Serialize};

/// ...
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "PascalCase"))]
pub struct SourceControl {
    /// The value of this field declares the format version of the source
    /// package.  The field value is used by programs acting on a source
    /// package to interpret the list of files in the source package and
    /// determine how to unpack it. The syntax of the field value is a
    /// numeric major revision (`0-9`), a period (`.`), a numeric minor
    /// revision (`0-9`), and then an optional subtype after whitespace
    /// (` \t`), which if specified is a lowercase alphanumeric (`a-z0-9`)
    /// word in parentheses (`()`). The subtype is optional in the syntax but
    /// may be mandatory for particular source format revisions.
    ///
    /// The source formats currently supported by `dpkg` are `1.0`, `2.0`,
    /// `3.0 (native)`, `3.0 (quilt)`, `3.0 (git)`, `3.0 (bzr)` and
    /// `3.0 (custom)`. See dpkg-source(1) for their description.
    pub format: String,

    /// The value of this field determines the package name, and is used to
    /// generate file names by most installation tools.
    pub package: String,

    /// Source contrl information
    #[cfg_attr(feature = "serde", serde(flatten))]
    pub control: CommonSourceControl,

    /// list of binary packages generated by this source package.
    #[cfg_attr(feature = "serde", serde(rename = "Package-List"))]
    pub package_list: Option<Vec<PackageList>>,

    /// Files contains a list of files with an md5sum, size, section and
    /// priority for each one.
    ///
    /// Each line consists of space-separated entries describing the
    /// file: the md5sum, the file size, the file section, the file priority,
    /// and the file name.
    ///
    /// This field lists all files that make up the upload. The list of files
    /// in this field must match the list of files in the other related
    /// Digests fields.
    ///
    /// Note: The MD5 checksum is considered weak, and should never be assumed
    /// to be sufficient for secure verification, but this field cannot be
    /// omitted as it provides metadata not available anywhere else.
    pub files: Vec<FileDigestMd5>,

    /// Each line consists of space-separated entries describing the file:
    /// the checksum, the file size, and the file name.
    ///
    /// These fields list all files that make up the upload. The list of files
    /// in these fields must match the list of files in the Files field and
    /// the other related Digests fields.
    ///
    /// Note: The SHA-1 checksum is considered weak, and should never be
    /// assumed to be sufficient for secure verification.
    #[cfg_attr(feature = "serde", serde(rename = "Checksums-Sha1"))]
    pub checksum_sha1: Option<Vec<FileDigestSha1>>,

    /// Each line consists of space-separated entries describing the file:
    /// the checksum, the file size, and the file name.
    ///
    /// These fields list all files that make up the upload. The list of files
    /// in these fields must match the list of files in the Files field and
    /// the other related Digests fields.
    #[cfg_attr(feature = "serde", serde(rename = "Checksums-Sha256"))]
    pub checksum_sha256: Vec<FileDigestSha256>,
}

// vim: foldmethod=marker