[Pkg-rust-maintainers] Preliminary version of debcargo published

Josh Triplett josh at joshtriplett.org
Mon Nov 14 18:48:23 UTC 2016


I just pushed a preliminary version of debcargo to the debcargo.git
repository under pkg-rust on alioth.

After building debcargo with "cargo build" and putting it in your $PATH,
run "debcargo package cratename" to create a source package for that
crate.  That will download the crate if Cargo hasn't already downloaded
and cached it.

The resulting packaging currently invokes the not-yet-written dh-cargo,
via "--buildsystem cargo".  That debhelper build system needs to do a
few things:

- Depend on an appropriate version of cargo.
- Write a temporary .cargo/config file pointing to the directory
  registry in /usr/share/rust/cargo, and clean it up in the clean
  target.
- Run "cargo test" as part of the test target (unless DEB_BUILD_OPTIONS
  includes nocheck).
- For lib crates, run "cargo package" in the build target, and extract
  the resulting .crate file into the package's
  /usr/share/rust/cargo/$crate-$version in the binary target, to add it
  to the cargo directory registry.  In that same directory, write a
  .cargo-checksum.json file containing
  `{"package":"$checksum","files":{}}` , where $checksum is the
  sha256sum of the .crate file.
- For bin crates, run "cargo install --path . --root $tmpdir" in the
  binary target, where $tmpdir refers to the directory you package the
  .deb from.

The .cargo/config file should contain the following:

[source.crates-io]
replace-with = 'debian-registry'
local-registry = "/nonexistent"

[source.debian-registry]
directory = '/usr/share/rust/cargo'

I plan to write dh-cargo at some point, but if someone else wants to
start on it, feel free. :)  Happy to help adapt debcargo to make
dh-cargo's job easier (such as by pre-determining the list of binary and
library crates and providing that to dh-cargo somehow so it doesn't need
to parse debian/control).

Also, for some reason, debcargo.git doesn't show up on git.debian.org
yet.  Do I need to do something to get it to show up there?

- Josh Triplett



More information about the Pkg-rust-maintainers mailing list