Skip to content

Commit

Permalink
rust: Remove Rust support from tree
Browse files Browse the repository at this point in the history
Closes #40469

Signed-off-by: David Goulet <[email protected]>
  • Loading branch information
dgoulet-tor committed Oct 6, 2021
1 parent c3e50f0 commit ae9042a
Show file tree
Hide file tree
Showing 69 changed files with 40 additions and 5,984 deletions.
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ core.*
/autom4te.cache
/build-stamp
/compile
/config.rust
/configure
/Doxyfile
/orconfig.h
Expand All @@ -63,7 +62,6 @@ core.*
/config.guess
/config.sub
/conftest*
/link_rust.sh
/micro-revision.*
/patch-stamp
/stamp-h
Expand Down Expand Up @@ -161,12 +159,6 @@ core.*
/src/app/tor-cov
/src/app/tor-cov.exe

# /src/rust
/src/rust/.cargo/config
/src/rust/.cargo/registry
/src/rust/target
/src/rust/registry

# /src/test
/src/test/Makefile
/src/test/Makefile.in
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

52 changes: 1 addition & 51 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ language: c

cache:
ccache: true
## cargo: true
directories:
- $HOME/.cargo
## caching CARGO_TARGET_DIR actually slows down the build over time,
## because old build products are never deleted.
## where we point CARGO_TARGET_DIR in all our cargo invocations
#- $TRAVIS_BUILD_DIR/src/rust/target

compiler:
- gcc
Expand All @@ -29,8 +22,6 @@ env:
- HARDENING_OPTIONS="--enable-all-bugs-are-fatal --enable-expensive-hardening"
## We turn off asciidoc by default, because it's slow
- ASCIIDOC_OPTIONS="--disable-asciidoc"
## Our default rust version is the minimum supported version
- RUST_VERSION="1.31.0"
## Turn off tor's sandbox in chutney, until we fix sandbox errors that are
## triggered by Ubuntu Xenial and Bionic. See #32722.
- CHUTNEY_TOR_SANDBOX="0"
Expand Down Expand Up @@ -68,10 +59,6 @@ matrix:
## We check disable module dirauth
- env: MODULES_OPTIONS="--disable-module-dirauth" HARDENING_OPTIONS="--enable-expensive-hardening"

## We run rust on Linux, because it's faster than rust on macOS
## We check rust offline
- env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true

## We check NSS
## Use -std=gnu99 to turn off some newer features, and maybe turn on some
## extra gcc warnings?
Expand All @@ -86,31 +73,13 @@ matrix:
## We run `make doxygen` without `make check`.
- env: SKIP_MAKE_CHECK="yes" DOXYGEN="yes"

## macOS builds are very slow, and we have a limited number of
## concurrent macOS jobs. We're not actively developing Rust, so it is
## the lowest priority.
## We run rust on macOS, because we have seen macOS rust failures before
#- env: RUST_VERSION="nightly" RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
# compiler: clang
# os: osx

## Allow the build to report success (with non-required sub-builds
## continuing to run) if all required sub-builds have succeeded.
fast_finish: true

## Careful! We use global envs, which makes it hard to allow failures by env:
## https://docs.travis-ci.com/user/customizing-the-build#matching-jobs-with-allow_failures
allow_failures:
## macOS rust and chutney are very slow, so we let the build finish before
## they are done. We'd like to fast finish, but still eventually show
## any failures in the build status. But Travis doesn't have that ability.

## Since this job is disabled, there's not much point having an exception
## for it
#- env: RUST_VERSION="nightly" RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
# compiler: clang
# os: osx

## Since we're actively developing IPv6, we want to require the IPv6
## chutney tests
#- env: CHUTNEY_MAKE="test-network-ipv6" CHUTNEY="yes" CHUTNEY_ALLOW_FAILURES="2" SKIP_MAKE_CHECK="yes"
Expand Down Expand Up @@ -187,8 +156,6 @@ osx_image: xcode11.2
before_install:
## Set pipefail: we use pipes
- set -o pipefail || echo "pipefail failed"
## Create empty rust directories for non-Rust builds, so caching succeeds
- if [[ "$RUST_OPTIONS" == "" ]]; then mkdir -p $HOME/.cargo $TRAVIS_BUILD_DIR/src/rust/target; fi

install:
## If we're on OSX, configure ccache (ccache is automatically installed and configured on Linux)
Expand All @@ -200,13 +167,6 @@ install:
- if [[ "$COVERAGE_OPTIONS" != "" ]]; then pip install --user cpp-coveralls; fi
## If we're on OSX, and using asciidoc, configure asciidoc
- if [[ "$ASCIIDOC_OPTIONS" == "" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"; fi
## If we're using Rust, download rustup
- if [[ "$RUST_OPTIONS" != "" ]]; then curl -Ssf -o rustup.sh https://sh.rustup.rs; fi
## Install the stable channels of rustc and cargo and setup our toolchain environment
- if [[ "$RUST_OPTIONS" != "" ]]; then sh rustup.sh -y --default-toolchain $RUST_VERSION; fi
- if [[ "$RUST_OPTIONS" != "" ]]; then source $HOME/.cargo/env; fi
## If we're testing rust builds in offline-mode, then set up our vendored dependencies
- if [[ "$TOR_RUST_DEPENDENCIES" == "true" ]]; then export TOR_RUST_DEPENDENCIES=$PWD/src/ext/rust/crates; fi
## If we're running chutney, install it.
- if [[ "$CHUTNEY" != "" ]]; then git clone --depth 1 https://github.com/torproject/chutney.git ; export CHUTNEY_PATH="$(pwd)/chutney"; fi
## If we're running stem, install it.
Expand All @@ -215,13 +175,6 @@ install:
## Finally, list installed package versions
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then dpkg-query --show; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list --versions; fi
## Get some info about rustup, rustc and cargo
- if [[ "$RUST_OPTIONS" != "" ]]; then which rustup; fi
- if [[ "$RUST_OPTIONS" != "" ]]; then which rustc; fi
- if [[ "$RUST_OPTIONS" != "" ]]; then which cargo; fi
- if [[ "$RUST_OPTIONS" != "" ]]; then rustup --version; fi
- if [[ "$RUST_OPTIONS" != "" ]]; then rustc --version; fi
- if [[ "$RUST_OPTIONS" != "" ]]; then cargo --version; fi
## Get python version
- python --version
## If we're running chutney, show the chutney commit
Expand All @@ -240,7 +193,7 @@ script:
# Skip test_rebind and test_include on macOS
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export TOR_SKIP_TEST_REBIND=true; export TOR_SKIP_TEST_INCLUDE=true; fi
- ./autogen.sh
- CONFIGURE_FLAGS="$ASCIIDOC_OPTIONS $COVERAGE_OPTIONS $HARDENING_OPTIONS $MODULES_OPTIONS $NSS_OPTIONS $OPENSSL_OPTIONS $RUST_OPTIONS --enable-fatal-warnings --disable-silent-rules"
- CONFIGURE_FLAGS="$ASCIIDOC_OPTIONS $COVERAGE_OPTIONS $HARDENING_OPTIONS $MODULES_OPTIONS $NSS_OPTIONS $OPENSSL_OPTIONS --enable-fatal-warnings --disable-silent-rules"
- echo "Configure flags are $CONFIGURE_FLAGS CC=\"$CC $C_DIALECT_OPTIONS\""
- ./configure $CONFIGURE_FLAGS CC="$CC $C_DIALECT_OPTIONS";
## We run `make check` because that's what https://jenkins.torproject.org does.
Expand Down Expand Up @@ -270,9 +223,6 @@ after_failure:
before_cache:
## Delete all gcov files.
- if [[ "$COVERAGE_OPTIONS" != "" ]]; then make reset-gcov; fi
## Delete the cargo registry before caching .cargo, because it's cheaper to
## download the registry and throw it away, rather than caching it
- rm -rf $HOME/.cargo/registry

notifications:
irc:
Expand Down
61 changes: 1 addition & 60 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ else
TESTING_TOR_BINARY=$(top_builddir)/src/app/tor$(EXEEXT)
endif

if USE_RUST
rust_ldadd=$(top_builddir)/$(TOR_RUST_LIB_PATH)
else
rust_ldadd=
endif

# "Common" libraries used to link tor's utility code.
TOR_UTIL_LIBS = \
src/lib/libtor-geoip.a \
Expand Down Expand Up @@ -601,51 +595,6 @@ check-typos:
echo "You can install the latest version of misspell here: https://github.com/client9/misspell#install"; \
fi

.PHONY: rustfmt
rustfmt:
if USE_RUST
@if test -x "`which cargo-fmt 2>&1;true`"; then \
echo "Formatting Rust code ..."; \
(cd "$(top_srcdir)/src/rust" && cargo fmt --all --); \
else \
echo "Tor uses rustfmt (via cargo-fmt) to format Rust code."; \
echo "However, it seems that you don't have rustfmt installed."; \
printf "You can install rustfmt by following the directions here:"; \
echo " https://github.com/rust-lang-nursery/rustfmt"; \
fi
endif

.PHONY: check-rustfmt
check-rustfmt:
if USE_RUST
@if test -x "`which cargo-fmt 2>&1;true`"; then \
printf "Running rustfmt..."; \
(cd "$(top_srcdir)/src/rust" && cargo fmt --all -- --check && echo "done.") || \
(echo "**************** check-rustfmt failed. ****************"; \
echo " Run \`make rustfmt\` to apply the above changes."; \
exit 1); \
else \
echo "Tor uses rustfmt (via cargo-fmt) to format Rust code."; \
echo "However, it seems that you don't have rustfmt installed."; \
printf "You can install rustfmt by following the directions here:"; \
echo " https://github.com/rust-lang-nursery/rustfmt"; \
fi
endif

.PHONY: clippy
clippy:
if USE_RUST
@if test -x "`which cargo-clippy 2>&1;true`"; then \
echo "Running cargo clippy ..."; \
echo "Prepare yourself for the onslaught of suggestions ..."; \
(cd "$(top_srcdir)/src/rust" && cargo clippy); \
else \
echo "Tor can use clippy to lint Rust code."; \
echo "However, it seems that you don't have clippy installed."; \
echo "You can install the latest version of clippy by following the directions here: https://github.com/rust-lang-nursery/rust-clippy"; \
fi
endif

.PHONY: check-changes
check-changes:
if USEPYTHON
Expand Down Expand Up @@ -686,22 +635,14 @@ update-copyright:
$(PERL) $(top_srcdir)/scripts/maint/updateCopyright.pl $(OWNED_TOR_C_FILES)

.PHONY: autostyle
autostyle: update-versions rustfmt autostyle-ifdefs rectify-includes
autostyle: update-versions autostyle-ifdefs rectify-includes

mostlyclean-local:
rm -f $(top_builddir)/src/*/*.gc{da,no} $(top_builddir)/src/*/*/*.gc{da,no}
rm -rf $(HTML_COVER_DIR)
rm -rf $(top_builddir)/doc/doxygen
rm -rf $(TEST_NETWORK_ALL_LOG_DIR)

clean-local:
rm -rf $(top_builddir)/src/rust/target
rm -rf $(top_builddir)/src/rust/.cargo/registry

if USE_RUST
distclean-local: distclean-rust
endif

# This relies on some internal details of how automake implements
# distcheck. We check two directories because automake-1.15 changed
# from $(distdir)/_build to $(distdir)/_build/sub.
Expand Down
4 changes: 4 additions & 0 deletions changes/ticket40469
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
o Code simplification and refactoring (rust):
- Remove Rust support and its associated code. It is unsupported and Rust
focus should be shifted to arti. Closes 40469.

24 changes: 24 additions & 0 deletions config.rust
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Used by our cargo build.rs script to get variables from autoconf.
#
# The "configure" script will generate "config.rust" from "config.rust.in",
# and then build.rs will read "config.rust".

BUILDDIR=/home/dgoulet/Documents/git/tor
TOR_LDFLAGS_zlib=
TOR_LDFLAGS_nss=@TOR_LDFLAGS_nss@
TOR_LDFLAGS_openssl=
TOR_LDFLAGS_libevent=
TOR_ZLIB_LIBS=-lz
TOR_LIB_MATH=-lm
TOR_LIBEVENT_LIBS=-levent
TOR_OPENSSL_LIBS=-lssl -lcrypto
TOR_LIB_WS32=
TOR_LIB_GDI=
TOR_LIB_USERENV=
CURVE25519_LIBS=
TOR_SYSTEMD_LIBS=-lsystemd
TOR_LZMA_LIBS=-llzma
TOR_ZSTD_LIBS=-lzstd
LIBS=-lseccomp -lcap
LDFLAGS= -pie -z relro -z now -rdynamic
NSS_LIBS=
24 changes: 0 additions & 24 deletions config.rust.in

This file was deleted.

Loading

0 comments on commit ae9042a

Please sign in to comment.