pub struct Package {
file_name: PackageFileName,
parent_dir: ExistingAbsoluteDir,
}Expand description
An alpm-package file.
Tracks the PackageFileName of the alpm-package as well as its absolute parent_dir.
Fields§
§file_name: PackageFileName§parent_dir: ExistingAbsoluteDirImplementations§
Source§impl Package
impl Package
Sourcepub fn new(
file_name: PackageFileName,
parent_dir: ExistingAbsoluteDir,
) -> Result<Self, Error>
pub fn new( file_name: PackageFileName, parent_dir: ExistingAbsoluteDir, ) -> Result<Self, Error>
Sourcepub fn to_path_buf(&self) -> PathBuf
pub fn to_path_buf(&self) -> PathBuf
Returns the absolute path of the Package.
Sourcepub fn read_pkginfo(&self) -> Result<PackageInfo, Error>
pub fn read_pkginfo(&self) -> Result<PackageInfo, Error>
Returns the PackageInfo of the package.
This is a convenience wrapper around PackageReader::read_metadata_file.
§Errors
Returns an error if
- a
PackageReadercannot be created for the package, - the package does not contain a PKGINFO file,
- or the PKGINFO file in the package is not valid.
Sourcepub fn read_buildinfo(&self) -> Result<BuildInfo, Error>
pub fn read_buildinfo(&self) -> Result<BuildInfo, Error>
Returns the BuildInfo of the package.
This is a convenience wrapper around PackageReader::read_metadata_file.
§Errors
Returns an error if
- a
PackageReadercannot be created for the package, - the package does not contain a BUILDINFO file,
- or the BUILDINFO file in the package is not valid.
Sourcepub fn read_mtree(&self) -> Result<Mtree, Error>
pub fn read_mtree(&self) -> Result<Mtree, Error>
Returns the Mtree of the package.
This is a convenience wrapper around PackageReader::read_metadata_file.
§Errors
Returns an error if
- a
PackageReadercannot be created for the package, - the package does not contain a ALPM-MTREE file,
- or the ALPM-MTREE file in the package is not valid.
Sourcepub fn read_install_scriptlet(&self) -> Result<Option<String>, Error>
pub fn read_install_scriptlet(&self) -> Result<Option<String>, Error>
Returns the contents of the optional alpm-install-scriptlet of the package.
Returns None if the package does not contain an alpm-install-scriptlet file.
§Errors
Returns an error if
- a
PackageReadercannot be created for the package, - or reading the entries using
PackageReader::metadata_entries.
Sourcepub fn into_reader<'c>(self) -> Result<PackageReader<'c>, Error>
pub fn into_reader<'c>(self) -> Result<PackageReader<'c>, Error>
Creates a PackageReader for the package.
Convenience wrapper for PackageReader::try_from.
§Errors
Returns an error if self cannot be converted into a PackageReader.
Trait Implementations§
Source§impl TryFrom<&PackageCreationConfig> for Package
impl TryFrom<&PackageCreationConfig> for Package
Source§fn try_from(value: &PackageCreationConfig) -> Result<Self, Self::Error>
fn try_from(value: &PackageCreationConfig) -> Result<Self, Self::Error>
Creates a new Package from a PackageCreationConfig.
Before creating a Package, guarantees the on-disk file consistency with the
help of available Mtree data.
§Errors
Returns an error if
- creating a
TarballBuilderfails, - creating a compressed or uncompressed package file fails,
- validating any of the paths using ALPM-MTREE data (available through
value) fails, - appending files to a compressed or uncompressed package file fails,
- finishing a compressed or uncompressed package file fails,
- or creating a
Packagefails.