mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 15:10:48 +01:00
Merge branch 'bug25310_r1_033' into maint-0.3.3
This commit is contained in:
commit
95b78d4178
9 changed files with 101 additions and 20 deletions
|
@ -61,10 +61,46 @@ In general, we use modules from only the Rust standard library
|
||||||
whenever possible. We will review including external crates on a
|
whenever possible. We will review including external crates on a
|
||||||
case-by-case basis.
|
case-by-case basis.
|
||||||
|
|
||||||
|
If a crate only contains traits meant for compatibility between Rust
|
||||||
|
crates, such as [the digest crate](https://crates.io/crates/digest) or
|
||||||
|
[the failure crate](https://crates.io/crates/failure), it is very likely
|
||||||
|
permissible to add it as a dependency. However, a brief review should
|
||||||
|
be conducted as to the usefulness of implementing external traits
|
||||||
|
(i.e. how widespread is the usage, how many other crates either
|
||||||
|
implement the traits or have trait bounds based upon them), as well as
|
||||||
|
the stability of the traits (i.e. if the trait is going to change, we'll
|
||||||
|
potentially have to re-do all our implementations of it).
|
||||||
|
|
||||||
|
For large external libraries, especially which implement features which
|
||||||
|
would be labour-intensive to reproduce/maintain ourselves, such as
|
||||||
|
cryptographic or mathematical/statistics libraries, only crates which
|
||||||
|
have stabilised to 1.0.0 should be considered, however, again, we may
|
||||||
|
make exceptions on a case-by-case basis.
|
||||||
|
|
||||||
Currently, Tor requires that you use the latest stable Rust version. At
|
Currently, Tor requires that you use the latest stable Rust version. At
|
||||||
some point in the future, we will freeze on a given stable Rust version,
|
some point in the future, we will freeze on a given stable Rust version,
|
||||||
to ensure backward compatibility with stable distributions that ship it.
|
to ensure backward compatibility with stable distributions that ship it.
|
||||||
|
|
||||||
|
Updating/Adding Dependencies
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
To add/remove/update dependencies, first add your dependencies,
|
||||||
|
exactly specifying their versions, into the appropriate *crate-level*
|
||||||
|
`Cargo.toml` in `src/rust/` (i.e. *not* `/src/rust/Cargo.toml`, but
|
||||||
|
instead the one for your crate). Also, investigate whether your
|
||||||
|
dependency has any optional dependencies which are unnecessary but are
|
||||||
|
enabled by default. If so, you'll likely be able to enable/disable
|
||||||
|
them via some feature, e.g.:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
foo = { version = "1.0.0", default-features = false }
|
||||||
|
```
|
||||||
|
|
||||||
|
Next, run `/scripts/maint/updateRustDependencies.sh`. Then, go into
|
||||||
|
`src/ext/rust` and commit the changes to the `tor-rust-dependencies`
|
||||||
|
repo.
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
|
45
scripts/maint/updateRustDependencies.sh
Executable file
45
scripts/maint/updateRustDependencies.sh
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 The Tor Project, Inc.
|
||||||
|
# Copyright (c) 2018 isis agora lovecruft
|
||||||
|
# See LICENSE for license information
|
||||||
|
#
|
||||||
|
# updateRustDependencies.sh
|
||||||
|
# -------------------------
|
||||||
|
# Update our vendored Rust dependencies, either adding/removing
|
||||||
|
# dependencies and/or upgrading current dependencies to newer
|
||||||
|
# versions.
|
||||||
|
#
|
||||||
|
# To use this script, first add your dependencies, exactly specifying
|
||||||
|
# their versions, into the appropriate *crate-level* Cargo.toml in
|
||||||
|
# src/rust/ (i.e. *not* /src/rust/Cargo.toml, but instead the one for
|
||||||
|
# your crate).
|
||||||
|
#
|
||||||
|
# Next, run this script. Then, go into src/ext/rust and commit the
|
||||||
|
# changes to the tor-rust-dependencies repo.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
HERE=`dirname $(realpath $0)`
|
||||||
|
TOPLEVEL=`dirname $(dirname $HERE)`
|
||||||
|
TOML="$TOPLEVEL/src/rust/Cargo.toml"
|
||||||
|
VENDORED="$TOPLEVEL/src/ext/rust/crates"
|
||||||
|
CARGO=`which cargo`
|
||||||
|
|
||||||
|
if ! test -f "$TOML" ; then
|
||||||
|
printf "Error: Couldn't find workspace Cargo.toml in expected location: %s\n" "$TOML"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! test -d "$VENDORED" ; then
|
||||||
|
printf "Error: Couldn't find directory for Rust dependencies! Expected location: %s\n" "$VENDORED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$CARGO" ; then
|
||||||
|
printf "Error: cargo must be installed and in your \$PATH\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z `cargo --list | grep vendor` ; then
|
||||||
|
printf "Error: cargo-vendor not installed\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$CARGO vendor -v --locked --explicit-version --no-delete --sync $TOML $VENDORED
|
|
@ -1 +1 @@
|
||||||
Subproject commit 240296800824e40b10cb8c16da0e711563353945
|
Subproject commit 2422d7acccc44c633ea825b630ceee6777773cc2
|
28
src/rust/Cargo.lock
generated
28
src/rust/Cargo.lock
generated
|
@ -1,21 +1,13 @@
|
||||||
[root]
|
|
||||||
name = "tor_util"
|
|
||||||
version = "0.0.1"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"tor_allocate 0.0.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "external"
|
name = "external"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.22"
|
version = "0.2.39"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -23,7 +15,7 @@ name = "protover"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"external 0.0.1",
|
"external 0.0.1",
|
||||||
"libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smartlist 0.0.1",
|
"smartlist 0.0.1",
|
||||||
"tor_allocate 0.0.1",
|
"tor_allocate 0.0.1",
|
||||||
"tor_util 0.0.1",
|
"tor_util 0.0.1",
|
||||||
|
@ -33,14 +25,14 @@ dependencies = [
|
||||||
name = "smartlist"
|
name = "smartlist"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tor_allocate"
|
name = "tor_allocate"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -51,5 +43,13 @@ dependencies = [
|
||||||
"tor_util 0.0.1",
|
"tor_util 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tor_util"
|
||||||
|
version = "0.0.1"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"tor_allocate 0.0.1",
|
||||||
|
]
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
"checksum libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" = "babb8281da88cba992fa1f4ddec7d63ed96280a1a53ec9b919fd37b53d71e502"
|
"checksum libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "f54263ad99207254cf58b5f701ecb432c717445ea2ee8af387334bdd1a03fdff"
|
||||||
|
|
2
src/rust/external/Cargo.toml
vendored
2
src/rust/external/Cargo.toml
vendored
|
@ -4,7 +4,7 @@ version = "0.0.1"
|
||||||
name = "external"
|
name = "external"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.22"
|
libc = "=0.2.39"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "external"
|
name = "external"
|
||||||
|
|
|
@ -4,7 +4,7 @@ version = "0.0.1"
|
||||||
name = "protover"
|
name = "protover"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.22"
|
libc = "=0.2.39"
|
||||||
|
|
||||||
[dependencies.smartlist]
|
[dependencies.smartlist]
|
||||||
path = "../smartlist"
|
path = "../smartlist"
|
||||||
|
|
|
@ -4,7 +4,7 @@ version = "0.0.1"
|
||||||
name = "smartlist"
|
name = "smartlist"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.22"
|
libc = "0.2.39"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "smartlist"
|
name = "smartlist"
|
||||||
|
|
|
@ -4,7 +4,7 @@ version = "0.0.1"
|
||||||
name = "tor_allocate"
|
name = "tor_allocate"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.22"
|
libc = "=0.2.39"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "tor_allocate"
|
name = "tor_allocate"
|
||||||
|
|
|
@ -12,5 +12,5 @@ crate_type = ["rlib", "staticlib"]
|
||||||
path = "../tor_allocate"
|
path = "../tor_allocate"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.22"
|
libc = "=0.2.39"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue