Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo vendor fails to include .gn #566

Closed
avindra opened this issue Dec 28, 2020 · 2 comments
Closed

cargo vendor fails to include .gn #566

avindra opened this issue Dec 28, 2020 · 2 comments

Comments

@avindra
Copy link
Contributor

avindra commented Dec 28, 2020

Background on the issue I tried to fix with PR #559 (revert on #565).

cargo vendor is in use to vendor all the crates locally into one tarball, e.g., so that you can build offline easily.

When trying to vendor the dependencies from Deno:

$ cd path/to/denoland/deno
$ cargo vendor
$ ls  -rahgtl ./vendor/rusty_v8/
total 436K
-rw-r--r--   1 users 2.0K Dec 27 22:28 Cargo.toml
-rw-r--r--   1 users 5.7K Dec 27 22:28 Cargo.lock
-rw-r--r--   1 users 1.2K Dec 27 22:28 BUILD.gn
drwxr-xr-x   3 users   60 Dec 27 22:28 base/
-rw-r--r--   1 users  11K Dec 27 22:28 build.rs
drwxr-xr-x  15 users 1.6K Dec 27 22:28 build/
drwxr-xr-x   3 users  160 Dec 27 22:28 tests/
drwxr-xr-x   3 users  920 Dec 27 22:28 src/
drwxr-xr-x   2 users  120 Dec 27 22:28 examples/
drwxr-xr-x   7 users  200 Dec 27 22:28 buildtools/
drwxr-xr-x   6 users  120 Dec 27 22:28 third_party/
drwxr-xr-x   3 users  120 Dec 27 22:28 tools/
drwxr-xr-x   9 users  280 Dec 27 22:28 v8/
-rw-r--r--   1 users 406K Dec 27 22:28 .cargo-checksum.json

You can see .gn is ❌ missing here, which causes the build to fail. Compare this to the published crate:

$ wget  https://crates.io/api/v1/crates/rusty_v8/0.15.0/download -O rusty_v8.tar.gz
$ tar xvf rusty_v8.tar.gz
$ ls -lrathr rusty_v8-0.15.0/
total 40K
-rw-r--r--   1 avindra users 1.3K Apr 23  2020 .gn
-rw-r--r--   1 avindra users 1.2K Nov 17 08:06 BUILD.gn
-rw-r--r--   1 avindra users  11K Dec 27 19:01 build.rs
-rw-r--r--   1 avindra users 1.6K Dec 27 19:27 Cargo.toml.orig
-rw-r--r--   1 avindra users   74 Dec 27 19:37 .cargo_vcs_info.json
-rw-r--r--   1 avindra users 2.0K Dec 27 19:37 Cargo.toml
-rw-r--r--   1 avindra users 5.7K Dec 27 19:37 Cargo.lock
drwxr-xr-x   3 avindra users   60 Dec 27 20:03 base/
drwxr-xr-x   6 avindra users  120 Dec 27 20:03 third_party/
drwxrwxrwt 110 root    root  2.4K Dec 27 22:34 ../
drwxr-xr-x   7 avindra users  200 Dec 27 22:34 buildtools/
drwxr-xr-x  16 avindra users 1.7K Dec 27 22:34 build/
drwxr-xr-x  11 avindra users  360 Dec 27 22:34 ./
drwxr-xr-x   2 avindra users  120 Dec 27 22:34 examples/
drwxr-xr-x   3 avindra users  160 Dec 27 22:34 tests/
drwxr-xr-x   3 avindra users  920 Dec 27 22:34 src/
drwxr-xr-x  11 avindra users  340 Dec 27 22:34 v8/
drwxr-xr-x   3 avindra users  120 Dec 27 22:34 tools/

And if we check the published crate, ✔️ .gn is there. I checked the 0.14.0 release as well and the .gn file is there.

It is not clear what the root cause of this issue is, but it could be a bug with cargo vendor itself.

I would happily take the issue upstream to Cargo if that is the case, just need another pair of eyes.

@avindra
Copy link
Contributor Author

avindra commented Jan 7, 2021

A deno package for openSUSE should be available soon. The aarch64 and x86_64 builds are working and can be seen here while reviews are ongoing:

https://build.opensuse.org/package/show/home:avindra:devel:languages:javascript/deno

The workaround I use there at a high level involves:

  1. cd path/to/denoland/deno
  2. cargo vendor
  3. clone rusty_v8 from the source
  4. replace vendored rusty_v8 with the source from the previous step
    • caveat: cargo-specific artifacts not in source have to be carefully included

At this point, the vendor/ is now suitable for building from source in a fully-offline environment.

@avindra
Copy link
Contributor Author

avindra commented Jan 7, 2021

Issue moved upstream: rust-lang/cargo#9054

@avindra avindra closed this as completed Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant