Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Editing vendored crates take #2

82 views
Skip to first unread message

Josh Matthews

unread,
Apr 28, 2017, 1:05:17 PM4/28/17
to
Back in February there was a discussion about how hard it is to modify
vendored Rust crates for Stylo. I can't actually find any solution to
that problem - the general idea appears to be "add a [replace] section
to a Cargo.toml and run cargo update", but I have not been able to make
that work yet. Given that the version of mozilla-central that I'm using
contains a vendored copy of rust-cssparser 0.12.2, here's what I have tried:

* added the following to servo/Cargo.toml and toolkit/library/rust:
[replace]
"rust-cssparser:0.12.2" = { path = "/Users/jdm/src/rust-cssparser" }

* run `cd servo/Cargo.toml && cargo update -p cssparser`
* run `cd toolkit/library/rust && cargo update -p cssparser`

This ends up modifying the Cargo.lock files to use the most recent
version from crates.io (0.12.4) instead of my local copy. Has anybody
been able to make this work? Can we please document the exact steps to
follow? There have been multiple people asking in #servo how to do this
recently and nobody seems to have done it successfully.

Cheers,
Josh

Bobby Holley

unread,
Apr 28, 2017, 1:28:59 PM4/28/17
to Josh Matthews, dev-pl...@lists.mozilla.org
I definitely made this work at some point:
https://hg.mozilla.org/try/rev/18dc070e0308

The main difference with what you seem to be doing is that my version
points directly into third-party/rust, which I think is preferable anyway.

On Fri, Apr 28, 2017 at 10:05 AM, Josh Matthews <jo...@joshmatthews.net>
wrote:
> _______________________________________________
> dev-platform mailing list
> dev-pl...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>

Jack Moffitt

unread,
Apr 28, 2017, 1:30:46 PM4/28/17
to Bobby Holley, Josh Matthews, dev-pl...@lists.mozilla.org
There is this bug which the Cargo team is planning to work on to help
with these problems, but it hasn't been implemented yet that I know
of.

https://github.com/rust-lang/cargo/issues/2649#issuecomment-279615299

jack.

On Fri, Apr 28, 2017 at 11:28 AM, Bobby Holley <bobby...@gmail.com> wrote:
> I definitely made this work at some point:
> https://hg.mozilla.org/try/rev/18dc070e0308
>
> The main difference with what you seem to be doing is that my version
> points directly into third-party/rust, which I think is preferable anyway.
>
> On Fri, Apr 28, 2017 at 10:05 AM, Josh Matthews <jo...@joshmatthews.net>
> wrote:
>

Josh Matthews

unread,
Apr 28, 2017, 2:03:57 PM4/28/17
to
I just tried moving my changes into third_part/rust/rust-cssparser. I
also needed to modify the Cargo.toml there to update the paths to
cssparser-macros and procedural-masquerade because they are vendored as
separate crates, rather than in-library dependencies. At this point I
was still hitting the problem with `cargo update -p cssparser` always
updating to the newest version on crates.io, so I tried changing the
version in rust-cssparser/Cargo.toml to 0.12.4 to match. At this point
I'm stuck at this error:

0:05.90 error: checksum for `cssparser v0.12.4` changed between lock files
0:05.90
0:05.90 this could be indicative of a few possible errors:
0:05.90
0:05.90 * the lock file is corrupt
0:05.90 * a replacement source in use (e.g. a mirror) returned a
different checksum
0:05.90 * the source itself may be corrupt in one way or another
0:05.90
0:05.90 unable to verify that `cssparser v0.12.4` is the same as when
the lockfile was generated

Boris Zbarsky

unread,
Apr 28, 2017, 3:07:36 PM4/28/17
to
On 4/28/17 1:05 PM, Josh Matthews wrote:
> Has anybody been able to make this work?

I _think_ I made it work recently-ish, like so:

1) Modify toolkit/library/rust/Cargo.toml with the relevant [replace] bit.

2) Run "cargo vendor" and watch it fail because of something I never
figured out.

3) revert the changes "cargo vendor" made to third-party/rust (i.e.
deleting the whole dir)

As it happens, "cargo vendor" updated the Cargo.lock files in the right
way before it failed out, so things worked. Again, I _think_ that was
the procedure.

I'm not claiming this is in any way sane, btw.

-Boris

Kartikaya Gupta

unread,
Apr 28, 2017, 3:25:00 PM4/28/17
to Boris Zbarsky, dev-platform
At one point the steps at
https://wiki.mozilla.org/Platform/GFX/Quantum_Render#Testing_third-party_rust_library_changes
were known to work. I don't know if they have since been broken.

Josh Matthews

unread,
May 2, 2017, 2:54:37 PM5/2/17
to
On 2017-04-28 3:07 PM, Boris Zbarsky wrote:
> On 4/28/17 1:05 PM, Josh Matthews wrote:
> 2) Run "cargo vendor" and watch it fail because of something I never
> figured out.

My cargo from April 19 claims that "cargo vendor" isn't a real command.
Did you mean `./mach vendor rust` (which did end up deleting the whole
directory for me)?

Ted Mielczarek

unread,
May 2, 2017, 3:01:58 PM5/2/17
to dev-pl...@lists.mozilla.org
FYI you need to `cargo install cargo-vendor` for `cargo vendor` to work.
`./mach vendor rust` will do that for you if it's not installed.

-Ted

Boris Zbarsky

unread,
May 2, 2017, 10:01:44 PM5/2/17
to
On 5/2/17 2:54 PM, Josh Matthews wrote:
> My cargo from April 19 claims that "cargo vendor" isn't a real command.
> Did you mean `./mach vendor rust`

Er, yes, I did.

-Boris
0 new messages