Struct DebPackage

Source
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

Source

pub fn new(name: &str) -> Self

Creates a new DebPackage with name as it’s name.

Source

pub fn from<R: Read>(input: R) -> Result<Self>

Reads a DebPackage from input.

Source

pub fn set_name(self, name: &str) -> Self

Sets the package’s name.

Source

pub fn set_version(self, version: &str) -> Self

Sets the package’s version.

Source

pub fn set_priority(self, priority: DebPriority) -> Self

Sets the package’s priority.

Source

pub fn set_architecture(self, architecture: DebArchitecture) -> Self

Sets the package’s architecture.

Source

pub fn set_essential(self, essential: bool) -> Self

Sets whether the package is essential.

Source

pub fn with_depend(self, depend: &str) -> Self

Adds a single dependency from &str.

Source

pub fn with_depends(self, depends: Vec<&str>) -> Self

Adds a number of dependencies from Vec<&str>.

Source

pub fn no_depends(self) -> Self

Resets dependencies.

Source

pub fn with_pre_depend(self, depend: &str) -> Self

Adds a single pre-dependency from &str.

Source

pub fn with_pre_depends(self, depends: Vec<&str>) -> Self

Adds a number of pre-dependencies from Vec<&str>.

Source

pub fn no_pre_depends(self) -> Self

Resets pre-dependencies.

Source

pub fn with_recommend(self, recommend: &str) -> Self

Adds a single recommend from &str.

Source

pub fn with_recommends(self, recommends: Vec<&str>) -> Self

Adds a number of recommends from Vec<&str>.

Source

pub fn no_recommends(self) -> Self

Resets recommends.

Source

pub fn with_suggest(self, suggest: &str) -> Self

Adds a single suggest from &str.

Source

pub fn with_suggests(self, suggests: Vec<&str>) -> Self

Adds a number of suggests from Vec<&str>.

Source

pub fn no_suggests(self) -> Self

Resets suggests.

Source

pub fn with_break(self, conflict: &str) -> Self

Adds a single break from &str.

Source

pub fn with_breaks(self, conflicts: Vec<&str>) -> Self

Adds a number of breaks from Vec<&str>.

Source

pub fn no_breaks(self) -> Self

Resets breaks.

Source

pub fn with_conflict(self, conflict: &str) -> Self

Adds a single conflict from &str.

Source

pub fn with_conflicts(self, conflicts: Vec<&str>) -> Self

Adds a number of conflicts from Vec<&str>.

Source

pub fn no_conflicts(self) -> Self

Resets conflicts.

Source

pub fn with_provide(self, provide: &str) -> Self

Adds a single provide from &str.

Source

pub fn with_provides(self, provides: Vec<&str>) -> Self

Adds a number of provides from Vec<&str>.

Source

pub fn no_provides(self) -> Self

Resets provides.

Source

pub fn with_replace(self, replace: &str) -> Self

Adds a single replace from &str.

Source

pub fn with_replaces(self, replaces: Vec<&str>) -> Self

Adds a number of replaces from Vec<&str>.

Source

pub fn no_replaces(self) -> Self

Resets replaces.

Source

pub fn with_enhance(self, enhance: &str) -> Self

Adds a single enhance from &str.

Source

pub fn with_enhances(self, enhances: Vec<&str>) -> Self

Adds a number of enhances from Vec<&str>.

Source

pub fn no_enhances(self) -> Self

Resets enhances.

Source

pub fn set_maintainer(self, maintainer: &str) -> Self

Sets the package’s maintainer.

Source

pub fn set_description(self, description: &str) -> Self

Sets the package’s description.

Source

pub fn set_homepage(self, homepage: &str) -> Self

Sets the package’s homepage.

Source

pub fn with_built_using(self, using: &str, version: &str) -> Self

Adds a “built using” package.

Source

pub fn no_built_using(self) -> Self

Resets built-using.

Source

pub fn with_file(self, file: DebFile) -> Self

Adds a file to the package.

Source

pub fn with_dir<P>(self, from: P, to: P) -> Result<Self>
where P: AsRef<Path>,

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();
Source

pub fn clear_files(self) -> Self

Removes all file’s from the package.

Source

pub fn config_from_str(self, script: &str) -> Self

Sets config script from &str.

Source

pub fn config_from_buf(self, script: Vec<u8>) -> Self

Sets config script from Vec.

Source

pub fn no_config(self) -> Self

Resets config script.

Source

pub fn preinst_from_str(self, script: &str) -> Self

Sets preinst script from &str.

Source

pub fn preinst_from_buf(self, script: Vec<u8>) -> Self

Sets preinst script from Vec.

Source

pub fn no_preinst(self) -> Self

Resets preinst script.

Source

pub fn postinst_from_str(self, script: &str) -> Self

Sets postinst script from &str.

Source

pub fn postinst_from_buf(self, script: Vec<u8>) -> Self

Sets postinst script from Vec.

Source

pub fn no_postinst(self) -> Self

Resets postinst script.

Source

pub fn prerm_from_str(self, script: &str) -> Self

Sets prerm script from &str.

Source

pub fn prerm_from_buf(self, script: Vec<u8>) -> Self

Sets prerm script from Vec.

Source

pub fn no_prerm(self) -> Self

Resets prerm script.

Source

pub fn postrm_from_str(self, script: &str) -> Self

Sets postrm script from &str.

Source

pub fn postrm_from_buf(self, script: Vec<u8>) -> Self

Sets postrm script from Vec.

Source

pub fn no_postrm(self) -> Self

Resets postrm script.

Source

pub fn set_compression(self, compression: DebCompression) -> Self

Sets the package’s compression standard.

Source

pub fn name(&self) -> &str

Returns the package’s name.

Source

pub fn version(&self) -> &str

Returns the package’s version.

Source

pub fn priority(&self) -> &DebPriority

Returns the package’s priority.

Source

pub fn architecture(&self) -> &DebArchitecture

Returns the package’s architecture.

Source

pub fn essential(&self) -> bool

Returns whether the package is essential.

Source

pub fn depends(&self) -> &Vec<String>

Returns the package’s depends.

Source

pub fn pre_depends(&self) -> &Vec<String>

Returns the package’s pre-depends.

Source

pub fn recommends(&self) -> &Vec<String>

Returns the package’s recommends.

Source

pub fn suggests(&self) -> &Vec<String>

Returns the package’s suggests.

Source

pub fn breaks(&self) -> &Vec<String>

Returns the package’s breaks.

Source

pub fn conflicts(&self) -> &Vec<String>

Returns the package’s conflicts.

Source

pub fn provides(&self) -> &Vec<String>

Returns the package’s provides.

Source

pub fn replaces(&self) -> &Vec<String>

Returns the package’s replaces.

Source

pub fn enhances(&self) -> &Vec<String>

Returns the package’s enhances.

Source

pub fn maintainer(&self) -> &str

Returns the package’s maintainer.

Source

pub fn description(&self) -> &str

Returns the package’s description.

Source

pub fn homepage(&self) -> &str

Returns the package’s homepage.

Source

pub fn built_using(&self) -> &Vec<[String; 2]>

Returns the packages this package was built with.

Source

pub fn files(&self) -> &Vec<DebFile>

Returns a vector of the packages files.

Source

pub fn config(&self) -> Option<&Vec<u8>>

Returns the package’s config script.

Source

pub fn preinst(&self) -> Option<&Vec<u8>>

Returns the package’s preinst script.

Source

pub fn postinst(&self) -> Option<&Vec<u8>>

Returns the package’s postinst script.

Source

pub fn prerm(&self) -> Option<&Vec<u8>>

Returns the package’s prerm script.

Source

pub fn postrm(&self) -> Option<&Vec<u8>>

Returns the package’s postrm script.

Source

pub fn compression(&self) -> &DebCompression

Returns the package’s compression standard.

Source

pub fn build(&self) -> Result<DebArchive>

Builds the package into a DebArchive struct.

Trait Implementations§

Source§

impl Debug for DebPackage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.