MCPcopy Create free account
hub / github.com/archlinux/alpm / metadata

Method metadata

alpm-package/src/package.rs:836–858  ·  view source on GitHub ↗

Reads all metadata from an [alpm-package] file. This method reads all the metadata entries in the package file and returns a [`Metadata`] struct containing the processed data. # Errors Returns an error if - reading the metadata entries fails, - parsing a metadata entry fails, - or if any of the required metadata files are not found in the package. [alpm-package]: https://alpm.archlinux.page/s

(&mut self)

Source from the content-addressed store, hash-verified

834 ///
835 /// [alpm-package]: https://alpm.archlinux.page/specifications/alpm-package.7.html
836 pub fn metadata(&mut self) -> Result<Metadata, crate::Error> {
837 let mut pkginfo = None;
838 let mut buildinfo = None;
839 let mut mtree = None;
840 for entry in self.metadata_entries()? {
841 match entry? {
842 MetadataEntry::PackageInfo(m) => pkginfo = Some(m),
843 MetadataEntry::BuildInfo(m) => buildinfo = Some(m),
844 MetadataEntry::Mtree(m) => mtree = Some(m),
845 }
846 }
847 Ok(Metadata {
848 pkginfo: pkginfo.ok_or(crate::Error::MetadataFileNotFound {
849 name: MetadataFileName::PackageInfo,
850 })?,
851 buildinfo: buildinfo.ok_or(crate::Error::MetadataFileNotFound {
852 name: MetadataFileName::BuildInfo,
853 })?,
854 mtree: mtree.ok_or(crate::Error::MetadataFileNotFound {
855 name: MetadataFileName::Mtree,
856 })?,
857 })
858 }
859
860 /// Reads the data of a specific metadata file from the [alpm-package] file.
861 ///

Callers 7

newMethod · 0.80
newMethod · 0.80
read_package_contentsFunction · 0.80
path_metadataFunction · 0.80
collect_filesFunction · 0.80
run_bridge_scriptFunction · 0.80
detectMethod · 0.80

Calls 1

metadata_entriesMethod · 0.80

Tested by 1

read_package_contentsFunction · 0.64