Skip to content

Detect local-rebuild by just the MAJOR.MINOR version #37273

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

Merged
merged 1 commit into from
Oct 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ endif
# versions in the same place
CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(CFG_HASH_COMMAND))

# If local-rust is the same as the current version, then force a local-rebuild
# If local-rust is the same major.minor as the current version, then force a local-rebuild
ifdef CFG_ENABLE_LOCAL_RUST
ifeq ($(CFG_RELEASE),\
$(shell $(S)src/etc/local_stage0.sh --print-rustc-release $(CFG_LOCAL_RUST_ROOT)))
CFG_INFO := $(info cfg: auto-detected local-rebuild $(CFG_RELEASE))
SEMVER_PREFIX=$(shell echo $(CFG_RELEASE_NUM) | grep -E -o '^[[:digit:]]+\.[[:digit:]]+')
LOCAL_RELEASE=$(shell $(S)src/etc/local_stage0.sh --print-rustc-release $(CFG_LOCAL_RUST_ROOT))
ifneq (,$(filter $(SEMVER_PREFIX).%,$(LOCAL_RELEASE)))
CFG_INFO := $(info cfg: auto-detected local-rebuild using $(LOCAL_RELEASE))
CFG_ENABLE_LOCAL_REBUILD = 1
endif
endif
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ impl Build {
sanity::check(self);
self.verbose("collecting channel variables");
channel::collect(self);
// If local-rust is the same as the current version, then force a local-rebuild
// If local-rust is the same major.minor as the current version, then force a local-rebuild
let local_version_verbose = output(
Command::new(&self.rustc).arg("--version").arg("--verbose"));
let local_release = local_version_verbose
.lines().filter(|x| x.starts_with("release:"))
.next().unwrap().trim_left_matches("release:").trim();
if local_release == self.release {
self.verbose(&format!("auto-detected local-rebuild {}", self.release));
if local_release.split('.').take(2).eq(self.release.split('.').take(2)) {
self.verbose(&format!("auto-detected local-rebuild {}", local_release));
self.local_rebuild = true;
}
self.verbose("updating submodules");
Expand Down