#860116 RFH: cargo -- Rust package manager

#860116#5
Date:
2017-04-11 15:24:55 UTC
From:
To:
We request assistance with maintaining the cargo package, as well as Rust
packaging in general.

Firefox's next versions[1] will require rust, but the Debian pkg-rust team is
severely short on time to maintain these packages.

sylvestre@ and I are just about managing to keep rustc in Debian up-to-date
in our spare time.

lucab@ and gus@ know more about the rust ecosystem than either of us, but they
have not been very active recently. lucab@ had been maintaining cargo.

Right now, cargo needs to be updated to the next version, there are some open
bugs about it:

https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=cargo

I have not yet looked at this package myself but if there are any questions you
can probably prod lucab@ to answer them. He has a different handle on IRC, you
can join #debian-rust on OFTC to talk to us.

After this, we will need to update rustc to 1.16.0. This is packaged in git,
and it works (doko@ has already uploaded it to Ubuntu) however it uses some
deprecated Makefiles which are to be removed in the next 1.17.0 release.
Therefore, we should try to upload 1.16.0 using the new "rustbuild" buildsystem
which also build-depends on cargo. (To try this out, remove --disable-rustbuild
from d/rules.)

After that, we will have to figure out how to cross-compile cargo and rust
for other architectures. So far, we have been bootstrapping rustc on other
arches by using upstream's binary blobs, but this is not the ideal approach,
and will become even harder once we have the rustc<->cargo cyclic build
dependency. Upstream themselves prefer the cross-compilation approach, and had
previously given me some tips that I need to go dig out again from my IRC logs.

At some point we should also start packaging actual rust packages. Josh
Triplett had been planning to automate a large part of this, the work is still
incomplete but we have a Rust Packaging policy already:

https://wiki.debian.org/Teams/RustPackaging/Policy

Package automation tools:

https://anonscm.debian.org/cgit/pkg-rust/dh-cargo.git (low-level dh glue)
https://crates.io/crates/debcargo (high-level automater)

[1] https://buildd.debian.org/status/package.php?p=firefox&suite=experimental

#860116#10
Date:
2017-04-11 18:24:00 UTC
From:
To:
Ximin Luo:


I've updated our cargo.git with some documentation on how to update the package, and updated some configs and scripts etc to match.

Now things will "work" if you run:

$ debian/make_orig_multi.sh 0.16.0
# move the files over
$ gbp import-orig ../cargo_0.16.0.orig.tar.gz # also imports the -deps tarball automatically

However, I've decided to not yet push these 0.16.0 commits, because I'm not sure if we need to tweak the -deps tarball further.

Luca, could you give us some guidance on how to proceed?

Perhaps we need to first expand clean-cargo-deps.patch or deps-tarball-filter.txt?

X

#860116#15
Date:
2017-04-19 23:11:00 UTC
From:
To:
Ximin Luo:

I've made some more process and have pushed 0.17.0 to git. However we're getting build errors and I don't know how to proceed:

https://anonscm.debian.org/cgit/pkg-rust/cargo.git/tree/debian/TODO
https://anonscm.debian.org/cgit/pkg-rust/cargo.git/tree/debian/cargo-vendor-pack.py

I'm not familiar with the Cargo repo formats, and I don't know how d/cargo-vendor-pack.py should be fixed. Help would be appreciated.

Josh, is this anything related to how your dh-cargo works? Any code that we can reuse?

X

#860116#20
Date:
2017-04-20 01:00:36 UTC
From:
To:
Not directly, until we're ready to package all the individual crate
dependencies (which we'll want to do at some point).  But you can
definitely use the same mechanism; it'd be much easier to generate a
directory registry than the full Cargo index format.  Rather than
generating an index file and repo, just:

1) Copy every crate directory, verbatim, into a subdirectory of a vendor
   directory.

2) Create a file .cargo-checksum.json in the crate directory, containing
   {"package":"$SHA256","files":{}} , where $SHA256 is the sha256 of the
   .crate file.

3) Create a directory containing a file "config", containing:

[source.crates-io]
replace-with = "my-registry"

[source.my-registry]
directory = "/path/to/the/vendor/directory"

4) Set CARGO_HOME to the directory containing that config file, and
   build.

debcargo can help a bit with this.  Run it on a crate, move
debian/cargo-checksum.json to .cargo-checksum.json , aggregate
debian/copyright, remove the rest of debian/ , and put the resulting
directory into the registry directory.

...and looking at git from 20 minutes ago, it looks like you've switched
over to directory registries now.

#860116#25
Date:
2017-04-20 08:16:00 UTC
From:
To:
Josh Triplett:

Thanks for the tip, yes I figured this out by looking at both your dh-cargo code and also the Fedora cargo package. [1]

The new version is uploaded to experimental, but there's some more things I'd like to tidy up before uploading it to unstable.

- I get errors about missing "cargotest" and "hamcrest" when I try to `make test`, it looks like cargotest is actually in the rustc package:

https://github.com/rust-lang/rust/tree/master/src/tools/cargotest

Any suggestions on how to deal with this? I guess the obvious thing to do is to package a librust-cargotest-xxx-dev package but I wonder if there are better options.

- cargo still embeds libgit2-sys source code, and I can see that in the deps-tarball-filter.txt Luca was explicitly leaving it in. Is that because they patch the source code?

Can we just get rid of it, and link to libgit2 instead?

X

[1] https://src.fedoraproject.org/cgit/rpms/cargo.git/tree/cargo.spec

#860116#30
Date:
2017-04-20 09:57:28 UTC
From:
To:
git2-rs doesn't modify libgit2, but it does use a snapshot from git, via
a submodule.  And unfortunately, while it supports building against a
system version via pkg-config, it doesn't include any version number in
its dependency.  libgit2 itself doesn't have a stable ABI, so either an
older *or* a newer version can potentially fail due to
incompatibilities.  (Also, like many libraries, libgit2 doesn't really
update its SONAME and similar except when releasing, even though many
people run git snapshots.)

Fortunately, git2-rs uses ctest now to attempt to make sure its bindings
match the actual signatures of the functions, so at least an attempt to
build against an older (or sometimes newer) version of libgit2 will tend
to produce compile errors (assuming you get all the environment
variables set correctly to find it).  However, I know of at least one
case where git2-rs pulled in a new snapshot of libgit2 to obtain
critical bugfixes rather than differences in ABI.

In short, I think we *could* switch to pulling in the system version of
libgit2, but we'd need to work very closely with the libgit2 maintainer,
and sometimes package snapshots of libgit2 from git.  We might also want
to work with libgit2 and git2-rs upstreams to 1) get more regular
updates to the version number that appears in the pkg-config file and 2)
get libgit2-sys to declare a pkg-config dependency that matches its
snapshot of libgit2.

- Josh Triplett

#860116#35
Date:
2017-04-20 10:01:07 UTC
From:
To:
It would be nice, but last time I tried upstream was tracking libgit2 from
master: https://github.com/alexcrichton/git2-rs/pull/80

Things may have changed in the meanwhile, I did not re-assess since then.

Ciao, Luca

#860116#40
Date:
2020-10-29 20:14:51 UTC
From:
To:
This is still listed as RFH - is there still help required/appreciated?
I like the rust eco-system and would like to contribute here.
-----BEGIN PGP PUBLIC KEY BLOCK----- mQINBFiM64ABEAC1oAm0/aU+T+Tb4f5q9KALm/UfaZ34dmgXY3QcU3lF34MEpATC JxRmiLJoQiBvLyDPpHEuQcAArUrMEImySQOWcst9S1TKlIE51CXNp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I8BBgBAgAmAhsMFiEE1N7jnyjU+vrr6YnIkwX3 EcBDLgQFAl1cI0wFCQW8hcwACgkQkwX3EcBDLgRgGA/+Lz4ahjcNlpoQLZH/LVAE y6lEj50YuVnWlVy2+08IsXEWtQFC+OCf1yahxynUQFg9EUJGkwGVkp6pOhQJhkYj fDETv0T7CdKAY2qIKkIaJFFTORlDLpBtBB3bdYxZ9DlU4Yfv4Nsbs2RrHXZPp7x1 6dpoI3Yf9XG1CodhN6ez1X/BuiKeKFURb/pb6XhfSCGuSqgPoFmDMYDyJI2Qa+h2 cTaQVnBXoWHlC269u5kfiE1OLNjbhZs2tgx4sGjARI3eL1uj48A3lcGZpD05TZtx Q6E57+hcd+IFh6In8ai8EarMv3jbx1lIY/qNvf9IwrLxIyCm5iVglbDOzsvMTDbo dwkjaWil8Gj5GHtFPNHRLynqHgWCcPHPqzQ0GjGQ4IRitqS7Ysmd7GAQBnrdTWOX HL1O3K9qNndFXYbCUTxy3rDTptm5eZ9iK1GyBP4m0M4tDIwmWxLySL71XMCpiJsj 5MM+2IfVVFu9th3RTAFFvdq+kDp95MXAxoBfKG+fvzUP6g2++5eiwBZaviA5+kBr iFn6mHi1ul96Jm9auUd2QJvirWk5yxEaczwpWZBW7byyo4dIOeKzi4mwtpFCfWWl T3BMYHPN0JY9KxJiVAviUFmCqseQuSYP+/wvnslGrFYotEDUS5g5gIApdut9xOKm CYjPkDA2K1CR/XA27Y87NWg= =lXQM -----END PGP PUBLIC KEY BLOCK-----
#860116#45
Date:
2025-11-28 21:50:55 UTC
From:
To:
Control: owner -1 !

Hi!

time flies, I guess, but I guess better a late reply than none at all.

rustc and cargo are in reasonable shape nowadays, while not in freeze the
toolchain is usually not far behind the last upstream stable release, and
the day to day business is not too troublesome in that area.

that being said - help is always welcome, both in the toolchain and in the
broader Rust packaging team. the toolchain packages themselves do require
a quite substantial commitment and a certain level of technical knowledge
and the desire to dig deep if and when needed. as such, it is probably not
the best area to start contributing as a beginner (unless you are really
motivated, patient and have a lot of time ;)). if you already have quite
a bit of experience with either rustc itself, or other, similarly complex
toolchains (or their packaging), it's probably easier to get going.

anybody who is interested to help out or get involved, please don't
hesitate to contact me or the Debian Rust team, either here in this bug,
over on IRC in #debian-rust or on our discussion mailing list:

debian-rust@lists.debian.org

thanks!
Fabian