RepoDescFileV1

Struct RepoDescFileV1 

Source
pub struct RepoDescFileV1 {
Show 23 fields pub file_name: PackageFileName, pub name: Name, pub base: PackageBaseName, pub version: FullVersion, pub description: PackageDescription, pub groups: Vec<Group>, pub compressed_size: CompressedSize, pub installed_size: InstalledSize, pub md5_checksum: Md5Checksum, pub sha256_checksum: Sha256Checksum, pub pgp_signature: Base64OpenPGPSignature, pub url: Option<Url>, pub license: Vec<License>, pub arch: Architecture, pub build_date: BuildDate, pub packager: Packager, pub replaces: Vec<PackageRelation>, pub conflicts: Vec<PackageRelation>, pub provides: Vec<RelationOrSoname>, pub dependencies: Vec<RelationOrSoname>, pub optional_dependencies: Vec<OptionalDependency>, pub make_dependencies: Vec<PackageRelation>, pub check_dependencies: Vec<PackageRelation>,
}
Expand description

Representation of files following the alpm-repo-descv1 specification.

This file format is used to describe a single package entry within an alpm-repo-db.

It includes information such as the package’s name, version, architecture, and dependency relationships.

§Examples

use std::str::FromStr;

use alpm_repo_db::desc::RepoDescFileV1;

let desc_data = r#"%FILENAME%
example-meta-1.0.0-1-any.pkg.tar.zst

%NAME%
example-meta

%BASE%
example-meta

%VERSION%
1.0.0-1

%DESC%
An example meta package

%CSIZE%
4634

%ISIZE%
0

%MD5SUM%
d3b07384d113edec49eaa6238ad5ff00

%SHA256SUM%
b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c

%PGPSIG%
iHUEABYKAB0WIQRizHP4hOUpV7L92IObeih9mi7GCAUCaBZuVAAKCRCbeih9mi7GCIlMAP9ws/jU4f580ZRQlTQKvUiLbAZOdcB7mQQj83hD1Nc/GwD/WIHhO1/OQkpMERejUrLo3AgVmY3b4/uGhx9XufWEbgE=

%URL%
https://example.org/

%LICENSE%
GPL-3.0-or-later

%ARCH%
any

%BUILDDATE%
1729181726

%PACKAGER%
Foobar McFooface <foobar@mcfooface.org>

"#;

// Parse a REPO DESC file in version 1 format.
let repo_desc = RepoDescFileV1::from_str(desc_data)?;
// Convert back to its canonical string representation.
assert_eq!(repo_desc.to_string(), desc_data);

Fields§

§file_name: PackageFileName

The file name of the package.

§name: Name

The name of the package.

§base: PackageBaseName

The name of the package base, from which this package originates.

§version: FullVersion

The version of the package.

§description: PackageDescription

The description of the package.

Can be 0 or more characters.

§groups: Vec<Group>

The groups this package belongs to.

If the package does not belong to any group, this will be an empty list.

§compressed_size: CompressedSize

The compressed size of the package in bytes.

§installed_size: InstalledSize

The size of the uncompressed and unpacked package contents in bytes.

Multiple hard-linked files are only counted once.

§md5_checksum: Md5Checksum

The MD5 checksum of the package file.

§sha256_checksum: Sha256Checksum

The SHA256 checksum of the package file.

§pgp_signature: Base64OpenPGPSignature

The base64 encoded OpenPGP detached signature of the package file.

§url: Option<Url>

The optional URL associated with the package.

§license: Vec<License>

Set of licenses under which the package is distributed.

Can be empty.

§arch: Architecture

The architecture of the package.

§build_date: BuildDate

The date at wchich the build of the package started.

§packager: Packager

The User ID of the entity, that built the package.

§replaces: Vec<PackageRelation>

Virtual components or packages that this package replaces upon installation.

Can be empty.

§conflicts: Vec<PackageRelation>

Virtual components or packages that this package conflicts with.

Can be empty.

§provides: Vec<RelationOrSoname>

Virtual components or packages that this package provides.

Can be empty.

§dependencies: Vec<RelationOrSoname>

Run-time dependencies required by the package.

Can be empty.

§optional_dependencies: Vec<OptionalDependency>

Optional dependencies that are not strictly required by the package.

Can be empty.

§make_dependencies: Vec<PackageRelation>

Dependencies for building the upstream software of the package.

Can be empty.

§check_dependencies: Vec<PackageRelation>

A dependency for running tests of the package’s upstream project.

Can be empty.

Trait Implementations§

Source§

impl Clone for RepoDescFileV1

Source§

fn clone(&self) -> RepoDescFileV1

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RepoDescFileV1

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RepoDescFileV1

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for RepoDescFileV1

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
Source§

impl From<RepoDescFileV1> for RepoDescFileV2

Source§

fn from(v1: RepoDescFileV1) -> Self

Converts a RepoDescFileV1 into a RepoDescFileV2.

§Note

This drops the md5_checksum field of the RepoDescFileV1.

Source§

impl FromStr for RepoDescFileV1

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Creates a RepoDescFileV1 from a string slice.

Parses the input according to the alpm-repo-descv1 specification and constructs a structured RepoDescFileV1 representation.

§Examples
use std::str::FromStr;

use alpm_repo_db::desc::RepoDescFileV1;

let desc_data = r#"%FILENAME%
example-meta-1.0.0-1-any.pkg.tar.zst

%NAME%
example-meta

%BASE%
example-meta

%VERSION%
1.0.0-1

%DESC%
An example meta package

%CSIZE%
4634

%ISIZE%
0

%MD5SUM%
d3b07384d113edec49eaa6238ad5ff00

%SHA256SUM%
b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c

%PGPSIG%
iHUEABYKAB0WIQRizHP4hOUpV7L92IObeih9mi7GCAUCaBZuVAAKCRCbeih9mi7GCIlMAP9ws/jU4f580ZRQlTQKvUiLbAZOdcB7mQQj83hD1Nc/GwD/WIHhO1/OQkpMERejUrLo3AgVmY3b4/uGhx9XufWEbgE=

%URL%
https://example.org/

%LICENSE%
GPL-3.0-or-later

%ARCH%
any

%BUILDDATE%
1729181726

%PACKAGER%
Foobar McFooface <foobar@mcfooface.org>

"#;

let repo_desc = RepoDescFileV1::from_str(desc_data)?;
assert_eq!(repo_desc.name.to_string(), "example-meta");
§Errors

Returns an error if:

  • the input cannot be parsed into valid sections,
  • or required fields are missing or malformed.
Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl PartialEq for RepoDescFileV1

Source§

fn eq(&self, other: &RepoDescFileV1) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for RepoDescFileV1

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<Vec<Section>> for RepoDescFileV1

Source§

fn try_from(sections: Vec<Section>) -> Result<Self, Self::Error>

Tries to create a RepoDescFileV1 from a list of parsed Sections.

§Errors

Returns an error if:

  • any required field is missing,
  • a section appears more than once,
  • or a section violates the expected format for version 1.
Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl StructuralPartialEq for RepoDescFileV1

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,