debcargo
is the official tool for packaging Rust crates
to be part of the Debian
system.
It creates a Debian source package (*.dsc
) from a Rust
crate that follows Debian’s general packaging
policy as well as the Debian Rust team’s crate
packaging policy.
debian/copyright
.FIXME (hint)
strings where it can’t detect full
information, so user can provide an override/overlay or manually fix
it.apt-get
sbuild
.On Debian systems, debcargo
can be installed the usual
way:
$ apt-get install debcargo
To build locally for development:
$ apt-get build-dep debcargo
$ cargo build debcargo
On non-Debian systems, you can try simply:
$ cargo build debcargo
and fix any build errors that come up, e.g. by installing missing libraries. Probably, this will include OpenSSL as a dependency of cargo.
To download and unpack the latest clap
crate and prepare
the source package:
$ debcargo package clap
To download and unpack version 2.25.0
of
clap
crate and prepare the source package:
$ debcargo package clap =2.25.0
To provide additional packaging-specific config for downloading and
packaging latest clap
crate from crates.io:
$ debcargo package --config clap-2/debian/debcargo.toml clap
See debcargo.toml.example
for a sample TOML file.
The Debian Rust team uses this tool together with the configs and overlays in https://salsa.debian.org/rust-team/debcargo-conf/. If you are interested in contributing, please see that repository for further information and instructions on how to collaborate with us.
Debian packaging policy is quite detailed. If you just want to create
Debian binary packages (*.deb
) without worrying about these
policies, you may want to use other tools instead that ignore and bypass
these policies. For example, cargo-deb
.
The trade-off is that the resulting packages integrate less well with a Debian system, and do not integrate at all with the Debian build system, which means you lose the features described earlier. Furthermore, you will be responsible for hosting and distributing those packages yourself, outside of the official Debian distribution infrastructure.
Debcargo is licensed under MIT/Apache-2.0
. It is written
by Josh Triplett
and Ximin Luo
, and improved
by members of Debian Rust Maintainers team