pub struct PkgReader<R: Read + Seek + Sized + Debug> { /* private fields */ }
Expand description
Read-only interface to a single flat package XAR archive.
Implementations§
Source§impl<R: Read + Seek + Sized + Debug> PkgReader<R>
impl<R: Read + Seek + Sized + Debug> PkgReader<R>
Sourcepub fn new(reader: R) -> PkgResult<Self>
pub fn new(reader: R) -> PkgResult<Self>
Construct an instance from a reader.
The reader will read the contents of a XAR archive. This is likely
a .pkg
file.
Sourcepub fn into_inner(self) -> XarReader<R>
pub fn into_inner(self) -> XarReader<R>
Return the inner reader, consuming self.
Sourcepub fn distribution(&mut self) -> PkgResult<Option<Distribution>>
pub fn distribution(&mut self) -> PkgResult<Option<Distribution>>
Obtain the parsed Distribution
XML file describing the installer.
Not all flat packages have a Distribution
file, so this may resolve to
None
.
Sourcepub fn resolve_component(
&mut self,
path_prefix: &str,
) -> PkgResult<Option<ComponentPackageReader>>
pub fn resolve_component( &mut self, path_prefix: &str, ) -> PkgResult<Option<ComponentPackageReader>>
Attempt to resolve a component given a path prefix.
If a component is found under a given path, Some
is returned. Otherwise
None
is returned.
Pass in ""
to resolve the root component.
A found component is defined by the presence of 1 or more well-known files
in components (Bom
, PackageInfo
, Payload
, etc).
Sourcepub fn root_component(&mut self) -> PkgResult<Option<ComponentPackageReader>>
pub fn root_component(&mut self) -> PkgResult<Option<ComponentPackageReader>>
Obtain the root component in this installer.
The root component is defined as a a collection of Bom
, PackageInfo
,
Payload
, and Scripts
files at the root directory of the XAR archive
this instance was constructed from.
This will likely resolve to None
for *product packagesand
Some`
for component packages.
Sourcepub fn component_packages(&mut self) -> PkgResult<Vec<ComponentPackageReader>>
pub fn component_packages(&mut self) -> PkgResult<Vec<ComponentPackageReader>>
Obtain component package instances in this flat package.
This looks for .pkg
directories in the root directory of the XAR archive
and resolves a ComponentPackageReader for each. If there are no .pkg
directories, this will return an empty vec.
Generally, this function will return something for product packages whereas [root_component()] will return something for component packages.