Auto merge of #6514 - ehuss:beta-fingerprint-patch, r=alexcrichton

[BETA] Fix fingerprint calculation for patched deps.

Backport of #6493.
Also includes the following to pass CI:
- #6417
- Bump min version in CI for `trim_end`.
This commit is contained in:
bors 2019-01-02 21:49:06 +00:00
commit 8610973aaf
5 changed files with 63 additions and 10 deletions

View File

@ -36,7 +36,7 @@ matrix:
# increased every 6 weeks or so when the first PR to use a new feature.
- env: TARGET=x86_64-unknown-linux-gnu
ALT=i686-unknown-linux-gnu
rust: 1.28.0
rust: 1.31.0
script:
- rustup toolchain install nightly
- cargo +nightly generate-lockfile -Z minimal-versions

View File

@ -11,7 +11,7 @@ install:
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- if defined MINIMAL_VERSIONS rustup toolchain install 1.28.0
- if defined MINIMAL_VERSIONS rustup toolchain install 1.31.0
- if defined OTHER_TARGET rustup target add %OTHER_TARGET%
- rustc -V
- cargo -V
@ -25,5 +25,5 @@ test_script:
# we don't have ci time to run the full `cargo test` with `minimal-versions` like
# - if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +stable test
# so we just run `cargo check --tests` like
- if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +1.28.0 check --tests
- if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +1.31.0 check --tests
- if NOT defined MINIMAL_VERSIONS cargo test

View File

@ -466,7 +466,7 @@ impl BuildOutput {
let key = iter.next();
let value = iter.next();
let (key, value) = match (key, value) {
(Some(a), Some(b)) => (a, b.trim_right()),
(Some(a), Some(b)) => (a, b.trim_end()),
// line started with `cargo:` but didn't match `key=value`
_ => bail!("Wrong output in {}: `{}`", whence, line),
};

View File

@ -228,7 +228,6 @@ struct MtimeSlot(Mutex<Option<FileTime>>);
impl Fingerprint {
fn update_local(&self, root: &Path) -> CargoResult<()> {
let mut hash_busted = false;
for local in self.local.iter() {
match *local {
LocalFingerprint::MtimeBased(ref slot, ref path) => {
@ -238,12 +237,9 @@ impl Fingerprint {
}
LocalFingerprint::EnvBased(..) | LocalFingerprint::Precalculated(..) => continue,
}
hash_busted = true;
}
if hash_busted {
*self.memoized_hash.lock().unwrap() = None;
}
*self.memoized_hash.lock().unwrap() = None;
Ok(())
}

View File

@ -4,7 +4,7 @@ use std::io::prelude::*;
use support::paths::CargoPathExt;
use support::registry::Package;
use support::sleep_ms;
use support::{basic_manifest, project};
use support::{basic_manifest, is_coarse_mtime, project};
#[test]
fn modifying_and_moving() {
@ -1177,3 +1177,60 @@ fn reuse_panic_pm() {
)
.run();
}
#[test]
fn bust_patched_dep() {
Package::new("registry1", "0.1.0").publish();
Package::new("registry2", "0.1.0")
.dep("registry1", "0.1.0")
.publish();
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
[dependencies]
registry2 = "0.1.0"
[patch.crates-io]
registry1 = { path = "reg1new" }
"#,
)
.file("src/lib.rs", "")
.file("reg1new/Cargo.toml", &basic_manifest("registry1", "0.1.0"))
.file("reg1new/src/lib.rs", "")
.build();
p.cargo("build").run();
File::create(&p.root().join("reg1new/src/lib.rs")).unwrap();
if is_coarse_mtime() {
sleep_ms(1000);
}
p.cargo("build")
.with_stderr(
"\
[COMPILING] registry1 v0.1.0 ([..])
[COMPILING] registry2 v0.1.0
[COMPILING] foo v0.0.1 ([..])
[FINISHED] [..]
",
)
.run();
p.cargo("build -v")
.with_stderr(
"\
[FRESH] registry1 v0.1.0 ([..])
[FRESH] registry2 v0.1.0
[FRESH] foo v0.0.1 ([..])
[FINISHED] [..]
",
)
.run();
}