Skip to content

Commit

Permalink
Untar into the right dir when verifying
Browse files Browse the repository at this point in the history
We'd previously dump it in the package's directory which is wrong when
working in a workspace.

Closes rust-lang#4304
  • Loading branch information
sfackler committed Dec 21, 2017
1 parent e10c651 commit c4565a6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub fn package(ws: &Workspace,
})?;
if opts.verify {
dst.seek(SeekFrom::Start(0))?;
run_verify(ws, dst.file(), opts).chain_err(|| {
run_verify(ws, &dst, opts).chain_err(|| {
"failed to verify package tarball"
})?
}
Expand Down Expand Up @@ -276,15 +276,14 @@ fn tar(ws: &Workspace,
Ok(())
}

fn run_verify(ws: &Workspace, tar: &File, opts: &PackageOpts) -> CargoResult<()> {
fn run_verify(ws: &Workspace, tar: &FileLock, opts: &PackageOpts) -> CargoResult<()> {
let config = ws.config();
let pkg = ws.current()?;

config.shell().status("Verifying", pkg)?;

let f = GzDecoder::new(tar)?;
let dst = pkg.root().join(&format!("target/package/{}-{}",
pkg.name(), pkg.version()));
let f = GzDecoder::new(tar.file())?;
let dst = tar.parent().join(&format!("{}-{}", pkg.name(), pkg.version()));
if fs::metadata(&dst).is_ok() {
fs::remove_dir_all(&dst)?;
}
Expand Down

0 comments on commit c4565a6

Please sign in to comment.