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

vendoring: Mention rust-cargo-vendor-filterer #76

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions vendoring/Rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
## Vendoring Rust dependencies
It's a simple matter of running `cargo vendor debian/rust-vendor/` where you're on the top-level directory. Sadly, it's not possible to exclude irrelevant dependencies during vendoring yet, so you might want to automate that step and add some post-processing to remove voluminous, unused dependencies, and/or the C code for some system libraries that could be statically linked.

**Note:** [cargo-vendor-filterer](https://crates.io/crates/cargo-vendor-filterer) can be used to avoid unnecessary dependencies, e.g.:
```sh
$ apt install cargo-vendor-filterer
$ cargo vendor-filterer --platform=*-unknown-linux-gnu debian/rust-vendor/
```

### Automation via `debian/rules`
A good example for automating Rust vendoring is provided by [s390-tools](https://git.launchpad.net/ubuntu/+source/s390-tools/tree/debian/rules) and can be executed via **debian/rules**.

Expand Down Expand Up @@ -66,7 +72,7 @@
rm -rf $(CARGO_HOME)

vendor-tarball: vendor-tarball-sanity-check vendor-deps
tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime -caf ../$(VENDOR_TARBALL) $(CARGO_VENDOR_DIR)

Check notice on line 75 in vendoring/Rust.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`Line` matches candidate pattern `\b(?:\\n|)g?tar(?:\.exe|)(?:(?:\s+--[-a-zA-Z]+|\s+-[a-zA-Z]+|\s[ABGJMOPRSUWZacdfh-pr-xz]+\b)(?:=[^ ]*|))+` (candidate-pattern)

%:
dh $@
Expand All @@ -90,7 +96,7 @@
dpkg-source --include-binaries -b .
git add debian/source/include-binaries
git commit -m "Update debian/source/include-binaries"
git reset --hard && git clean -fdx

Check notice on line 99 in vendoring/Rust.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`Line` matches candidate pattern `(?:^|[\t ,"'`=(])-[DPWXYLlf](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,})` (candidate-pattern)
```

### Teaching dh-cargo about vendored sources
Expand Down
Loading