Skip to content

Commit

Permalink
Auto merge of #3272 - cuviper:openssl-1.1.0, r=alexcrichton
Browse files Browse the repository at this point in the history
Update dependencies for OpenSSL 1.1.0 compatibility

The primary targets here are openssl and openssl-sys crates 0.9,
bringing support for OpenSSL 1.1.0.  This requires updating the curl
and git2 related dependencies as well.

A small change is required in cargo itself for the new Hasher API.
Results from the hasher are simply unwrapped for now, matching the
Windows behavior that already panics on error.
  • Loading branch information
bors committed Nov 14, 2016
2 parents f6500c6 + 15acaa9 commit 9f1beaf
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 199 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
Expand Up @@ -24,17 +24,12 @@ matrix:
MAKE_TARGETS="test distcheck doc install uninstall"
MACOSX_DEPLOYMENT_TARGET=10.7
os: osx
before_install:
- export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
- export OPENSSL_LIB_DIR=`brew --prefix openssl`/include
- env: TARGET=i686-apple-darwin
MAKE_TARGETS=test
MACOSX_DEPLOYMENT_TARGET=10.7
CFG_DISABLE_CROSS_TESTS=1
os: osx
before_install:
- export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
- export OPENSSL_LIB_DIR=`brew --prefix openssl`/include
install: brew uninstall openssl && brew install openssl --universal --without-test

# stable musl target, tested
- env: TARGET=x86_64-unknown-linux-musl
Expand Down Expand Up @@ -127,6 +122,11 @@ notifications:
email:
on_success: never

branches:
only:
- master
- auto-cargo

before_deploy:
- mkdir -p deploy/$TRAVIS_COMMIT
- cp target/$TARGET/release/dist/cargo-nightly-$TARGET.tar.gz
Expand All @@ -140,9 +140,9 @@ deploy:
upload_dir: cargo-master
acl: public_read
region: us-west-1
access_key_id: AKIAJYHGN72KKCN4DFBQ
access_key_id: AKIAIWZDM2B2IJOWBGTA
secret_access_key:
secure: wKKDMYBVTdWLuc7+ffpjTqJs1EdM2pXpV6keUfZGv9RLRta+esh/r/cgc+UQ7+m9JHAliH8eWhlMm5ws6WDgkTvM0PTdqWBgwd24BRbAitsXX2kWfi9WgAeSJVSkIJdZ999TRpRIJu7Zc+1++fbfdD/tDv5XBirQGOJv1HynVWY=
secure: NB9b/MhIDiv8OtNiN/sHaFgA3xG2fa7MGuQQKJNj80ktvgByzDm5UPNyNeoYx9SmJ3jOWobgcPVaoUd2S+6XgO3bMBqm7sM/oMeE0KdqToh6+V2bKfyRF2U5fm697LEGepPIBYqMLDg4nr/dbknbKltzp6dAfJRyy22Nb721zPQ=
on:
branch: auto-cargo
condition: $DEPLOY = 1
Expand Down
270 changes: 121 additions & 149 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Expand Up @@ -20,18 +20,18 @@ path = "src/cargo/lib.rs"
advapi32-sys = "0.2"
crates-io = { path = "src/crates-io", version = "0.4" }
crossbeam = "0.2"
curl = "0.3"
curl = "0.4"
docopt = "0.6"
env_logger = "0.3"
filetime = "0.1"
flate2 = "0.2"
fs2 = "0.2"
git2 = "0.4"
git2-curl = "0.5"
fs2 = "0.3"
git2 = "0.6"
git2-curl = "0.7"
glob = "0.2"
kernel32-sys = "0.2"
libc = "0.2"
libgit2-sys = "0.4"
libgit2-sys = "0.6"
log = "0.3"
miow = "0.1"
num_cpus = "1.0"
Expand All @@ -47,7 +47,7 @@ url = "1.1"
winapi = "0.2"

[target.'cfg(unix)'.dependencies]
openssl = "0.7"
openssl = "0.9"

[dev-dependencies]
hamcrest = "0.1"
Expand Down
8 changes: 2 additions & 6 deletions Makefile.in
Expand Up @@ -251,13 +251,9 @@ target/openssl/$(1).stamp: target/openssl/openssl-$$(OPENSSL_VERS).tar.gz \

# variables read by various build scripts to find openssl
cargo-$(1): export OPENSSL_STATIC := 1
cargo-$(1): export OPENSSL_ROOT_DIR := $$(OPENSSL_INSTALL_$(1))
cargo-$(1): export OPENSSL_LIB_DIR := $$(OPENSSL_INSTALL_$(1))/lib
cargo-$(1): export OPENSSL_INCLUDE_DIR := $$(OPENSSL_INSTALL_$(1))/include
cargo-$(1): export OPENSSL_DIR := $$(OPENSSL_INSTALL_$(1))
test-unit-$(1): export OPENSSL_STATIC := 1
test-unit-$(1): export OPENSSL_ROOT_DIR := $$(OPENSSL_INSTALL_$(1))
test-unit-$(1): export OPENSSL_LIB_DIR := $$(OPENSSL_INSTALL_$(1))/lib
test-unit-$(1): export OPENSSL_INCLUDE_DIR := $$(OPENSSL_INSTALL_$(1))/include
test-unit-$(1): export OPENSSL_DIR := $$(OPENSSL_INSTALL_$(1))

# build libz statically into the cargo we're producing
cargo-$(1): export LIBZ_SYS_STATIC := 1
Expand Down
9 changes: 7 additions & 2 deletions appveyor.yml
Expand Up @@ -52,16 +52,21 @@ after_test:
- copy target\%TARGET%\release\dist\cargo-nightly-%TARGET%.tar.gz
%APPVEYOR_REPO_COMMIT%

branches:
only:
- master
- auto-cargo

artifacts:
- path: $(APPVEYOR_REPO_COMMIT)\cargo-nightly-$(TARGET).tar.gz
name: cargo

deploy:
- provider: S3
skip_cleanup: true
access_key_id: AKIAIIBSE766REJRCHEA
access_key_id: AKIAIWZDM2B2IJOWBGTA
secret_access_key:
secure: S3MCw/gXyWBuq8cW+eFQjbfjccxrH1koYqQxsYDvCDkM7D2PLqd88yv8lND7dVt0
secure: hyH54di5NyNdV+jjntM1dRN/NeUgDidwZmwcg4/UKpdJqGf1AAwYb2ulXYK67CXA
bucket: rust-lang-cargo-dev
set_public: true
region: us-west-1
Expand Down
8 changes: 5 additions & 3 deletions src/cargo/util/sha256.rs
Expand Up @@ -7,13 +7,14 @@ mod imp {
extern crate openssl;

use std::io::Write;
use self::openssl::crypto::hash::{Hasher, Type};
use self::openssl::hash::{Hasher, MessageDigest};

pub struct Sha256(Hasher);

impl Sha256 {
pub fn new() -> Sha256 {
Sha256(Hasher::new(Type::SHA256))
let hasher = Hasher::new(MessageDigest::sha256()).unwrap();
Sha256(hasher)
}

pub fn update(&mut self, bytes: &[u8]) {
Expand All @@ -22,7 +23,8 @@ mod imp {

pub fn finish(&mut self) -> [u8; 32] {
let mut ret = [0u8; 32];
ret.copy_from_slice(&self.0.finish()[..]);
let data = self.0.finish().unwrap();
ret.copy_from_slice(&data[..]);
ret
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/crates-io/Cargo.toml
Expand Up @@ -13,6 +13,6 @@ name = "crates_io"
path = "lib.rs"

[dependencies]
curl = "0.3"
curl = "0.4"
url = "1.0"
rustc-serialize = "0.3"
11 changes: 7 additions & 4 deletions tests/build-auth.rs
Expand Up @@ -41,7 +41,7 @@ fn http_auth_offered() {
assert_eq!(req, vec![
"GET /foo/bar/info/refs?service=git-upload-pack HTTP/1.1",
"Accept: */*",
"User-Agent: git/1.0 (libgit2 0.23.0)",
"User-Agent: git/1.0 (libgit2 0.24.0)",
].into_iter().map(|s| s.to_string()).collect());
drop(s);

Expand All @@ -56,7 +56,7 @@ fn http_auth_offered() {
"GET /foo/bar/info/refs?service=git-upload-pack HTTP/1.1",
"Authorization: Basic Zm9vOmJhcg==",
"Accept: */*",
"User-Agent: git/1.0 (libgit2 0.23.0)",
"User-Agent: git/1.0 (libgit2 0.24.0)",
].into_iter().map(|s| s.to_string()).collect());
});

Expand Down Expand Up @@ -127,7 +127,10 @@ fn https_something_happens() {
let a = TcpListener::bind("127.0.0.1:0").unwrap();
let addr = a.local_addr().unwrap();
let t = thread::spawn(move|| {
drop(a.accept().unwrap());
let mut s = a.accept().unwrap().0;
drop(s.write(b"1234"));
drop(s.shutdown(std::net::Shutdown::Write));
drop(s.read(&mut [0; 16]));
});

let p = project("foo")
Expand Down Expand Up @@ -164,7 +167,7 @@ Caused by:
// just not verify the error message here.
"[..]"
} else {
"[[..]] SSL error: [..]"
"[..] SSL error: [..]"
})));

t.join().ok().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion tests/cargotest/Cargo.toml
Expand Up @@ -11,7 +11,7 @@ bufstream = "0.1"
cargo = { path = "../.." }
filetime = "0.1"
flate2 = "0.2"
git2 = "0.4"
git2 = { version = "0.6", default-features = false }
hamcrest = "0.1"
kernel32-sys = "0.2"
libc = "0.2"
Expand Down
31 changes: 18 additions & 13 deletions tests/cargotest/support/mod.rs
Expand Up @@ -366,24 +366,29 @@ impl Execs {
let mut a = actual.lines();
let e = out.lines();

let diffs = if partial {
let mut min = self.diff_lines(a.clone(), e.clone(), partial);
if partial {
let mut diffs = self.diff_lines(a.clone(), e.clone(), partial);
while let Some(..) = a.next() {
let a = self.diff_lines(a.clone(), e.clone(), partial);
if a.len() < min.len() {
min = a;
if a.len() < diffs.len() {
diffs = a;
}
}
min
ham::expect(diffs.is_empty(),
format!("expected to find:\n\
{}\n\n\
did not find in output:\n\
{}", out,
actual))
} else {
self.diff_lines(a, e, partial)
};
ham::expect(diffs.is_empty(),
format!("differences:\n\
{}\n\n\
other output:\n\
`{}`", diffs.join("\n"),
String::from_utf8_lossy(extra)))
let diffs = self.diff_lines(a, e, partial);
ham::expect(diffs.is_empty(),
format!("differences:\n\
{}\n\n\
other output:\n\
`{}`", diffs.join("\n"),
String::from_utf8_lossy(extra)))
}

}

Expand Down
7 changes: 4 additions & 3 deletions tests/freshness.rs
Expand Up @@ -199,15 +199,16 @@ fn rebuild_tests_if_lib_changes() {
#[test]
fn test() { foo::foo(); }
"#);
p.build();

assert_that(p.cargo_process("build"),
p.root().move_into_the_past();

assert_that(p.cargo("build"),
execs().with_status(0));
assert_that(p.cargo("test"),
execs().with_status(0));

File::create(&p.root().join("src/lib.rs")).unwrap();
p.root().move_into_the_past();
p.root().join("target").move_into_the_past();

assert_that(p.cargo("build"),
execs().with_status(0));
Expand Down
6 changes: 3 additions & 3 deletions tests/net-config.rs
Expand Up @@ -26,7 +26,7 @@ fn net_retry_loads_from_config() {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
.with_stderr_contains("[WARNING] spurious network error \
(1 tries remaining): [2/-1] [..]"));
(1 tries remaining): [..]"));
}

#[test]
Expand All @@ -50,7 +50,7 @@ fn net_retry_git_outputs_warning() {
assert_that(p.cargo_process("build").arg("-v").arg("-j").arg("1"),
execs().with_status(101)
.with_stderr_contains("[WARNING] spurious network error \
(2 tries remaining): [2/-1] [..]")
(2 tries remaining): [..]")
.with_stderr_contains("\
[WARNING] spurious network error (1 tries remaining): [2/-1] [..]"));
[WARNING] spurious network error (1 tries remaining): [..]"));
}

0 comments on commit 9f1beaf

Please sign in to comment.