message: Fingerprint build script deps only for path packages.
diff: @@ -480,13 +480,21 @@ fn calculate<'a, 'cfg>(
  let local = if use_dep_info(unit) {
  let dep_info = dep_info_loc(cx, unit);
  let mtime = dep_info_mtime_if_fresh(unit.pkg, &dep_info)?;
  - LocalFingerprint::mtime(cx.files().target_root(), mtime, &dep_info)
  - } else {
  - let fingerprint = pkg_fingerprint(&cx.bcx, unit.pkg)?;
  - LocalFingerprint::Precalculated(fingerprint)
  - };
  - let mut local = vec![local];
  - // Include fingerprint for any build scripts this unit requires.
  + let mut local = vec![LocalFingerprint::mtime(
  + cx.files().target_root(),
  + mtime,
  + &dep_info,
  + )];
  + // Include the fingerprint of the build script.
  + //
  + // This is not included for dependencies (Precalculated below) because
  + // Docker zeros the nanosecond part of the mtime when the image is
  + // saved, which prevents built dependencies from being cached.
  + // This has the consequence that if a dependency needs to be rebuilt
  + // (such as an environment variable tracked via rerun-if-env-changed),
  + // and you run two separate commands (`build` then `test`), the second
  + // command will erroneously think it is fresh.
  + // See: https://github.com/rust-lang/cargo/issues/6733
  local.extend(
  cx.dep_targets(unit)
  .iter()
  @@ -510,6 +518,11 @@ fn calculate<'a, 'cfg>(
  })
  }),
  );
  + local
  + } else {
  + let fingerprint = pkg_fingerprint(&cx.bcx, unit.pkg)?;
  + vec![LocalFingerprint::Precalculated(fingerprint)]
  + };
  let extra_flags = if unit.mode.is_doc() {
  bcx.rustdocflags_args(unit)?
  