commit 11420c1d0785bbf38dbfabeb1ab29a9faa9f8f96 Author: Nicolas Vigier boklm@torproject.org Date: Wed Apr 21 17:23:40 2021 +0200
Bug 40271: Improve process to generate rust vendor tarballs --- Makefile | 15 +++++++++++++++ projects/application-services/config | 17 ++++++++++++++--- projects/cbindgen/config | 9 +++++++++ projects/lucetc/config | 10 ++++++++-- projects/uniffi-rs/config | 9 ++++++++- rbm.conf | 30 ++++++++++++++++++++++++++++++ 6 files changed, 84 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile index c30c70b..0092cc2 100644 --- a/Makefile +++ b/Makefile @@ -228,6 +228,21 @@ get_gradle_dependencies_list-application-services: submodule-update get_gradle_dependencies_list-android-components: submodule-update $(rbm) build android-components --step get_gradle_dependencies_list --target nightly --target torbrowser-android-armv7
+cargo_vendor-application-services: submodule-update + $(rbm) build application-services --step cargo_vendor --target nightly + +cargo_vendor-cbindgen-android: submodule-update + $(rbm) build cbindgen --step cargo_vendor --target nightly --target android + +cargo_vendor-cbindgen: submodule-update + $(rbm) build cbindgen --step cargo_vendor --target nightly + +cargo_vendor-lucetc: submodule-update + $(rbm) build lucetc --step cargo_vendor --target nightly + +cargo_vendor-uniffi-rs: submodule-update + $(rbm) build uniffi-rs --step cargo_vendor --target nightly + submodule-update: git submodule update --init
diff --git a/projects/application-services/config b/projects/application-services/config index 456ce87..ba5acc1 100644 --- a/projects/application-services/config +++ b/projects/application-services/config @@ -79,9 +79,7 @@ input_files: - URL: https://people.torproject.org/~gk/mirrors/sources/glean-parser-%5B% c('var/glean_parser') %].tar.bz2 sha256sum: 19dbdd4958022a1a638e0217489ab722fe7d4f588f1978a4ae162f93e75694c2 enable: '[% !c("var/fetch_gradle_dependencies") %]' - # `cargo vendor vendor -s components/external/nimbus-sdk/nimbus/Cargo.toml` - # in the `application-services` directory has vendored the sources, - # after applying update-cargo-lock.patch and viaduct-workaround.patch + # Use `make cargo_vendor-application-services` to re-generate the vendor tarball - URL: https://people.torproject.org/~boklm/mirrors/sources/application-services-ve... c('var/rust_vendor_version') %].tar.bz2 sha256sum: 5f1c9e1bc0db283e88516bd1d78187145bacbf4aeb72972ac09875c1147d2215 - filename: no-git.patch @@ -106,3 +104,16 @@ steps: get_gradle_dependencies_list: '[% INCLUDE build %]' var: fetch_gradle_dependencies: 1 + + cargo_vendor: + filename: '[% project %]-vendor-[% c("version") %].tar.bz2' + var: + cargo_vendor_opts: '-s components/external/nimbus-sdk/nimbus/Cargo.toml' + pre_cargo_vendor: | + patch -p1 < $rootdir/update-cargo-lock.patch + patch -d components/external/nimbus-sdk -p1 < $rootdir/viaduct-workaround.patch + input_files: + - project: container-image + pkg_type: build + - filename: viaduct-workaround.patch + - filename: update-cargo-lock.patch diff --git a/projects/cbindgen/config b/projects/cbindgen/config index a4e9cb7..43c2fb8 100644 --- a/projects/cbindgen/config +++ b/projects/cbindgen/config @@ -23,5 +23,14 @@ input_files: - name: rust project: rust # `cargo vendor vendor` in the `cbindgen` directory has vendored the sources. + # Use `make cargo_vendor-cbindgen` or `make cargo_vendor-cbindgen-android` + # (for the Android version) to re-generate the vendor tarball - URL: https://people.torproject.org/~gk/mirrors/sources/cbindgen-vendor-%5B% c('version') %].tar.bz2 sha256sum: '[% c("var/cbindgen_vendor_hash") %]' + +steps: + cargo_vendor: + filename: '[% project %]-vendor-[% c("version") %].tar.bz2' + input_files: + - project: container-image + pkg_type: build diff --git a/projects/lucetc/config b/projects/lucetc/config index 72b79fe..e806685 100644 --- a/projects/lucetc/config +++ b/projects/lucetc/config @@ -27,7 +27,13 @@ input_files: project: rust - name: wasi-sysroot project: wasi-sysroot - # `cargo vendor vendor` in the `lucetc-sandbox-compiler` directory has vendored - # the sources. + # Use `make cargo_vendor-lucetc` to re-generate the vendor tarball - URL: https://people.torproject.org/~gk/mirrors/sources/lucetc-vendor.tar.bz2 sha256sum: 12ba97fca12177e7ed5b5409fcfdbd31dc7db2e82282768d99dee5bcb1b1246a + +steps: + cargo_vendor: + filename: '[% project %]-vendor-[% c("version") %].tar.bz2' + input_files: + - project: container-image + pkg_type: build diff --git a/projects/uniffi-rs/config b/projects/uniffi-rs/config index acd9d2d..c8ad51c 100644 --- a/projects/uniffi-rs/config +++ b/projects/uniffi-rs/config @@ -12,7 +12,14 @@ input_files: - project: container-image - name: rust project: rust - # `cargo vendor vendor` in the `uniffi-rs` directory has vendored the sources. + # Use `make cargo_vendor-uniffi-rs` to re-generate the vendor tarball - URL: https://people.torproject.org/~boklm/mirrors/sources/uniffi-rs-vendor-%5B% c('version') %].tar.bz2 sha256sum: 8f201df618b3e7bcaaf01a87e0d55171605b80abeb1b660fe4dd0b9bfc10a0d8 - filename: btreeset.patch + +steps: + cargo_vendor: + filename: '[% project %]-vendor-[% c("version") %].tar.bz2' + input_files: + - project: container-image + pkg_type: build diff --git a/rbm.conf b/rbm.conf index 646f353..3228453 100644 --- a/rbm.conf +++ b/rbm.conf @@ -15,10 +15,40 @@ steps: set -e mkdir -p '[% dest_dir %]' mv -vf '[% project %]-[% c("version") %].tar.xz' '[% dest_dir %]/[% c("filename") %]' + list_toolchain_updates: build_log: '-' list_toolchain_updates: '[% INCLUDE list_toolchain_updates %]'
+ cargo_vendor: + output_dir: "out/[% project %]/cargo_vendor" + var: + container: + suite: buster + arch: amd64 + pre_pkginst: '' + deps: + - cargo + - patch + cargo_vendor: | + #!/bin/bash + [% c("var/set_default_env") %] + tar -xf [% project %]-[% c('version') %].tar.gz + cd [% project %]-[% c('version') %] + [% c("var/pre_cargo_vendor") %] + cargo vendor vendor [% c("var/cargo_vendor_opts") %] + [% c('tar', { + tar_src => [ 'vendor' ], + tar_args => '-caf ' _ dest_dir _ '/' _ c('filename'), + }) %] + cd [% dest_dir %] + fname="out/[% project %]/cargo_vendor/[% c('filename') %]" + echo + echo "Finished creating $fname" + sha256sum "[% c('filename') %]" + echo "You can upload it with:" + echo " scp -p $fname people.torproject.org:public_html/mirrors/sources" + # buildconf contains build options that the user can change in rbm.local.conf # When adding a new option to buildconf, a default value should be defined # in var/build_id, so that changing this option does not affect the build_id.
tbb-commits@lists.torproject.org