Closed Bug 1163214 Opened 4 years ago Closed 4 years ago

Add a minimum version check for rustc

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(firefox40 affected, firefox41 fixed)

RESOLVED FIXED
mozilla41
Tracking Status
firefox40 --- affected
firefox41 --- fixed

People

(Reporter: rillian, Assigned: rillian)

References

Details

Attachments

(2 files)

In addition to checking for the rust compiler's existence, we should check its version against some minimum in case people have old, pre-1.0 installs in their path.

from https://bugzilla.mozilla.org/show_bug.cgi?id=1161339#c22
`rustc --version --verbose` gives each bit of information on a separate line, and so may be easier to parse. Example output on my system:

$ rustc --version
rustc 1.1.0-nightly (7bd71637c 2015-05-06) (built 2015-05-06)

$ rustc --version --verbose
rustc 1.1.0-nightly (7bd71637c 2015-05-06) (built 2015-05-06)
binary: rustc
commit-hash: 7bd71637ca40910dbd310813a19abf76db84f8f6
commit-date: 2015-05-06
build-date: 2015-05-06
host: x86_64-unknown-linux-gnu
release: 1.1.0-nightly
Thanks. Looks like the first line is still the same, but parsing the release line might be safer than parsing the single line?
Right, the first line is the same. I don’t know what language these checks are written in, but if it’s something like bash this should work: `rustc -Vv|grep release:|cut -d' ' -f2`
Incidental fixup
(In reply to Simon Sapin (:SimonSapin) from comment #3)
> Right, the first line is the same. I don’t know what language these checks
> are written in, but if it’s something like bash this should work: `rustc
> -Vv|grep release:|cut -d' ' -f2`

Yep, that works. I don't see how it's more reliable than `rustc -V|cut -d' ' -f2` though?

The real difficulty is parsing and comparing semvers in bash. :/
How's this? We can add an additional clause to reject 1.0.0 pre-releases next week after the first stable release is published.
Attachment #8604737 - Flags: review?(ted)
Attachment #8604340 - Flags: review?(ted)
Comment on attachment 8604737 [details] [diff] [review]
Add rustc minimum version check

Review of attachment 8604737 [details] [diff] [review]:
-----------------------------------------------------------------

::: configure.in
@@ +438,5 @@
> +  _RUSTC_MINOR_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 2`
> +  _RUSTC_EXTRA_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 3 | cut -d + -f 1`
> +  _RUSTC_PATCH_VERSION=`echo ${_RUSTC_EXTRA_VERSION} | cut -d '-' -f 1`
> +  _RUSTC_PRERELEASE_VERSION=`echo $_{RUSTC_EXTRA_VERSION} | cut -d '-' -f 2`
> +  _RUSTC_BUILD_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 3 | cut -d + -f 2`

I would say leave the extra/patch/prerelease/build bits out until we need them.
Attachment #8604737 - Flags: review?(ted) → review+
Comment on attachment 8604340 [details] [diff] [review]
Align --enable-rust help text

Review of attachment 8604340 [details] [diff] [review]:
-----------------------------------------------------------------

rs=me to fix formatting stuff like this without explicit review in the future.
Attachment #8604340 - Flags: review?(ted) → review+
Oh, sorry, I missed your comment there. If you want to add the "reject prereleases" stuff, then keep that in.
Thanks for the review. I removed the SUFFIX and BUILD variables for now. Post-1.0 rustc is using a train model, which will hopefully keep things regular enough we won't need more than the version number.
https://hg.mozilla.org/mozilla-central/rev/399e3553eb7f
https://hg.mozilla.org/mozilla-central/rev/611907765657
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Depends on: 1167222
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.