-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix(publish): Move .crate
out of final artifact location
#15915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
epage
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
epage:publish-move-crate
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,11 +160,8 @@ fn create_package( | |
} | ||
|
||
let filename = pkg.package_id().tarball_name(); | ||
let dir = ws.build_dir().join("package"); | ||
let mut dst = { | ||
let tmp = format!(".{}", filename); | ||
dir.open_rw_exclusive_create(&tmp, gctx, "package scratch space")? | ||
}; | ||
let dir = ws.build_dir().join("package").join("tmp-crate"); | ||
let dst = dir.open_rw_exclusive_create(&filename, gctx, "package scratch space")?; | ||
Comment on lines
+163
to
+164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this will cause a behavior change, Ive marked this as a draft while we wait for #15910 to propagate to users so they can prepare. |
||
|
||
// Package up and test a temporary tarball and only move it to the final | ||
// location if it actually passes all our tests. Any previously existing | ||
|
@@ -176,14 +173,10 @@ fn create_package( | |
let uncompressed_size = tar(ws, opts, pkg, local_reg, ar_files, dst.file(), &filename) | ||
.context("failed to prepare local package for uploading")?; | ||
|
||
dst.seek(SeekFrom::Start(0))?; | ||
let dst_path = dst.parent().join(&filename); | ||
dst.rename(&dst_path)?; | ||
|
||
let dst_metadata = dst | ||
.file() | ||
.metadata() | ||
.with_context(|| format!("could not learn metadata for: `{}`", dst_path.display()))?; | ||
.with_context(|| format!("could not learn metadata for: `{}`", dst.path().display()))?; | ||
let compressed_size = dst_metadata.len(); | ||
|
||
let uncompressed = HumanBytes(uncompressed_size); | ||
|
@@ -217,22 +210,15 @@ pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult<Vec<Fi | |
|
||
let packaged = do_package(ws, opts, pkgs)?; | ||
|
||
// Uplifting artifacts | ||
let mut result = Vec::new(); | ||
let target_dir = ws.target_dir(); | ||
let build_dir = ws.build_dir(); | ||
if target_dir == build_dir { | ||
result.extend(packaged.into_iter().map(|(_, _, src)| src)); | ||
} else { | ||
// Uplifting artifacts | ||
let artifact_dir = target_dir.join("package"); | ||
for (pkg, _, src) in packaged { | ||
let filename = pkg.package_id().tarball_name(); | ||
let dst = | ||
artifact_dir.open_rw_exclusive_create(filename, ws.gctx(), "uplifted package")?; | ||
src.file().seek(SeekFrom::Start(0))?; | ||
std::io::copy(&mut src.file(), &mut dst.file())?; | ||
result.push(dst); | ||
} | ||
let artifact_dir = ws.target_dir().join("package"); | ||
for (pkg, _, src) in packaged { | ||
let filename = pkg.package_id().tarball_name(); | ||
let dst = artifact_dir.open_rw_exclusive_create(filename, ws.gctx(), "uplifted package")?; | ||
src.file().seek(SeekFrom::Start(0))?; | ||
std::io::copy(&mut src.file(), &mut dst.file())?; | ||
result.push(dst); | ||
} | ||
|
||
Ok(result) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready for merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For myself, if we want an intermediate period, I feel like more than one release is probably needed.