mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Rollup merge of #110059 - gimbles:git-hash, r=ozkanonur
ignore_git → omit_git_hash Fixes #110020
This commit is contained in:
commit
ec1712f06e
@ -585,7 +585,7 @@ changelog-seen = 2
|
|||||||
# Having the git information can cause a lot of rebuilds during development.
|
# Having the git information can cause a lot of rebuilds during development.
|
||||||
#
|
#
|
||||||
# FIXME(#76720): this can causes bugs if different compilers reuse the same metadata cache.
|
# FIXME(#76720): this can causes bugs if different compilers reuse the same metadata cache.
|
||||||
#ignore-git = if rust.channel == "dev" { true } else { false }
|
#omit-git-hash = if rust.channel == "dev" { true } else { false }
|
||||||
|
|
||||||
# Whether to create a source tarball by default when running `x dist`.
|
# Whether to create a source tarball by default when running `x dist`.
|
||||||
#
|
#
|
||||||
|
@ -19,7 +19,7 @@ pub enum GitInfo {
|
|||||||
#[default]
|
#[default]
|
||||||
Absent,
|
Absent,
|
||||||
/// This is a git repository.
|
/// This is a git repository.
|
||||||
/// If the info should be used (`ignore_git` is false), this will be
|
/// If the info should be used (`omit_git_hash` is false), this will be
|
||||||
/// `Some`, otherwise it will be `None`.
|
/// `Some`, otherwise it will be `None`.
|
||||||
Present(Option<Info>),
|
Present(Option<Info>),
|
||||||
/// This is not a git repostory, but the info can be fetched from the
|
/// This is not a git repostory, but the info can be fetched from the
|
||||||
@ -35,7 +35,7 @@ pub struct Info {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl GitInfo {
|
impl GitInfo {
|
||||||
pub fn new(ignore_git: bool, dir: &Path) -> GitInfo {
|
pub fn new(omit_git_hash: bool, dir: &Path) -> GitInfo {
|
||||||
// See if this even begins to look like a git dir
|
// See if this even begins to look like a git dir
|
||||||
if !dir.join(".git").exists() {
|
if !dir.join(".git").exists() {
|
||||||
match read_commit_info_file(dir) {
|
match read_commit_info_file(dir) {
|
||||||
@ -52,7 +52,7 @@ impl GitInfo {
|
|||||||
|
|
||||||
// If we're ignoring the git info, we don't actually need to collect it, just make sure this
|
// If we're ignoring the git info, we don't actually need to collect it, just make sure this
|
||||||
// was a git repo in the first place.
|
// was a git repo in the first place.
|
||||||
if ignore_git {
|
if omit_git_hash {
|
||||||
return GitInfo::Present(None);
|
return GitInfo::Present(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ pub struct Config {
|
|||||||
pub tools: Option<HashSet<String>>,
|
pub tools: Option<HashSet<String>>,
|
||||||
pub sanitizers: bool,
|
pub sanitizers: bool,
|
||||||
pub profiler: bool,
|
pub profiler: bool,
|
||||||
pub ignore_git: bool,
|
pub omit_git_hash: bool,
|
||||||
pub exclude: Vec<TaskPath>,
|
pub exclude: Vec<TaskPath>,
|
||||||
pub include_default_paths: bool,
|
pub include_default_paths: bool,
|
||||||
pub rustc_error_format: Option<String>,
|
pub rustc_error_format: Option<String>,
|
||||||
@ -764,7 +764,7 @@ define_config! {
|
|||||||
verbose_tests: Option<bool> = "verbose-tests",
|
verbose_tests: Option<bool> = "verbose-tests",
|
||||||
optimize_tests: Option<bool> = "optimize-tests",
|
optimize_tests: Option<bool> = "optimize-tests",
|
||||||
codegen_tests: Option<bool> = "codegen-tests",
|
codegen_tests: Option<bool> = "codegen-tests",
|
||||||
ignore_git: Option<bool> = "ignore-git",
|
omit_git_hash: Option<bool> = "omit-git-hash",
|
||||||
dist_src: Option<bool> = "dist-src",
|
dist_src: Option<bool> = "dist-src",
|
||||||
save_toolstates: Option<String> = "save-toolstates",
|
save_toolstates: Option<String> = "save-toolstates",
|
||||||
codegen_backends: Option<Vec<String>> = "codegen-backends",
|
codegen_backends: Option<Vec<String>> = "codegen-backends",
|
||||||
@ -1097,7 +1097,7 @@ impl Config {
|
|||||||
let mut debuginfo_level_tools = None;
|
let mut debuginfo_level_tools = None;
|
||||||
let mut debuginfo_level_tests = None;
|
let mut debuginfo_level_tests = None;
|
||||||
let mut optimize = None;
|
let mut optimize = None;
|
||||||
let mut ignore_git = None;
|
let mut omit_git_hash = None;
|
||||||
|
|
||||||
if let Some(rust) = toml.rust {
|
if let Some(rust) = toml.rust {
|
||||||
debug = rust.debug;
|
debug = rust.debug;
|
||||||
@ -1118,7 +1118,7 @@ impl Config {
|
|||||||
.map(|v| v.expect("invalid value for rust.split_debuginfo"))
|
.map(|v| v.expect("invalid value for rust.split_debuginfo"))
|
||||||
.unwrap_or(SplitDebuginfo::default_for_platform(&config.build.triple));
|
.unwrap_or(SplitDebuginfo::default_for_platform(&config.build.triple));
|
||||||
optimize = rust.optimize;
|
optimize = rust.optimize;
|
||||||
ignore_git = rust.ignore_git;
|
omit_git_hash = rust.omit_git_hash;
|
||||||
config.rust_new_symbol_mangling = rust.new_symbol_mangling;
|
config.rust_new_symbol_mangling = rust.new_symbol_mangling;
|
||||||
set(&mut config.rust_optimize_tests, rust.optimize_tests);
|
set(&mut config.rust_optimize_tests, rust.optimize_tests);
|
||||||
set(&mut config.codegen_tests, rust.codegen_tests);
|
set(&mut config.codegen_tests, rust.codegen_tests);
|
||||||
@ -1175,8 +1175,8 @@ impl Config {
|
|||||||
|
|
||||||
// rust_info must be set before is_ci_llvm_available() is called.
|
// rust_info must be set before is_ci_llvm_available() is called.
|
||||||
let default = config.channel == "dev";
|
let default = config.channel == "dev";
|
||||||
config.ignore_git = ignore_git.unwrap_or(default);
|
config.omit_git_hash = omit_git_hash.unwrap_or(default);
|
||||||
config.rust_info = GitInfo::new(config.ignore_git, &config.src);
|
config.rust_info = GitInfo::new(config.omit_git_hash, &config.src);
|
||||||
|
|
||||||
if let Some(llvm) = toml.llvm {
|
if let Some(llvm) = toml.llvm {
|
||||||
match llvm.ccache {
|
match llvm.ccache {
|
||||||
|
@ -358,14 +358,14 @@ impl Build {
|
|||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
let is_sudo = false;
|
let is_sudo = false;
|
||||||
|
|
||||||
let ignore_git = config.ignore_git;
|
let omit_git_hash = config.omit_git_hash;
|
||||||
let rust_info = channel::GitInfo::new(ignore_git, &src);
|
let rust_info = channel::GitInfo::new(omit_git_hash, &src);
|
||||||
let cargo_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/cargo"));
|
let cargo_info = channel::GitInfo::new(omit_git_hash, &src.join("src/tools/cargo"));
|
||||||
let rust_analyzer_info =
|
let rust_analyzer_info =
|
||||||
channel::GitInfo::new(ignore_git, &src.join("src/tools/rust-analyzer"));
|
channel::GitInfo::new(omit_git_hash, &src.join("src/tools/rust-analyzer"));
|
||||||
let clippy_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/clippy"));
|
let clippy_info = channel::GitInfo::new(omit_git_hash, &src.join("src/tools/clippy"));
|
||||||
let miri_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/miri"));
|
let miri_info = channel::GitInfo::new(omit_git_hash, &src.join("src/tools/miri"));
|
||||||
let rustfmt_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/rustfmt"));
|
let rustfmt_info = channel::GitInfo::new(omit_git_hash, &src.join("src/tools/rustfmt"));
|
||||||
|
|
||||||
// we always try to use git for LLVM builds
|
// we always try to use git for LLVM builds
|
||||||
let in_tree_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-project"));
|
let in_tree_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-project"));
|
||||||
@ -1233,7 +1233,7 @@ impl Build {
|
|||||||
match &self.config.channel[..] {
|
match &self.config.channel[..] {
|
||||||
"stable" => num.to_string(),
|
"stable" => num.to_string(),
|
||||||
"beta" => {
|
"beta" => {
|
||||||
if self.rust_info().is_managed_git_subrepository() && !self.config.ignore_git {
|
if self.rust_info().is_managed_git_subrepository() && !self.config.omit_git_hash {
|
||||||
format!("{}-beta.{}", num, self.beta_prerelease_version())
|
format!("{}-beta.{}", num, self.beta_prerelease_version())
|
||||||
} else {
|
} else {
|
||||||
format!("{}-beta", num)
|
format!("{}-beta", num)
|
||||||
|
@ -320,7 +320,7 @@ pub fn prepare_tool_cargo(
|
|||||||
cargo.env("CFG_RELEASE_NUM", &builder.version);
|
cargo.env("CFG_RELEASE_NUM", &builder.version);
|
||||||
cargo.env("DOC_RUST_LANG_ORG_CHANNEL", builder.doc_rust_lang_org_channel());
|
cargo.env("DOC_RUST_LANG_ORG_CHANNEL", builder.doc_rust_lang_org_channel());
|
||||||
|
|
||||||
let info = GitInfo::new(builder.config.ignore_git, &dir);
|
let info = GitInfo::new(builder.config.omit_git_hash, &dir);
|
||||||
if let Some(sha) = info.sha() {
|
if let Some(sha) = info.sha() {
|
||||||
cargo.env("CFG_COMMIT_HASH", sha);
|
cargo.env("CFG_COMMIT_HASH", sha);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,6 @@ RUN sh /scripts/sccache.sh
|
|||||||
# We are disabling CI LLVM since distcheck is an offline build.
|
# We are disabling CI LLVM since distcheck is an offline build.
|
||||||
ENV NO_DOWNLOAD_CI_LLVM 1
|
ENV NO_DOWNLOAD_CI_LLVM 1
|
||||||
|
|
||||||
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --set rust.ignore-git=false
|
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --set rust.omit-git-hash=false
|
||||||
ENV SCRIPT python3 ../x.py --stage 2 test distcheck
|
ENV SCRIPT python3 ../x.py --stage 2 test distcheck
|
||||||
ENV DIST_SRC 1
|
ENV DIST_SRC 1
|
||||||
|
Loading…
Reference in New Issue
Block a user