pub struct DbDescFileV2 {Show 20 fields
pub name: Name,
pub version: Version,
pub base: PackageBaseName,
pub description: PackageDescription,
pub url: Option<Url>,
pub arch: Architecture,
pub builddate: BuildDate,
pub installdate: BuildDate,
pub packager: Packager,
pub size: InstalledSize,
pub groups: Vec<Group>,
pub reason: PackageInstallReason,
pub license: Vec<License>,
pub validation: PackageValidation,
pub replaces: Vec<PackageRelation>,
pub depends: Vec<PackageRelation>,
pub optdepends: Vec<OptionalDependency>,
pub conflicts: Vec<PackageRelation>,
pub provides: Vec<PackageRelation>,
pub xdata: ExtraData,
}Expand description
DB desc version 2
DbDescFileV2 extends DbDescFileV1 according to the second revision of the
alpm-db-desc specification. It introduces an additional %XDATA% section, which allows
storing structured, implementation-defined metadata.
§Examples
use std::str::FromStr;
use alpm_db::desc::DbDescFileV2;
let desc_data = r#"%NAME%
foo
%VERSION%
1.0.0-1
%BASE%
foo
%DESC%
An example package
%URL%
https://example.org/
%ARCH%
x86_64
%BUILDDATE%
1733737242
%INSTALLDATE%
1733737243
%PACKAGER%
Foobar McFooface <foobar@mcfooface.org>
%SIZE%
123
%GROUPS%
utils
cli
%REASON%
1
%LICENSE%
MIT
Apache-2.0
%VALIDATION%
pgp
%REPLACES%
pkg-old
%DEPENDS%
glibc
%OPTDEPENDS%
optpkg
%CONFLICTS%
foo-old
%PROVIDES%
foo-virtual
%XDATA%
pkgtype=pkg
"#;
// Parse a DB DESC file in version 2 format.
let db_desc = DbDescFileV2::from_str(desc_data)?;
// Convert back to its canonical string representation.
assert_eq!(db_desc.to_string(), desc_data);Fields§
§name: NameThe name of the package.
version: VersionThe version of the package.
base: PackageBaseNameThe base name of the package (used in split packages).
description: PackageDescriptionThe description of the package.
url: Option<Url>The URL for the project of the package.
arch: ArchitectureThe architecture of the package.
builddate: BuildDateThe date at which the build of the package started.
installdate: BuildDateThe date at which the package has been installed on the system.
packager: PackagerThe User ID of the entity, that built the package.
size: InstalledSizeThe optional size of the (uncompressed and unpacked) package contents in bytes.
groups: Vec<Group>Groups the package belongs to.
reason: PackageInstallReasonOptional install reason.
license: Vec<License>Licenses that apply to the package.
validation: PackageValidationValidation methods used for the package archive.
replaces: Vec<PackageRelation>Packages this one replaces.
depends: Vec<PackageRelation>Required runtime dependencies.
optdepends: Vec<OptionalDependency>Optional dependencies that enhance the package.
conflicts: Vec<PackageRelation>Conflicting packages that cannot be installed together.
provides: Vec<PackageRelation>Virtual packages or capabilities provided by this one.
xdata: ExtraDataStructured extra metadata, implementation-defined.
Trait Implementations§
Source§impl Clone for DbDescFileV2
impl Clone for DbDescFileV2
Source§fn clone(&self) -> DbDescFileV2
fn clone(&self) -> DbDescFileV2
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DbDescFileV2
impl Debug for DbDescFileV2
Source§impl<'de> Deserialize<'de> for DbDescFileV2
impl<'de> Deserialize<'de> for DbDescFileV2
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for DbDescFileV2
impl Display for DbDescFileV2
Source§impl From<DbDescFileV2> for DbDescFileV1
impl From<DbDescFileV2> for DbDescFileV1
Source§fn from(v2: DbDescFileV2) -> Self
fn from(v2: DbDescFileV2) -> Self
Converts a DbDescFileV2 into a DbDescFileV1.
§Note
This drops the xdata field of the DbDescFileV2, which provides additional information
about a package.
Source§impl FromStr for DbDescFileV2
impl FromStr for DbDescFileV2
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Creates a DbDescFileV2 from a string slice.
Parses the input according to the alpm-db-descv2 specification (version 2) and constructs
a structured DbDescFileV2 representation including the %XDATA% section.
§Examples
use std::str::FromStr;
use alpm_db::desc::DbDescFileV2;
let desc_data = r#"%NAME%
foo
%VERSION%
1.0.0-1
%BASE%
foo
%DESC%
An example package
%URL%
https://example.org
%ARCH%
x86_64
%BUILDDATE%
1733737242
%INSTALLDATE%
1733737243
%PACKAGER%
Foobar McFooface <foobar@mcfooface.org>
%SIZE%
123
%VALIDATION%
pgp
%XDATA%
pkgtype=pkg
"#;
let db_desc = DbDescFileV2::from_str(desc_data)?;
assert_eq!(db_desc.name.to_string(), "foo");§Errors
Returns an error if:
- the input cannot be parsed into valid sections,
- or required fields are missing or malformed.
Source§impl PartialEq for DbDescFileV2
impl PartialEq for DbDescFileV2
Source§impl Serialize for DbDescFileV2
impl Serialize for DbDescFileV2
Source§impl TryFrom<Vec<Section>> for DbDescFileV2
impl TryFrom<Vec<Section>> for DbDescFileV2
Source§fn try_from(sections: Vec<Section>) -> Result<Self, Self::Error>
fn try_from(sections: Vec<Section>) -> Result<Self, Self::Error>
Tries to create a DbDescFileV2 from a list of parsed Sections.
Reuses the parsing logic from DbDescFileV1 for all common fields, and adds support for
the %XDATA% section introduced in the alpm-db-descv2 specification.
§Errors
Returns an error if:
- any required field is missing,
- a section appears more than once,
- or the
%XDATA%section is missing or malformed.