Skip to content
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

Rewrite make-win-dist.py in Rust #41932

Merged
merged 2 commits into from
May 25, 2017
Merged

Conversation

wesleywiser
Copy link
Member

Fixes #41568

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome looks great to me here, thanks @wesleywiser!

//Ask gcc where it keeps its stuff
let gcc_out =
String::from_utf8(
Command::new("gcc.exe")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With access in Rust, it may actually be best to query build.cc(target) to find the path to gcc here.


for file in &files {
let file_path =
path .iter()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray space?

let file_path =
path .iter()
.map(|dir| dir.join(file))
.find(|p| fs::metadata(&p).is_ok());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nowadays I think for this you can just use p.exists()

let rustc_dlls = find_files(rustc_dlls, &bin_path);
let target_libs = find_files(target_libs, &lib_path);

fn copy(src: &Path, dest_folder: &Path) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a util::copy to use for this as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me like that function assumes dst already refers to a full path name like "C:\rust\test.dll" instead of just the folder name which is what this function handles. I can change this function to call util::copy instead of fs::copy though.

}

let target_tools = vec!["gcc.exe", "ld.exe", "ar.exe", "dlltool.exe"];
let mut rustc_dlls = vec!["libstdc++-6.dll", "libwinpthread-1.dll", "libwinpthread-1.dll"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libwinpthread is mentioned twice here?

.collect();

if key == "programs" {
bin_path.append(&mut value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably use extend here actually to avoid the collect above, dropping a few lines in the process!

@shepmaster shepmaster added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 12, 2017
@wesleywiser
Copy link
Member Author

Updated

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 15, 2017
@@ -98,6 +98,139 @@ pub fn docs(build: &Build, stage: u32, host: &str) {
}
}

fn find_files(files: Vec<&str>, path: &Vec<PathBuf>) -> Vec<PathBuf> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer that this function take files: &[Path], path: &[PathBuf] since it doesn't need a vector for either parameter. Looks like the files are really just strings, in which case &[str] would also be fine.

.stdout).expect("gcc.exe output was not utf8");

let mut bin_path: Vec<_> =
env::split_paths(&env::var_os("PATH").expect("failed to get $PATH"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems better to unwrap_or_default here, since PATH being empty is a decent, if not good, default.

@wesleywiser
Copy link
Member Author

@Mark-Simulacrum Fixed

@Mark-Simulacrum
Copy link
Member

I'll give @alexcrichton the final say, though. But looks good to me!

@alexcrichton
Copy link
Member

@bors: r+

Looks great to me too, thanks so much again @wesleywiser!

@bors
Copy link
Contributor

bors commented May 15, 2017

📌 Commit 173f693 has been approved by alexcrichton

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request May 16, 2017
@Mark-Simulacrum
Copy link
Member

This seemed to fail dist in rollup:

Dist RLS stage2 (x86_64-pc-windows-gnu)
Dist mingw (x86_64-pc-windows-gnu)
thread 'main' panicked at 'failed to copy `C:\projects\rust\mingw64\bin\libstdc++-6.dll` to `C:\projects\rust\build\tmp/dist\bin/libstdc++-6.dll`: The system cannot find the path specified. (os error 3)', src\bootstrap\util.rs:47
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Build completed unsuccessfully in 1:12:20
Command exited with code 101

@Mark-Simulacrum
Copy link
Member

@bors r-

@arielb1 arielb1 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 16, 2017
@Mark-Simulacrum
Copy link
Member

@wesleywiser Have you had a chance to take a look at the failure?

@wesleywiser
Copy link
Member Author

@Mark-Simulacrum I was having some trouble repro'ing it but I think I've got it now. I'll continue looking at it this week.

@wesleywiser
Copy link
Member Author

@Mark-Simulacrum I think that should fix it

@Mark-Simulacrum
Copy link
Member

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented May 23, 2017

📌 Commit 7eebabe has been approved by alexcrichton

@Mark-Simulacrum Mark-Simulacrum added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 23, 2017
@Mark-Simulacrum Mark-Simulacrum removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 23, 2017
@bors
Copy link
Contributor

bors commented May 23, 2017

⌛ Testing commit 7eebabe with merge ce15fd0...

@bors
Copy link
Contributor

bors commented May 23, 2017

💔 Test failed - status-appveyor

@wesleywiser
Copy link
Member Author

Build execution time has reached the maximum allowed time for your plan (180 minutes).

@alexcrichton
Copy link
Member

alexcrichton commented May 23, 2017

@bors
Copy link
Contributor

bors commented May 23, 2017

⌛ Testing commit 7eebabe with merge 1ba03d3...

@bors
Copy link
Contributor

bors commented May 23, 2017

💔 Test failed - status-appveyor

@Mark-Simulacrum
Copy link
Member

@bors retry

  • appveyor timed out

@bors
Copy link
Contributor

bors commented May 24, 2017

⌛ Testing commit 7eebabe with merge 4b21210...

@bors
Copy link
Contributor

bors commented May 24, 2017

💔 Test failed - status-travis

@Mark-Simulacrum
Copy link
Member

@bors retry

  • travis timed out

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request May 24, 2017
@bors
Copy link
Contributor

bors commented May 24, 2017

⌛ Testing commit 7eebabe with merge 2ded772...

@bors
Copy link
Contributor

bors commented May 24, 2017

💔 Test failed - status-appveyor

@Mark-Simulacrum
Copy link
Member

Timeouts, timeouts. It takes us 40 minutes before we even run configure right now, this is probably never going to work until appveyor is fixed realistically.

@bors retry

@bors
Copy link
Contributor

bors commented May 25, 2017

⌛ Testing commit 7eebabe with merge d86d134...

bors added a commit that referenced this pull request May 25, 2017
@bors
Copy link
Contributor

bors commented May 25, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing d86d134 to master...

@bors bors merged commit 7eebabe into rust-lang:master May 25, 2017
@wesleywiser
Copy link
Member Author

Woohooo! Thanks @Mark-Simulacrum and @alexcrichton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants