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

Function get_install_scriptlet

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

Returns whether an [alpm-install-scriptlet] exists in an input directory. # Errors Returns an error if - 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 [alpm-install-scriptlet] data. [alpm-install-scriptlet]: https://alpm.archlinux.page/specifications/alpm-install-scrip

(
    input_dir: &InputDir,
    mtree: &Mtree,
)

Source from the content-addressed store, hash-verified

257///
258/// [alpm-install-scriptlet]: https://alpm.archlinux.page/specifications/alpm-install-scriptlet.5.html
259fn get_install_scriptlet(
260 input_dir: &InputDir,
261 mtree: &Mtree,
262) -> Result<Option<PathBuf>, crate::Error> {
263 debug!("Check that an alpm-install-scriptlet is valid if it exists in {input_dir:?}.");
264
265 let path = match compare_digests(mtree, input_dir, INSTALL_SCRIPTLET_FILE_NAME) {
266 Err(crate::Error::Input(Error::FileIsMissing { .. })) => return Ok(None),
267 Err(error) => return Err(error),
268 Ok((path, _buf)) => path,
269 };
270
271 // Validate the scriptlet.
272 check_scriptlet(&path)?;
273
274 Ok(Some(path))
275}
276
277/// Returns a [`BuildInfo`] from a BUILDINFO file in an input directory.
278///

Callers 1

try_fromMethod · 0.85

Calls 2

compare_digestsFunction · 0.85
check_scriptletFunction · 0.85

Tested by

no test coverage detected