pub struct PackageInput {
build_info: BuildInfo,
package_info: PackageInfo,
mtree: Mtree,
mtree_digest: Sha256Checksum,
input_dir: InputDir,
scriptlet: Option<PathBuf>,
relative_paths: Vec<PathBuf>,
}
Expand description
A package input directory.
An input directory must contain
- a valid ALPM-MTREE file,
- a valid BUILDINFO file,
- a valid PKGINFO file,
Further, the input directory may contain an alpm-install-scriptlet file and zero or more package data files (see alpm-package).
Fields§
§build_info: BuildInfo
§package_info: PackageInfo
§mtree: Mtree
§mtree_digest: Sha256Checksum
§input_dir: InputDir
§scriptlet: Option<PathBuf>
§relative_paths: Vec<PathBuf>
Implementations§
Source§impl PackageInput
impl PackageInput
Sourcepub fn input_dir(&self) -> &Path
pub fn input_dir(&self) -> &Path
Returns the input directory of the PackageInput
as Path
reference.
Sourcepub fn build_info(&self) -> &BuildInfo
pub fn build_info(&self) -> &BuildInfo
Returns a reference to the BuildInfo
data of the PackageInput
.
§Note
The BuildInfo
data relates directly to an on-disk file tracked by the
PackageInput
. This method provides access to the data as present during the creation
of the PackageInput
. While the data can be guaranteed to be correct, the on-disk
file may have changed between creation of the PackageInput
and the call of this method.
Sourcepub fn package_info(&self) -> &PackageInfo
pub fn package_info(&self) -> &PackageInfo
Returns a reference to the PackageInfo
data of the PackageInput
.
§Note
The PackageInfo
data relates directly to an on-disk file tracked by the
PackageInput
. This method provides access to the data as present during the creation
of the PackageInput
. While the data can be guaranteed to be correct, the on-disk
file may have changed between creation of the PackageInput
and the call of this method.
Sourcepub fn mtree(&self) -> Result<&Mtree, Error>
pub fn mtree(&self) -> Result<&Mtree, Error>
Returns a reference to the Mtree
data of the PackageInput
.
Compares the stored hash digest of the file with that of the file on disk.
§Errors
Returns an error if
- the file on disk can no longer be read,
- or the file on disk has a changed hash digest.
Sourcepub fn install_scriptlet(&self) -> Option<&Path>
pub fn install_scriptlet(&self) -> Option<&Path>
Returns the optional alpm-install-scriptlet of the PackageInput
as Path
reference.
§Note
The alpm-install-scriptlet path relates directly to an on-disk file tracked by the
PackageInput
. This method provides access to the data as present during the creation
of the PackageInput
. While the data can be guaranteed to be correct, the on-disk
file may have changed between creation of the PackageInput
and the call of this method.
Sourcepub fn relative_paths(&self) -> &[PathBuf]
pub fn relative_paths(&self) -> &[PathBuf]
Returns all paths relative to the PackageInput
’s input directory.
Sourcepub fn input_paths(&self) -> Result<InputPaths<'_, '_>, Error>
pub fn input_paths(&self) -> Result<InputPaths<'_, '_>, Error>
Returns an InputPaths
for the input directory and all relative paths contained in it.
Trait Implementations§
Source§impl Clone for PackageInput
impl Clone for PackageInput
Source§fn clone(&self) -> PackageInput
fn clone(&self) -> PackageInput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PackageInput
impl Debug for PackageInput
Source§impl TryFrom<InputDir> for PackageInput
impl TryFrom<InputDir> for PackageInput
Source§fn try_from(value: InputDir) -> Result<Self, Self::Error>
fn try_from(value: InputDir) -> Result<Self, Self::Error>
Creates a PackageInput
from input directory path
.
This function reads ALPM-MTREE, BUILDINFO and PKGINFO files in path
, collects the
path of an existing alpm-install-scriptlet and validates them.
All data files below path
are then checked against the ALPM-MTREE data.
§Errors
Returns an error if
value
is not a validInputDir
,- there is no valid BUILDINFO file,
- there is no valid ALPM-MTREE file,
- there is no valid PKGINFO file,
- or one of the files below
dir
does not match the ALPM-MTREE data.