summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/rust/rust_1.84.1.bb47
1 files changed, 30 insertions, 17 deletions
diff --git a/meta/recipes-devtools/rust/rust_1.84.1.bb b/meta/recipes-devtools/rust/rust_1.84.1.bb
index ee8c782ce3..5a181b059c 100644
--- a/meta/recipes-devtools/rust/rust_1.84.1.bb
+++ b/meta/recipes-devtools/rust/rust_1.84.1.bb
@@ -327,24 +327,37 @@ python do_update_snapshot() {
327 327
328 from collections import defaultdict 328 from collections import defaultdict
329 329
330 with open(os.path.join(d.getVar("S"), "src", "stage0.json")) as f: 330 key_value_pairs = {}
331 j = json.load(f) 331 with open(os.path.join(d.getVar("S"), "src", "stage0")) as f:
332 332 for line in f:
333 config_dist_server = j['config']['dist_server'] 333 # Skip empty lines or comments
334 compiler_date = j['compiler']['date'] 334 if not line.strip() or line.startswith("#"):
335 compiler_version = j['compiler']['version'] 335 continue
336 # Split the line into key and value using '=' as separator
337 match = re.match(r'(\S+)\s*=\s*(\S+)', line.strip())
338 if match:
339 key = match.group(1)
340 value = match.group(2)
341 key_value_pairs[key] = value
342 # Extract the required values from key_value_pairs
343 config_dist_server = key_value_pairs.get('dist_server', '')
344 compiler_date = key_value_pairs.get('compiler_date', '')
345 compiler_version = key_value_pairs.get('compiler_version', '')
336 346
337 src_uri = defaultdict(list) 347 src_uri = defaultdict(list)
338 for k, v in j['checksums_sha256'].items(): 348 # Assuming checksums_sha256 is now a key-value pair like: checksum_key = checksum_value
339 m = re.search(f"dist/{compiler_date}/(?P<component>.*)-{compiler_version}-(?P<arch>.*)-unknown-linux-gnu\\.tar\\.xz", k) 349 for k, v in key_value_pairs.items():
340 if m: 350 # Match the pattern for checksums
341 component = m.group('component') 351 if "dist" in k and "tar.xz" in k:
342 arch = m.group('arch') 352 m = re.search(f"dist/{compiler_date}/(?P<component>.*)-{compiler_version}-(?P<arch>.*)-unknown-linux-gnu\\.tar\\.xz", k)
343 src_uri[arch].append(f"SRC_URI[{component}-snapshot-{arch}.sha256sum] = \"{v}\"") 353 if m:
344 354 component = m.group('component')
355 arch = m.group('arch')
356 src_uri[arch].append(f"SRC_URI[{component}-snapshot-{arch}.sha256sum] = \"{v}\"")
357 # Create the snapshot string with the extracted values
345 snapshot = """\ 358 snapshot = """\
346## This is information on the rust-snapshot (binary) used to build our current release. 359## This is information on the rust-snapshot (binary) used to build our current release.
347## snapshot info is taken from rust/src/stage0.json 360## snapshot info is taken from rust/src/stage0
348## Rust is self-hosting and bootstraps itself with a pre-built previous version of itself. 361## Rust is self-hosting and bootstraps itself with a pre-built previous version of itself.
349## The exact (previous) version that has been used is specified in the source tarball. 362## The exact (previous) version that has been used is specified in the source tarball.
350## The version is replicated here. 363## The version is replicated here.
@@ -352,10 +365,10 @@ python do_update_snapshot() {
352SNAPSHOT_VERSION = "%s" 365SNAPSHOT_VERSION = "%s"
353 366
354""" % compiler_version 367""" % compiler_version
355 368 # Add the checksum components to the snapshot
356 for arch, components in src_uri.items(): 369 for arch, components in src_uri.items():
357 snapshot += "\n".join(components) + "\n\n" 370 snapshot += "\n".join(components) + "\n\n"
358 371 # Add the additional snapshot URIs
359 snapshot += """\ 372 snapshot += """\
360SRC_URI += " \\ 373SRC_URI += " \\
361 ${RUST_DIST_SERVER}/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \\ 374 ${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
369RUSTC_SNAPSHOT = "rustc-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" 382RUSTC_SNAPSHOT = "rustc-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu"
370CARGO_SNAPSHOT = "cargo-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" 383CARGO_SNAPSHOT = "cargo-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu"
371""" % config_dist_server 384""" % config_dist_server
372 385 # Write the updated snapshot information to the rust-snapshot.inc file
373 with open(os.path.join(d.getVar("THISDIR"), "rust-snapshot.inc"), "w") as f: 386 with open(os.path.join(d.getVar("THISDIR"), "rust-snapshot.inc"), "w") as f:
374 f.write(snapshot) 387 f.write(snapshot)
375} 388}