Merge ~blkerby/ubuntu/+source/rustc:std-vendor into ~canonical-foundations/ubuntu/+source/rustc:merge-1.91
| Status: | Merged |
|---|---|
| Approved by: | Max Gilmour |
| Approved revision: | 2f166d166f989a2c5c3b2d35e28ff855918671f7 |
| Merge reported by: | Max Gilmour |
| Merged at revision: | 2f166d166f989a2c5c3b2d35e28ff855918671f7 |
| Proposed branch: | ~blkerby/ubuntu/+source/rustc:std-vendor |
| Merge into: | ~canonical-foundations/ubuntu/+source/rustc:merge-1.91 |
| Diff against target: |
246 lines (+135/-9) 7 files modified
debian/bootstrap.toml.in (+1/-1) debian/changelog (+8/-0) debian/rules (+18/-6) debian/rust-X.Y-src.install.in (+20/-0) debian/scripts/update-rust-src-install (+46/-0) debian/vendor-deps (+2/-2) debian/vendor-std-deps (+40/-0) |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Max Gilmour | Approve | ||
|
Review via email:
|
|||
Description of the change
This adds support for vendoring the standard library dependencies as part of the "rust-X.Y-src" package, enabling the "build-std" unstable Cargo feature to be used in offline environments. This includes:
- A new bash script "vendor-std-deps" to vendor the standard library dependencies into a temporary directory.
- A new Python script to scan the temporary output and autogenerate a section of "rust-X.
- A new target "vendor-std-deps" in "debian/rules" to invoke the new bash script and Python script.
- Addition of "vendor-std-deps" as a dependent to the "vendor-tarball" target; so going forward the vendoring of standard library dependencies should be handled automatically, without the maintainer needing to do any additional steps in the rustc upgrade process.
While working on this, I had some trouble reproducing the existing vendor tarball for rustc-1.91. One possible cause of differences would be a different toolchain version being used. To prevent this in the future, a check is added to ensure that the toolchain version used to create the vendor tarball matches the version of the toolchain being built.
I also had an issue where the vendored crate versions ended up not being the same versions as the ones actually required by the "build-std" option in the end. This appears to have been caused by the "dh_auto_configure" step removing (or rather renaming) the Cargo.lock files. I'm not aware of the context of why this was done, but leaving the original Cargo.lock files intact appears to work and resolves the issue. Leaving the Cargo.lock intact also seems ideal in order to match the upstream behavior as close as possible? While troubleshooting, I also set "locked-deps" to true in the "bootstrap.

PPA: https:/ /launchpad. net/~blkerby/ +archive/ ubuntu/ rustc-1. 91-resolute- b
Steps to validate that this solution will work: rustc-1. 91-resolute- b rustc-1. 91.1/vendor/ * vendor/
> add-apt-repository -y ppa:blkerby/
> apt update
> apt install -y rustc-1.91 cargo-1.91 rust-1.91-src
> alias cargo=cargo-1.91
> cargo new hello
> cd hello
> cargo add serde # add dummy dependency so "cargo vendor" doesn't complain
> cargo vendor --versioned-dirs
> ln -s /usr/src/
> mkdir .cargo
> cat >.cargo/config.toml
[source.crates-io]
replace-with = "vendored-sources"
[source. vendored- sources]
directory = "vendor"
> RUSTC_BOOTSTRAP=1 cargo run -Z build-std --offline