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

Add full git commit hash to release channel manifests #44218

Merged
merged 4 commits into from
Sep 7, 2017

Conversation

SimonSapin
Copy link
Contributor

The full hash is necessary to build the download URL for "alternate" compiler builds. This is a first step for rust-lang/rustup#1099.

The full hash is necessary to build the download URL for "alternate"
compiler builds.
This is a first step for
rust-lang/rustup#1099
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

t!(t!(File::create(overlay.join("version"))).write_all(version.as_bytes()));
t!(t!(File::create(overlay.join("git-commit-hash"))).write_all(sha.as_bytes()));
Copy link
Member

Choose a reason for hiding this comment

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

This version file is currently present in a number of tarballs that we produce, and from a consistency point of view it seems odd for the hash to only be in one? Would it be possible to refactor this to ensure there's a git commit file in all the tarballs?

Copy link
Contributor Author

@SimonSapin SimonSapin Sep 1, 2017

Choose a reason for hiding this comment

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

Added for source and extended tarballs. I don’t know if the rust-lang/rust commit hash makes sense in Cargo and RLS tarballs, and the rust-lang/cargo and rust-lang-nursery/rls commit hashes are not easily available.

fn write_channel_files(&self, channel_name: &str, manifest: &Manifest) {
self.write(&toml::to_string(&manifest).unwrap(), channel_name, ".toml");
self.write(&manifest.date, channel_name, "-date.txt");
self.write(&manifest.git_commit_hash, channel_name, "-git-commit-hash.txt");
Copy link
Member

Choose a reason for hiding this comment

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

Do we for sure need a dedicated file for the git commit? This'll already be present in the manifest, and the date.txt was only added much later as a request (ideally this extra file wouldn't exist)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don’t really need it, just like we don’t really need date.txt. A separate file makes it marginally easier for Servo’s bootstrap to extract the commit hash, but we can also parse the TOML file.

I can remove it if you prefer.

@@ -107,6 +107,7 @@ static MINGW: &'static [&'static str] = &[
struct Manifest {
manifest_version: String,
date: String,
git_commit_hash: String,
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 that this commit may be best inside each Package? I'd imagine that maybe eventually we'd have a use for the commit information other than just for rustc but also for cargo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Everything under https://s3.amazonaws.com/rust-lang-ci/rustc-builds are in "subdirectories" named after the rust-lang/rust commit hash, even for other packages like Cargo. But if you prefer I could work on that change in case the Cargo commit hash is needed later for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Figuring out the respective build systems in respective repositories to add text files in various tarballs to make this info available in the first place is non-trivial, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ve made it optional (always missing at the moment for Cargo and RLS) and per-package.

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

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

This seems fine in general but there are a few implementation nits. Others can comment more on the rustup/artifact side.

@@ -364,7 +364,9 @@ impl Step for Rustc {
cp("README.md");
// tiny morsel of metadata is used by rust-packaging
let version = build.rust_version();
let sha = build.rust_sha().unwrap_or("");
Copy link
Member

Choose a reason for hiding this comment

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

<unknown> seems better to me than an empty string, but I'm not sure if it'll work well with other logic. Perhaps we could not create the file if we don't know it instead? Empty files are somewhat painful to debug...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made this omit the file at first, but then I didn’t know how to separate “this tarball does not contain this file” from other kinds of errors in Command::new("tar").arg("xf") …

Any suggestion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe it should be an error to try to build a manifest with ignore-git = true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched to not including the file when the info is missing.

String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr));
}
String::from_utf8_lossy(&output.stdout).trim().to_string()
Copy link
Member

Choose a reason for hiding this comment

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

Maybe I'm not quite following, but why the changes to version()? It still should be doing the same thing, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed a variable name before copy/pasting the method, but it’s otherwise unchanged. I can revert that if you prefer.

@shepmaster shepmaster added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 1, 2017
… instead of writing an empty file.
@@ -167,6 +168,9 @@ struct Builder {
rust_version: String,
cargo_version: String,
rls_version: String,
rust_git_commit_hash: Option<String>,
cargo_git_commit_hash: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

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

It looks like these are never initialized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@alexcrichton
Copy link
Member

Looks good! I think though that cargo/rls tarballs don't have files with the git commit in them?

At the moment it is always missing for Cargo and RLS.
Their respective build systems need to be modified to include
`git-commit-hash` files in their "dist" tarballs.
@SimonSapin
Copy link
Contributor Author

I think though that cargo/rls tarballs don't have files with the git commit in them?

That’s correct. These would need to be added separately. (If someone finds a use for them, they are not used for rust-lang/rustup#1099 which motivates this PR.)

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Sep 5, 2017

📌 Commit f912d77 has been approved by alexcrichton

@Mark-Simulacrum
Copy link
Member

@bors rollup

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Sep 6, 2017
Add full git commit hash to release channel manifests

The full hash is necessary to build the download URL for "alternate" compiler builds. This is a first step for rust-lang/rustup#1099.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Sep 7, 2017
Add full git commit hash to release channel manifests

The full hash is necessary to build the download URL for "alternate" compiler builds. This is a first step for rust-lang/rustup#1099.
bors added a commit that referenced this pull request Sep 7, 2017
@bors bors merged commit f912d77 into rust-lang:master Sep 7, 2017
SimonSapin added a commit to servo/servo that referenced this pull request Sep 8, 2017
… added in rust-lang/rust#44218,
instead of using the GitHub API.

And upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07)
bors-servo pushed a commit to servo/servo that referenced this pull request Sep 8, 2017
Get rustc commit hash from channel manifest

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07), and app_units 0.5.6 (for servo/app_units#37)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18420)
<!-- Reviewable:end -->
bors-servo pushed a commit to servo/servo that referenced this pull request Sep 8, 2017
Get rustc commit hash from channel manifest

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07), and app_units 0.5.6 (for servo/app_units#37)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18420)
<!-- Reviewable:end -->
SimonSapin added a commit to servo/servo that referenced this pull request Sep 9, 2017
… added in rust-lang/rust#44218,
instead of using the GitHub API.

And upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07)
bors-servo pushed a commit to servo/servo that referenced this pull request Sep 9, 2017
Get rustc commit hash from channel manifest

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07), and app_units 0.5.6 (for servo/app_units#37)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18420)
<!-- Reviewable:end -->
SimonSapin added a commit to servo/servo that referenced this pull request Sep 12, 2017
… added in rust-lang/rust#44218,
instead of using the GitHub API.
bors-servo pushed a commit to servo/servo that referenced this pull request Sep 12, 2017
Get rustc commit hash from channel manifest

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18420)
<!-- Reviewable:end -->
SimonSapin added a commit to servo/servo that referenced this pull request Sep 12, 2017
… added in rust-lang/rust#44218,
instead of using the GitHub API.
bors-servo pushed a commit to servo/servo that referenced this pull request Sep 12, 2017
Get rustc commit hash from channel manifest

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18420)
<!-- Reviewable:end -->
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Sep 13, 2017
…om servo:toml); r=nox,emilio

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07).

Source-Repo: https://github.com/servo/servo
Source-Revision: af077a722225193b38d80622fb939b7719b46db0

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 4ec174151648685b4eb0204ec8798d4f82fde9c9
xeonchen pushed a commit to xeonchen/gecko-cinnabar that referenced this pull request Sep 13, 2017
…om servo:toml); r=nox,emilio

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07).

Source-Repo: https://github.com/servo/servo
Source-Revision: af077a722225193b38d80622fb939b7719b46db0
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this pull request Sep 14, 2017
…om servo:toml); r=nox,emilio

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07).

Source-Repo: https://github.com/servo/servo
Source-Revision: af077a722225193b38d80622fb939b7719b46db0
@SimonSapin SimonSapin deleted the commit-hash branch November 16, 2017 17:50
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
…om servo:toml); r=nox,emilio

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07).

Source-Repo: https://github.com/servo/servo
Source-Revision: af077a722225193b38d80622fb939b7719b46db0

UltraBlame original commit: b674d9f6d1d65fba6b68cb847619d1c7d84c0d4c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 2, 2019
…om servo:toml); r=nox,emilio

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07).

Source-Repo: https://github.com/servo/servo
Source-Revision: af077a722225193b38d80622fb939b7719b46db0

UltraBlame original commit: b674d9f6d1d65fba6b68cb847619d1c7d84c0d4c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 2, 2019
…om servo:toml); r=nox,emilio

… added in rust-lang/rust#44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07).

Source-Repo: https://github.com/servo/servo
Source-Revision: af077a722225193b38d80622fb939b7719b46db0

UltraBlame original commit: b674d9f6d1d65fba6b68cb847619d1c7d84c0d4c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants