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)
| 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. |
| 305 | fn 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 | /// |
no test coverage detected