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

Function get_package_info

alpm-package/src/input.rs:305–311  ·  view source on GitHub ↗

Returns a [`PackageInfo`] from a PKGINFO file in an input directory. # Errors Returns an error if - the file does not exist, - the file contents cannot be read to a buffer, - the hash digest of the file does not match that initially recorded in `mtree`, - or the file contents do not represent valid [`PackageInfo`] data.

(input_dir: &InputDir, mtree: &Mtree)

Source from the content-addressed store, hash-verified

303/// - the hash digest of the file does not match that initially recorded in `mtree`,
304/// - or the file contents do not represent valid [`PackageInfo`] data.
305fn get_package_info(input_dir: &InputDir, mtree: &Mtree) -> Result<PackageInfo, crate::Error> {
306 debug!("Check that a valid PKGINFO file exists in {input_dir:?}.");
307
308 let (_path, buf) = compare_digests(mtree, input_dir, MetadataFileName::PackageInfo.as_ref())?;
309
310 PackageInfo::from_reader(buf.as_slice()).map_err(crate::Error::AlpmPackageInfo)
311}
312
313/// Returns an [`Mtree`] and its file hash digest.
314///

Callers 1

try_fromMethod · 0.85

Calls 2

compare_digestsFunction · 0.85
as_refMethod · 0.45

Tested by

no test coverage detected