Crate cargo_deb [−] [src]
Making deb packages
If you only want to make some *.deb
files, and you're not a developer of tools
for Debian packaging, see cargo deb
command usage described in the
README instead.
cargo install cargo-deb
cargo deb # run this in your Cargo project directory
Making tools for making deb packages
The library interface is experimental. See main.rs
for usage.
ⓘThis example is not tested
let listener = &mut listener::StdErrListener {verbose}; // prints warnings let options = Config::from_manifest(Path::new("Cargo.toml"), target, listener)?; reset_deb_directory(&options)?; cargo_build(&options, target, &[], verbose)?; strip_binaries(&options, target, listener)?; let bin_path = generate_debian_binary_file(&options)?; let mut deb_contents = vec![]; deb_contents.push(bin_path); let system_time = time::SystemTime::now().duration_since(time::UNIX_EPOCH)?.as_secs(); // Initailize the contents of the data archive (files that go into the filesystem). let (data_archive, asset_hashes) = data::generate_archive(&options, system_time, listener)?; let data_base_path = options.path_in_deb("data.tar"); // Initialize the contents of the control archive (metadata for the package manager). let control_archive = control::generate_archive(&options, system_time, asset_hashes, listener)?; let control_base_path = options.path_in_deb("control.tar"); // Order is important for Debian deb_contents.push(compress::gz(&control_archive, &control_base_path)?); deb_contents.push(compress::xz_or_gz(&data_archive, &data_base_path)?); let generated = generate_deb(&options, &deb_contents)?;
Modules
compress | |
control | |
data | |
listener |
Structs
Config |
Cargo deb configuration read from the manifest and cargo metadata |
Enums
CargoDebError |
Functions
cargo_build |
Builds a release binary with |
generate_deb |
Uses the ar program to create the final Debian package, at least until a native ar implementation is implemented. |
generate_debian_binary_file |
Creates the debian-binary file that will be added to the final ar archive. |
install_deb |
Run |
reset_deb_directory |
Removes the target/debian directory so that we can start fresh. |
strip_binaries |
Strips the binary that was created with cargo |
Type Definitions
CDResult |