From e5f4c6ad7578ef073fa47c6e2815196a5ac82b3a Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Thu, 4 Jan 2024 12:08:20 -0700 Subject: [PATCH] rust: add v1.75.0 & v1.74.0, merge related variants into `+dev`, add rust-analyzer (#41903) * Add rust-analyzer as variant to rust build * Expose cargo module only when +cargo * rust: add v1.74.0 and v1.75.0 and remove variants in favor of +dev * [@spackbot] updating style on behalf of alecbcs * Fix variant typo --------- Co-authored-by: alecbcs --- .../py-tensorboard-data-server/package.py | 2 +- .../packages/rust-bootstrap/package.py | 11 +++++ .../repos/builtin/packages/rust/package.py | 45 ++++++++----------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-tensorboard-data-server/package.py b/var/spack/repos/builtin/packages/py-tensorboard-data-server/package.py index 76da263c3b..2b0882a2d1 100644 --- a/var/spack/repos/builtin/packages/py-tensorboard-data-server/package.py +++ b/var/spack/repos/builtin/packages/py-tensorboard-data-server/package.py @@ -18,7 +18,7 @@ class PyTensorboardDataServer(PythonPackage): version("0.6.1", commit="6acf0be88b5727e546dd64a8b9b12d790601d561") depends_on("py-setuptools", type="build") - depends_on("rust+rustfmt", type="build") + depends_on("rust+dev", type="build") # https://github.com/tensorflow/tensorboard/issues/5713 patch( diff --git a/var/spack/repos/builtin/packages/rust-bootstrap/package.py b/var/spack/repos/builtin/packages/rust-bootstrap/package.py index a8e9f7baae..63a57eece1 100644 --- a/var/spack/repos/builtin/packages/rust-bootstrap/package.py +++ b/var/spack/repos/builtin/packages/rust-bootstrap/package.py @@ -21,6 +21,17 @@ class RustBootstrap(Package): # should update these binary releases as bootstrapping requirements are # modified by new releases of Rust. rust_releases = { + "1.75.0": { + "darwin": { + "x86_64": "ad066e4dec7ae5948c4e7afe68e250c336a5ab3d655570bb119b3eba9cf22851", + "aarch64": "878ecf81e059507dd2ab256f59629a4fb00171035d2a2f5638cb582d999373b1", + }, + "linux": { + "x86_64": "473978b6f8ff216389f9e89315211c6b683cf95a966196e7914b46e8cf0d74f6", + "aarch64": "30828cd904fcfb47f1ac43627c7033c903889ea4aca538f53dcafbb3744a9a73", + "powerpc64le": "2599cdfea5860b4efbceb7bca69845a96ac1c96aa50cf8261151e82280b397a0", + }, + }, "1.73.0": { "darwin": { "x86_64": "ece9646bb153d4bc0f7f1443989de0cbcd8989a7d0bf3b7fb9956e1223954f0c", diff --git a/var/spack/repos/builtin/packages/rust/package.py b/var/spack/repos/builtin/packages/rust/package.py index 8d0784d95a..5282b6dd73 100644 --- a/var/spack/repos/builtin/packages/rust/package.py +++ b/var/spack/repos/builtin/packages/rust/package.py @@ -18,11 +18,13 @@ class Rust(Package): maintainers("alecbcs") + license("Apache-2.0 OR MIT") + # When adding a version of Rust you may need to add an additional version # to rust-bootstrap as the minimum bootstrapping requirements increase. # As a general rule of thumb Rust can be built with either the previous major # version or the current version of the compiler as shown above. - + # # Pre-release versions. # Note: If you plan to use these versions remember to install with # `-n` to prevent Spack from failing due to failed checksums. @@ -34,11 +36,21 @@ class Rust(Package): version("nightly") # Stable versions. + version("1.75.0", sha256="5b739f45bc9d341e2d1c570d65d2375591e22c2d23ef5b8a37711a0386abc088") + version("1.74.0", sha256="882b584bc321c5dcfe77cdaa69f277906b936255ef7808fcd5c7492925cf1049") version("1.73.0", sha256="96d62e6d1f2d21df7ac8acb3b9882411f9e7c7036173f7f2ede9e1f1f6b1bb3a") version("1.70.0", sha256="b2bfae000b7a5040e4ec4bbc50a09f21548190cb7570b0ed77358368413bd27c") version("1.65.0", sha256="5828bb67f677eabf8c384020582b0ce7af884e1c84389484f7f8d00dd82c0038") version("1.60.0", sha256="20ca826d1cf674daf8e22c4f8c4b9743af07973211c839b85839742314c838b7") + variant( + "dev", + default=False, + description="Include rust developer tools like rustfmt, clippy, and rust-analyzer.", + ) + variant("docs", default=False, description="Build Rust core documentation.") + variant("src", default=True, description="Include standard library source files.") + # Core dependencies depends_on("cmake@3.13.4:", type="build") depends_on("curl+nghttp2") @@ -63,20 +75,8 @@ class Rust(Package): depends_on("rust-bootstrap@1.64:1.65", type="build", when="@1.65") depends_on("rust-bootstrap@1.69:1.70", type="build", when="@1.70") depends_on("rust-bootstrap@1.72:1.73", type="build", when="@1.73") - - variant( - "analysis", - default=False, - description="Outputs code analysis that can be consumed by other tools", - ) - variant( - "clippy", - default=True, - description="A bunch of lints to catch common mistakes and improve your Rust code.", - ) - variant("docs", default=False, description="Build Rust documentation.") - variant("rustfmt", default=True, description="Formatting tool for Rust code.") - variant("src", default=True, description="Include standard library source files.") + depends_on("rust-bootstrap@1.73:1.74", type="build", when="@1.74") + depends_on("rust-bootstrap@1.74:1.75", type="build", when="@1.75") extendable = True executables = ["^rustc$", "^cargo$"] @@ -149,23 +149,16 @@ def configure(self, spec, prefix): # Convert opts to '--set key=value' format. flags = [flag for opt in opts for flag in ("--set", opt)] - # Include both cargo and rustdoc in minimal install to match - # standard download of rust. - tools = ["cargo", "rustdoc"] + # Core rust tools to install. + tools = ["cargo"] # Add additional tools as directed by the package variants. - if spec.satisfies("+analysis"): - tools.append("analysis") - - if spec.satisfies("+clippy"): - tools.append("clippy") + if spec.satisfies("+dev"): + tools.extend(["clippy", "rustdoc", "rustfmt", "rust-analyzer"]) if spec.satisfies("+src"): tools.append("src") - if spec.satisfies("+rustfmt"): - tools.append("rustfmt") - # Compile tools into flag for configure. flags.append(f"--tools={','.join(tools)}")