From bb4993395c9ad41a7a6ce70319f0240a951f0e65 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 28 Nov 2017 22:39:53 +0000 Subject: [PATCH 1/2] doc: Document how to build with Rust dependencies in offline-mode. * CLOSES #22907: https://bugs.torproject.org/22907 --- changes/bug22907 | 3 +++ doc/HACKING/GettingStartedRust.md | 36 +++++++++++++++---------------- 2 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 changes/bug22907 diff --git a/changes/bug22907 b/changes/bug22907 new file mode 100644 index 0000000000..ff6ab8375b --- /dev/null +++ b/changes/bug22907 @@ -0,0 +1,3 @@ + o Documentation: + - Add documentation on how to build tor with Rust dependencies without + requiring being online. Closes ticket 22907; bugfix on tor-0.3.0.3-alpha. diff --git a/doc/HACKING/GettingStartedRust.md b/doc/HACKING/GettingStartedRust.md index 181535122c..3d00388314 100644 --- a/doc/HACKING/GettingStartedRust.md +++ b/doc/HACKING/GettingStartedRust.md @@ -60,30 +60,28 @@ or specifying a local directory. **Using a local dependency cache** -**NOTE**: local dependency caches which were not *originally* created via - `--enable-cargo-online-mode` are broken. See https://bugs.torproject.org/22907 - -To specify a local directory: - - RUST_DEPENDENCIES='path_to_dependencies_directory' ./configure --enable-rust - -(Note that RUST_DEPENDENCIES must be the full path to the directory; it cannot -be relative.) - You'll need the following Rust dependencies (as of this writing): libc==0.2.22 -To get them, do: +We vendor our Rust dependencies in a separate repo using +[cargo-vendor](https://github.com/alexcrichton/cargo-vendor). To use them, do: - mkdir path_to_dependencies_directory - cd path_to_dependencies_directory - git clone https://github.com/rust-lang/libc - cd libc - git checkout 0.2.22 - cargo package - cd .. - ln -s libc/target/package/libc-0.2.22 libc-0.2.22 + git submodule init + git submodule update + +To specify the local directory containing the dependencies, (assuming you are in +the top level of the repository) configure tor with: + + TOR_RUST_DEPENDENCIES='path_to_dependencies_directory' ./configure --enable-rust + +(Note that RUST_DEPENDENCIES must be the full path to the directory; it cannot +be relative.) + +Assuming you used the above `git submodule` commands and you're in the topmost +directory of the repository, this would be: + + TOR_RUST_DEPENDENCIES=`pwd`/src/ext/rust/crates ./configure --enable-rust Identifying which modules to rewrite From 57e2f21bd8966e1ce4f9da5e9f6e7dcbe1fe0c6c Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 28 Nov 2017 22:47:25 +0000 Subject: [PATCH 2/2] ci: Add Travis CI builds for testing cargo offline-mode. --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8cc210827a..d3918875dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,6 +56,7 @@ env: - MAKEFLAGS="-j 2" matrix: - RUST_OPTIONS="--enable-rust --enable-cargo-online-mode" + - RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true - RUST_OPTIONS="" matrix: @@ -87,6 +88,10 @@ install: - if [[ "$RUST_OPTIONS" != "" ]]; then which cargo; fi - if [[ "$RUST_OPTIONS" != "" ]]; then rustc --version; fi - if [[ "$RUST_OPTIONS" != "" ]]; then cargo --version; fi + ## If we're testing rust builds in offline-mode, then set up our vendored dependencies + - if [[ "$RUST_OPTIONS" == "--enable-rust" ]]; then git submodule init ; fi + - if [[ "$RUST_OPTIONS" == "--enable-rust" ]]; then git submodule update; fi + - if [[ "$TOR_RUST_DEPENDENCIES" == "true" ]]; then export TOR_RUST_DEPENDENCIES=$PWD/src/ext/rust/crates; fi script: - ./autogen.sh