pub struct DebPackage { /* private fields */ }
Expand description
A high-level structure representing a Deb package.
For binary package’s, it may be helpful to read Debian’s documentation on binary packages’ metadata.
As well, you can read Debian’s definition for the package’s maintainer scripts.
Implementations§
Source§impl DebPackage
impl DebPackage
Sourcepub fn set_version(self, version: &str) -> Self
pub fn set_version(self, version: &str) -> Self
Sets the package’s version.
Sourcepub fn set_priority(self, priority: DebPriority) -> Self
pub fn set_priority(self, priority: DebPriority) -> Self
Sets the package’s priority.
Sourcepub fn set_architecture(self, architecture: DebArchitecture) -> Self
pub fn set_architecture(self, architecture: DebArchitecture) -> Self
Sets the package’s architecture.
Sourcepub fn set_essential(self, essential: bool) -> Self
pub fn set_essential(self, essential: bool) -> Self
Sets whether the package is essential.
Sourcepub fn with_depend(self, depend: &str) -> Self
pub fn with_depend(self, depend: &str) -> Self
Adds a single dependency from &str.
Sourcepub fn with_depends(self, depends: Vec<&str>) -> Self
pub fn with_depends(self, depends: Vec<&str>) -> Self
Adds a number of dependencies from Vec<&str>.
Sourcepub fn no_depends(self) -> Self
pub fn no_depends(self) -> Self
Resets dependencies.
Sourcepub fn with_pre_depend(self, depend: &str) -> Self
pub fn with_pre_depend(self, depend: &str) -> Self
Adds a single pre-dependency from &str.
Sourcepub fn with_pre_depends(self, depends: Vec<&str>) -> Self
pub fn with_pre_depends(self, depends: Vec<&str>) -> Self
Adds a number of pre-dependencies from Vec<&str>.
Sourcepub fn no_pre_depends(self) -> Self
pub fn no_pre_depends(self) -> Self
Resets pre-dependencies.
Sourcepub fn with_recommend(self, recommend: &str) -> Self
pub fn with_recommend(self, recommend: &str) -> Self
Adds a single recommend from &str.
Sourcepub fn with_recommends(self, recommends: Vec<&str>) -> Self
pub fn with_recommends(self, recommends: Vec<&str>) -> Self
Adds a number of recommends from Vec<&str>.
Sourcepub fn no_recommends(self) -> Self
pub fn no_recommends(self) -> Self
Resets recommends.
Sourcepub fn with_suggest(self, suggest: &str) -> Self
pub fn with_suggest(self, suggest: &str) -> Self
Adds a single suggest from &str.
Sourcepub fn with_suggests(self, suggests: Vec<&str>) -> Self
pub fn with_suggests(self, suggests: Vec<&str>) -> Self
Adds a number of suggests from Vec<&str>.
Sourcepub fn no_suggests(self) -> Self
pub fn no_suggests(self) -> Self
Resets suggests.
Sourcepub fn with_break(self, conflict: &str) -> Self
pub fn with_break(self, conflict: &str) -> Self
Adds a single break from &str.
Sourcepub fn with_breaks(self, conflicts: Vec<&str>) -> Self
pub fn with_breaks(self, conflicts: Vec<&str>) -> Self
Adds a number of breaks from Vec<&str>.
Sourcepub fn with_conflict(self, conflict: &str) -> Self
pub fn with_conflict(self, conflict: &str) -> Self
Adds a single conflict from &str.
Sourcepub fn with_conflicts(self, conflicts: Vec<&str>) -> Self
pub fn with_conflicts(self, conflicts: Vec<&str>) -> Self
Adds a number of conflicts from Vec<&str>.
Sourcepub fn no_conflicts(self) -> Self
pub fn no_conflicts(self) -> Self
Resets conflicts.
Sourcepub fn with_provide(self, provide: &str) -> Self
pub fn with_provide(self, provide: &str) -> Self
Adds a single provide from &str.
Sourcepub fn with_provides(self, provides: Vec<&str>) -> Self
pub fn with_provides(self, provides: Vec<&str>) -> Self
Adds a number of provides from Vec<&str>.
Sourcepub fn no_provides(self) -> Self
pub fn no_provides(self) -> Self
Resets provides.
Sourcepub fn with_replace(self, replace: &str) -> Self
pub fn with_replace(self, replace: &str) -> Self
Adds a single replace from &str.
Sourcepub fn with_replaces(self, replaces: Vec<&str>) -> Self
pub fn with_replaces(self, replaces: Vec<&str>) -> Self
Adds a number of replaces from Vec<&str>.
Sourcepub fn no_replaces(self) -> Self
pub fn no_replaces(self) -> Self
Resets replaces.
Sourcepub fn with_enhance(self, enhance: &str) -> Self
pub fn with_enhance(self, enhance: &str) -> Self
Adds a single enhance from &str.
Sourcepub fn with_enhances(self, enhances: Vec<&str>) -> Self
pub fn with_enhances(self, enhances: Vec<&str>) -> Self
Adds a number of enhances from Vec<&str>.
Sourcepub fn no_enhances(self) -> Self
pub fn no_enhances(self) -> Self
Resets enhances.
Sourcepub fn set_maintainer(self, maintainer: &str) -> Self
pub fn set_maintainer(self, maintainer: &str) -> Self
Sets the package’s maintainer.
Sourcepub fn set_description(self, description: &str) -> Self
pub fn set_description(self, description: &str) -> Self
Sets the package’s description.
Sourcepub fn set_homepage(self, homepage: &str) -> Self
pub fn set_homepage(self, homepage: &str) -> Self
Sets the package’s homepage.
Sourcepub fn with_built_using(self, using: &str, version: &str) -> Self
pub fn with_built_using(self, using: &str, version: &str) -> Self
Adds a “built using” package.
Sourcepub fn no_built_using(self) -> Self
pub fn no_built_using(self) -> Self
Resets built-using.
Sourcepub fn with_dir<P>(self, from: P, to: P) -> Result<Self>
pub fn with_dir<P>(self, from: P, to: P) -> Result<Self>
Recursively adds directory from
to package as to
.
This adds all files and sub-directories to to
. For example, if you
had a directory test
containing the files foo
and bar
, then
you can add those files as /usr/bin/foo
and /usr/bin/bar
with
with_dir("test", "/usr/bin")?;
This function isn’t available when compiling on Windows, as it’s utility relies on being able to read the modes of the directory’s children, which is a feature Windows lacks.
§Errors
This function may return an error if from
doesn’t exist.
§Example
use deb_rust::binary::DebPackage;
let mut package = DebPackage::new("example")
.with_dir("test", "/usr/bin").unwrap();
Sourcepub fn clear_files(self) -> Self
pub fn clear_files(self) -> Self
Removes all file’s from the package.
Sourcepub fn config_from_str(self, script: &str) -> Self
pub fn config_from_str(self, script: &str) -> Self
Sets config script from &str.
Sourcepub fn config_from_buf(self, script: Vec<u8>) -> Self
pub fn config_from_buf(self, script: Vec<u8>) -> Self
Sets config script from Vec
Sourcepub fn preinst_from_str(self, script: &str) -> Self
pub fn preinst_from_str(self, script: &str) -> Self
Sets preinst script from &str.
Sourcepub fn preinst_from_buf(self, script: Vec<u8>) -> Self
pub fn preinst_from_buf(self, script: Vec<u8>) -> Self
Sets preinst script from Vec
Sourcepub fn no_preinst(self) -> Self
pub fn no_preinst(self) -> Self
Resets preinst script.
Sourcepub fn postinst_from_str(self, script: &str) -> Self
pub fn postinst_from_str(self, script: &str) -> Self
Sets postinst script from &str.
Sourcepub fn postinst_from_buf(self, script: Vec<u8>) -> Self
pub fn postinst_from_buf(self, script: Vec<u8>) -> Self
Sets postinst script from Vec
Sourcepub fn no_postinst(self) -> Self
pub fn no_postinst(self) -> Self
Resets postinst script.
Sourcepub fn prerm_from_str(self, script: &str) -> Self
pub fn prerm_from_str(self, script: &str) -> Self
Sets prerm script from &str.
Sourcepub fn prerm_from_buf(self, script: Vec<u8>) -> Self
pub fn prerm_from_buf(self, script: Vec<u8>) -> Self
Sets prerm script from Vec
Sourcepub fn postrm_from_str(self, script: &str) -> Self
pub fn postrm_from_str(self, script: &str) -> Self
Sets postrm script from &str.
Sourcepub fn postrm_from_buf(self, script: Vec<u8>) -> Self
pub fn postrm_from_buf(self, script: Vec<u8>) -> Self
Sets postrm script from Vec
Sourcepub fn set_compression(self, compression: DebCompression) -> Self
pub fn set_compression(self, compression: DebCompression) -> Self
Sets the package’s compression standard.
Sourcepub fn priority(&self) -> &DebPriority
pub fn priority(&self) -> &DebPriority
Returns the package’s priority.
Sourcepub fn architecture(&self) -> &DebArchitecture
pub fn architecture(&self) -> &DebArchitecture
Returns the package’s architecture.
Sourcepub fn pre_depends(&self) -> &Vec<String>
pub fn pre_depends(&self) -> &Vec<String>
Returns the package’s pre-depends.
Sourcepub fn recommends(&self) -> &Vec<String>
pub fn recommends(&self) -> &Vec<String>
Returns the package’s recommends.
Sourcepub fn maintainer(&self) -> &str
pub fn maintainer(&self) -> &str
Returns the package’s maintainer.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Returns the package’s description.
Sourcepub fn built_using(&self) -> &Vec<[String; 2]>
pub fn built_using(&self) -> &Vec<[String; 2]>
Returns the packages this package was built with.
Sourcepub fn compression(&self) -> &DebCompression
pub fn compression(&self) -> &DebCompression
Returns the package’s compression standard.
Sourcepub fn build(&self) -> Result<DebArchive>
pub fn build(&self) -> Result<DebArchive>
Builds the package into a DebArchive struct.