rust: Update "do_update_snapshot" task for rust-snapshot.inc
PATCH v2 1/3 rust: Update "do_update_snapshot" task for rust-snapshot.inc
From: Yash Shinde <[email protected]>
The 'do_update_snapshot' task is failed with below error:
Exception: FileNotFoundError: [Errno 2] No such file or directory: '.../rustc-1.83.0-src/src/stage0.json'
There are changes in use of key-value format in stage0 file in rust sources and the rust recipe should be apdated for that.
Changes in rust:
https://github.com/rust-lang/rust/commit/1adfffd07f8704ca722f3897719ace079944b0c5
--- meta/recipes-devtools/rust/rust_1.84.1.bb | 47 +++++++++++++++-------- 1 file changed, 30 insertions(+), 17 deletions(-)
meta/recipes-devtools/rust/rust_1.84.1.bb +30 -17
@@ -327,24 +327,37 @@ python do_update_snapshot() { from collections import defaultdict - with open(os.path.join(d.getVar("S"), "src", "stage0.json")) as f: - j = json.load(f) - - config_dist_server = j['config']['dist_server'] - compiler_date = j['compiler']['date'] - compiler_version = j['compiler']['version'] + key_value_pairs = {} + with open(os.path.join(d.getVar("S"), "src", "stage0")) as f: + for line in f: + # Skip empty lines or comments + if not line.strip() or line.startswith("#"): + continue + # Split the line into key and value using '=' as separator + match = re.match(r'(\S+)\s*=\s*(\S+)', line.strip()) + if match: + key = match.group(1) + value = match.group(2) + key_value_pairs[key] = value + # Extract the required values from key_value_pairs + config_dist_server = key_value_pairs.get('dist_server', '') + compiler_date = key_value_pairs.get('compiler_date', '') + compiler_version = key_value_pairs.get('compiler_version', '') src_uri = defaultdict(list) - for k, v in j['checksums_sha256'].items(): - m = re.search(f"dist/{compiler_date}/(?P<component>.*)-{compiler_version}-(?P<arch>.*)-unknown-linux-gnu\\.tar\\.xz", k) - if m: - component = m.group('component') - arch = m.group('arch') - src_uri[arch].append(f"SRC_URI[{component}-snapshot-{arch}.sha256sum] = \"{v}\"") - + # Assuming checksums_sha256 is now a key-value pair like: checksum_key = checksum_value + for k, v in key_value_pairs.items(): + # Match the pattern for checksums + if "dist" in k and "tar.xz" in k: + m = re.search(f"dist/{compiler_date}/(?P<component>.*)-{compiler_version}-(?P<arch>.*)-unknown-linux-gnu\\.tar\\.xz", k) + if m: + component = m.group('component') + arch = m.group('arch') + src_uri[arch].append(f"SRC_URI[{component}-snapshot-{arch}.sha256sum] = \"{v}\"") + # Create the snapshot string with the extracted values snapshot = """\ ## This is information on the rust-snapshot (binary) used to build our current release. -## snapshot info is taken from rust/src/stage0.json +## snapshot info is taken from rust/src/stage0 ## Rust is self-hosting and bootstraps itself with a pre-built previous version of itself. ## The exact (previous) version that has been used is specified in the source tarball. ## The version is replicated here.
@@ -352,10 +365,10 @@ python do_update_snapshot() { SNAPSHOT_VERSION = "%s" """ % compiler_version - + # Add the checksum components to the snapshot for arch, components in src_uri.items(): snapshot += "\n".join(components) + "\n\n" - + # Add the additional snapshot URIs snapshot += """\ SRC_URI += " \\ ${RUST_DIST_SERVER}/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \\
@@ -369,7 +382,7 @@ RUST_STD_SNAPSHOT = "rust-std-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-lin RUSTC_SNAPSHOT = "rustc-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" CARGO_SNAPSHOT = "cargo-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" """ % config_dist_server - + # Write the updated snapshot information to the rust-snapshot.inc file with open(os.path.join(d.getVar("THISDIR"), "rust-snapshot.inc"), "w") as f: f.write(snapshot) }
Signature · 1 line
2.43.0
PATCH v2 2/3 rust: Upgrade 1.84.1->1.85.0
From: Yash Shinde <[email protected]>
Rust stable version updated to 1.85.0
https://blog.rust-lang.org/2025/02/20/Rust-1.85.0.html
Some of the major updates:
- Update LIC_FILES_CHKSUM in libstd-rs and rust recipes.
License-Update: Update Unicode license text to Unicode-3.0 License.
https://github.com/rust-lang/rust/commit/6d2a3e9786ec43a0e0af20386e7046328296ac86
- Pass '-Zforce-unstable-if-unmarked' to RUSTFLAGS in libstd-rs.bb
Fix: https://github.com/rust-lang/rust/issues/133857#issuecomment-2526341227
- Downgrade bootstrap cc version causing bootstrap to fail on custom targets. (Backported from v1.85.1)
Fix: https://github.com/rust-lang/rust/pull/137460/commits/e4ca11f87ffca8c63aa56d45b46e62b6acc58bd7
- Explicitly set float ABI for all ARM 32 bits targets.
Fix: https://github.com/rust-lang/rust/commit/a51fefcaab835b310e2e26005b50982d0049d905
- Rust v1.85.0 tarball doesn't ship gcc tree. Drop the unpack:append() which removed it and prevented the bloat.
Fix: https://github.com/rust-lang/rust/commit/13c3f9b9498013837782b46120085ea19ca75518
Adapted the patch changes with v1.85.0:
repro-issue-fix-with-cc-crate-hashmap.patch revert-link-std-statically-in-rustc_driver-feature.patch rust-oe-selftest.patch rv32-cargo-rustix-0.38.40-fix.patch
Dropped patches:
fix-tidy-check-failure.patch since it's merged with v1.85.0.
---
.../classes-recipe/rust-target-config.bbclass | 5 +
meta/conf/distro/include/tcmode-default.inc | 2 +-
.../rust/{cargo_1.84.1.bb => cargo_1.85.0.bb} | 0
.../rust/files/downgrade-bootstrap-cc.patch | 41 +++
.../rust/files/fix-tidy-check-failure.patch | 19 --
...epro-issue-fix-with-cc-crate-hashmap.patch | 60 ++++-
...d-statically-in-rustc_driver-feature.patch | 4 +-
.../rust/files/rust-oe-selftest.patch | 46 ++--
.../files/rv32-cargo-rustix-0.38.38-fix.patch | 236 ------------------
.../files/rv32-cargo-rustix-0.38.40-fix.patch | 236 ++++++++++++++++++
...ibstd-rs_1.84.1.bb => libstd-rs_1.85.0.bb} | 4 +-
....84.1.bb => rust-cross-canadian_1.85.0.bb} | 0
...ust-llvm_1.84.1.bb => rust-llvm_1.85.0.bb} | 0
meta/recipes-devtools/rust/rust-snapshot.inc | 81 +++---
meta/recipes-devtools/rust/rust-source.inc | 23 +-
.../rust/{rust_1.84.1.bb => rust_1.85.0.bb} | 2 +-
16 files changed, 417 insertions(+), 342 deletions(-)
rename meta/recipes-devtools/rust/{cargo_1.84.1.bb => cargo_1.85.0.bb} (100%)
create mode 100644 meta/recipes-devtools/rust/files/downgrade-bootstrap-cc.patch
delete mode 100644 meta/recipes-devtools/rust/files/fix-tidy-check-failure.patch
delete mode 100644 meta/recipes-devtools/rust/files/rv32-cargo-rustix-0.38.38-fix.patch
create mode 100644 meta/recipes-devtools/rust/files/rv32-cargo-rustix-0.38.40-fix.patch
rename meta/recipes-devtools/rust/{libstd-rs_1.84.1.bb => libstd-rs_1.85.0.bb} (88%)
rename meta/recipes-devtools/rust/{rust-cross-canadian_1.84.1.bb => rust-cross-canadian_1.85.0.bb} (100%)
rename meta/recipes-devtools/rust/{rust-llvm_1.84.1.bb => rust-llvm_1.85.0.bb} (100%)
rename meta/recipes-devtools/rust/{rust_1.84.1.bb => rust_1.85.0.bb} (99%)meta/classes-recipe/rust-target-config.bbclass +5 -0
@@ -391,6 +391,11 @@ def rust_gen_target(d, thing, wd, arch): tspec['cpu'] = cpu if features != "": tspec['features'] = features + fpu = d.getVar('TARGET_FPU') + if fpu == "soft": + tspec['llvm-floatabi'] = "soft" + elif fpu == "hard": + tspec['llvm-floatabi'] = "hard" tspec['dynamic-linking'] = True tspec['executables'] = True tspec['linker-is-gnu'] = True
meta/conf/distro/include/tcmode-default.inc +1 -1
@@ -12,7 +12,7 @@ PREFERRED_PROVIDER_virtual/gettext ??= "gettext" GCCVERSION ?= "14.%" SDKGCCVERSION ?= "${GCCVERSION}" GLIBCVERSION ?= "2.41%" -RUSTVERSION ?= "1.84.1%" +RUSTVERSION ?= "1.85.0%" PREFERRED_VERSION_gcc ?= "${GCCVERSION}" PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "${GCCVERSION}"
meta/recipes-devtools/rust/cargo_1.85.0.bb renamed from meta/recipes-devtools/rust/cargo_1.84.1.bb +0 -0
meta/recipes-devtools/rust/files/downgrade-bootstrap-cc.patch new file +41 -0
41 lines not on this page · raw message
meta/recipes-devtools/rust/files/fix-tidy-check-failure.patch deleted +0 -19
@@ -1,19 +0,0 @@ -fix a comment with uneven number of backticks in rustc_mir_build - -Upstream-Status: Backport [https://github.com/rust-lang/rust/commit/8e7734978245522cbbd14e53e08e888faf031ded] - -Signed-off-by: Deepesh Varatharajan <[email protected]> ---- -diff --git a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs -index 3f89e33778..c66af11845 100644 ---- a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs -+++ b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs -@@ -231,7 +231,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { - if range.start <= range.end { BinOp::BitAnd } else { BinOp::BitOr }; - - let mut comparer = |range: u128, bin_op: BinOp| -> Place<'tcx> { -- // We can use `ty::TypingEnv::fully_monomorphized()`` here -+ // We can use `ty::TypingEnv::fully_monomorphized()` here - // as we only need it to compute the layout of a primitive. - let range_val = Const::from_bits( - this.tcx,
meta/recipes-devtools/rust/files/repro-issue-fix-with-cc-crate-hashmap.patch +58 -2
77 lines not on this page · raw message
meta/recipes-devtools/rust/files/revert-link-std-statically-in-rustc_driver-feature.patch +2 -2
@@ -40,9 +40,9 @@ index 39fa23766b..51d86b4009 100644 -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::FxHashMap; - use rustc_hir::def_id::CrateNum; + use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; + use rustc_index::IndexVec; use rustc_middle::bug; - use rustc_middle::middle::dependency_format::{Dependencies, DependencyList, Linkage}; @@ -161,44 +161,19 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList { } Linkage::Dynamic | Linkage::IncludedFromDylib => {}
meta/recipes-devtools/rust/files/rust-oe-selftest.patch +23 -23
102 lines not on this page · raw message
meta/recipes-devtools/rust/files/rv32-cargo-rustix-0.38.38-fix.patch deleted +0 -236
236 lines not on this page · raw message
meta/recipes-devtools/rust/files/rv32-cargo-rustix-0.38.40-fix.patch new file +236 -0
236 lines not on this page · raw message
meta/recipes-devtools/rust/libstd-rs_1.85.0.bb renamed from meta/recipes-devtools/rust/libstd-rs_1.84.1.bb +3 -1
@@ -2,7 +2,7 @@ SUMMARY = "Rust standard libaries" HOMEPAGE = "http://www.rust-lang.org" SECTION = "devel" LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" -LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=c2cccf560306876da3913d79062a54b9" +LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=9c0fae516fe8aaea2fb601db4800daf7" require rust-source.inc
@@ -24,6 +24,8 @@ DEPENDS:remove:riscv64 = "libunwind" # Embed bitcode in order to allow compiling both with and without LTO RUSTFLAGS += "-Cembed-bitcode=yes" +# Ensure that user code can't access the dependencies of the standard library +RUSTFLAGS += "-Zforce-unstable-if-unmarked" # Needed so cargo can find libbacktrace RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so"
meta/recipes-devtools/rust/rust-cross-canadian_1.85.0.bb renamed from meta/recipes-devtools/rust/rust-cross-canadian_1.84.1.bb +0 -0
meta/recipes-devtools/rust/rust-llvm_1.85.0.bb renamed from meta/recipes-devtools/rust/rust-llvm_1.84.1.bb +0 -0
meta/recipes-devtools/rust/rust-snapshot.inc +41 -40
106 lines not on this page · raw message
meta/recipes-devtools/rust/rust-source.inc +6 -17
@@ -1,30 +1,19 @@ RUST_VERSION ?= "${@d.getVar('PV').split('-')[0]}" SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;name=rust \ - file://rv32-cargo-rustix-0.38.38-fix.patch;patchdir=${RUSTSRC} \ + file://rv32-cargo-rustix-0.38.40-fix.patch;patchdir=${RUSTSRC} \ file://rust-oe-selftest.patch;patchdir=${RUSTSRC} \ - file://repro-issue-fix-with-cc-crate-hashmap.patch;patchdir=${RUSTSRC} \ + file://repro-issue-fix-with-cc-crate-hashmap.patch;patchdir=${RUSTSRC} \ file://oeqa-selftest-Increase-timeout-in-process-sigpipe-ru.patch;patchdir=${RUSTSRC} \ file://0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch;patchdir=${RUSTSRC} \ - file://revert-link-std-statically-in-rustc_driver-feature.patch;patchdir=${RUSTSRC} \ - file://Zdual-proc-macros-additional-check.patch;patchdir=${RUSTSRC} \ - file://fix-tidy-check-failure.patch;patchdir=${RUSTSRC} \ + file://revert-link-std-statically-in-rustc_driver-feature.patch;patchdir=${RUSTSRC} \ + file://Zdual-proc-macros-additional-check.patch;patchdir=${RUSTSRC} \ + file://downgrade-bootstrap-cc.patch;patchdir=${RUSTSRC} \ " -SRC_URI[rust.sha256sum] = "e23ec747a06ffd3e94155046f40b6664ac152c9ee3c2adfd90353a7ccff24226" +SRC_URI[rust.sha256sum] = "d542c397217b5ba5bac7eb274f5ca62d031f61842c3ba4cc5328c709c38ea1e7" RUSTSRC = "${WORKDIR}/rustc-${RUST_VERSION}-src" -#After updating to Rust 1.85 we can revert this removal of "src/gcc" -remove_gcc_directory() { - # Ensure the gcc directory exists - gcc_dir="${RUSTSRC}/src/gcc" - if [ -d "$gcc_dir" ]; then - rm -rf "$gcc_dir" - fi -} -# Add postfunc to the do_unpack task -do_unpack[postfuncs] += "remove_gcc_directory" - UPSTREAM_CHECK_URI = "https://forge.rust-lang.org/infra/other-installation-methods.html" UPSTREAM_CHECK_REGEX = "rustc-(?P<pver>\d+(\.\d+)+)-src"
meta/recipes-devtools/rust/rust_1.85.0.bb renamed from meta/recipes-devtools/rust/rust_1.84.1.bb +1 -1
@@ -2,7 +2,7 @@ SUMMARY = "Rust compiler and runtime libaries" HOMEPAGE = "http://www.rust-lang.org" SECTION = "devel" LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" -LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=c2cccf560306876da3913d79062a54b9" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=9c0fae516fe8aaea2fb601db4800daf7" inherit rust inherit cargo_common
Signature · 1 line
2.43.0
PATCH v2 3/3 rust: Upgrade 1.85.0->1.85.1
In reply to [email protected]From: Yash Shinde <[email protected]>
Rust stable version updated to 1.85.1
https://blog.rust-lang.org/2025/03/18/Rust-1.85.1.html
Dropped patches:
downgrade-bootstrap-cc.patch since it's merged with v1.85.1.
---
meta/conf/distro/include/tcmode-default.inc | 2 +-
.../rust/{cargo_1.85.0.bb => cargo_1.85.1.bb} | 0
.../rust/files/downgrade-bootstrap-cc.patch | 41 -------------------
...ibstd-rs_1.85.0.bb => libstd-rs_1.85.1.bb} | 0
....85.0.bb => rust-cross-canadian_1.85.1.bb} | 0
...ust-llvm_1.85.0.bb => rust-llvm_1.85.1.bb} | 0
meta/recipes-devtools/rust/rust-source.inc | 3 +-
.../rust/{rust_1.85.0.bb => rust_1.85.1.bb} | 0
8 files changed, 2 insertions(+), 44 deletions(-)
rename meta/recipes-devtools/rust/{cargo_1.85.0.bb => cargo_1.85.1.bb} (100%)
delete mode 100644 meta/recipes-devtools/rust/files/downgrade-bootstrap-cc.patch
rename meta/recipes-devtools/rust/{libstd-rs_1.85.0.bb => libstd-rs_1.85.1.bb} (100%)
rename meta/recipes-devtools/rust/{rust-cross-canadian_1.85.0.bb => rust-cross-canadian_1.85.1.bb} (100%)
rename meta/recipes-devtools/rust/{rust-llvm_1.85.0.bb => rust-llvm_1.85.1.bb} (100%)
rename meta/recipes-devtools/rust/{rust_1.85.0.bb => rust_1.85.1.bb} (100%)meta/conf/distro/include/tcmode-default.inc +1 -1
@@ -12,7 +12,7 @@ PREFERRED_PROVIDER_virtual/gettext ??= "gettext" GCCVERSION ?= "14.%" SDKGCCVERSION ?= "${GCCVERSION}" GLIBCVERSION ?= "2.41%" -RUSTVERSION ?= "1.85.0%" +RUSTVERSION ?= "1.85.1%" PREFERRED_VERSION_gcc ?= "${GCCVERSION}" PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "${GCCVERSION}"
meta/recipes-devtools/rust/cargo_1.85.1.bb renamed from meta/recipes-devtools/rust/cargo_1.85.0.bb +0 -0
meta/recipes-devtools/rust/files/downgrade-bootstrap-cc.patch deleted +0 -41
41 lines not on this page · raw message
meta/recipes-devtools/rust/libstd-rs_1.85.1.bb renamed from meta/recipes-devtools/rust/libstd-rs_1.85.0.bb +0 -0
meta/recipes-devtools/rust/rust-cross-canadian_1.85.1.bb renamed from meta/recipes-devtools/rust/rust-cross-canadian_1.85.0.bb +0 -0
meta/recipes-devtools/rust/rust-llvm_1.85.1.bb renamed from meta/recipes-devtools/rust/rust-llvm_1.85.0.bb +0 -0
meta/recipes-devtools/rust/rust-source.inc +1 -2
@@ -8,9 +8,8 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n file://0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch;patchdir=${RUSTSRC} \ file://revert-link-std-statically-in-rustc_driver-feature.patch;patchdir=${RUSTSRC} \ file://Zdual-proc-macros-additional-check.patch;patchdir=${RUSTSRC} \ - file://downgrade-bootstrap-cc.patch;patchdir=${RUSTSRC} \ " -SRC_URI[rust.sha256sum] = "d542c397217b5ba5bac7eb274f5ca62d031f61842c3ba4cc5328c709c38ea1e7" +SRC_URI[rust.sha256sum] = "b1fbf809efe9f036939401e142631c201a53bcf43ec1696bd9f5290ba236a266" RUSTSRC = "${WORKDIR}/rustc-${RUST_VERSION}-src"
meta/recipes-devtools/rust/rust_1.85.1.bb renamed from meta/recipes-devtools/rust/rust_1.85.0.bb +0 -0
Signature · 1 line
2.43.0