[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    [OE-Core][PATCH 1/4] rust: Move RUST_DIST_SERVER to rust-config.inc
From:       "Alex Kiernan" <alex.kiernan () gmail ! com>
Date:       2023-12-30 15:49:50
Message-ID: 20231230154953.8135-1-alex.kiernan () gmail ! com
[Download RAW message or body]

Content-Transfer-Encoding: 8bit

Overriding the location of RUST_DIST_SERVER is useful for testing rust
pre-releases, but we need it in rust-source and rust-snapshot; move
RUST_DIST_SERVER to rust-config.inc so we can set it to
`dev-static.rust-lang.org` and use it from both locations.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---

 meta/recipes-devtools/rust/rust-config.inc   |  1 +
 meta/recipes-devtools/rust/rust-snapshot.inc |  2 --
 meta/recipes-devtools/rust/rust-source.inc   |  4 +++-
 meta/recipes-devtools/rust/rust_1.74.1.bb    | 11 ++++++++---
 4 files changed, 12 insertions(+), 6 deletions(-)
 create mode 100644 meta/recipes-devtools/rust/rust-config.inc

diff --git a/meta/recipes-devtools/rust/rust-config.inc \
b/meta/recipes-devtools/rust/rust-config.inc new file mode 100644
index 000000000000..9fd360616bc4
--- /dev/null
+++ b/meta/recipes-devtools/rust/rust-config.inc
@@ -0,0 +1 @@
+RUST_DIST_SERVER ??= "https://static.rust-lang.org"
diff --git a/meta/recipes-devtools/rust/rust-snapshot.inc \
b/meta/recipes-devtools/rust/rust-snapshot.inc index ffc1aed2957c..b67e42d27063 \
                100644
--- a/meta/recipes-devtools/rust/rust-snapshot.inc
+++ b/meta/recipes-devtools/rust/rust-snapshot.inc
@@ -52,8 +52,6 @@ SRC_URI += " \
     ${RUST_DIST_SERVER}/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \
\  "
 
-RUST_DIST_SERVER = "https://static.rust-lang.org"
-
 RUST_STD_SNAPSHOT = \
"rust-std-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu"  RUSTC_SNAPSHOT = \
"rustc-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu"  CARGO_SNAPSHOT = \
                "cargo-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu"
diff --git a/meta/recipes-devtools/rust/rust-source.inc \
b/meta/recipes-devtools/rust/rust-source.inc index 83a0dbc15fae..fdac009c6d20 100644
--- a/meta/recipes-devtools/rust/rust-source.inc
+++ b/meta/recipes-devtools/rust/rust-source.inc
@@ -1,6 +1,8 @@
+require rust-config.inc
+
 RUST_VERSION ?= "${@d.getVar('PV').split('-')[0]}"
 
-SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;name=rust \
\ +SRC_URI += "${RUST_DIST_SERVER}/dist/rustc-${RUST_VERSION}-src.tar.xz;name=rust \
             file://hardcodepaths.patch;patchdir=${RUSTSRC} \
             file://0001-Don-t-use-LFS64-symbols-on-musl.patch;patchdir=${RUSTSRC} \
             file://zlib-off64_t.patch;patchdir=${RUSTSRC} \
diff --git a/meta/recipes-devtools/rust/rust_1.74.1.bb \
b/meta/recipes-devtools/rust/rust_1.74.1.bb index 30543ada7dbc..dd931a42717c 100644
--- a/meta/recipes-devtools/rust/rust_1.74.1.bb
+++ b/meta/recipes-devtools/rust/rust_1.74.1.bb
@@ -316,6 +316,10 @@ python do_update_snapshot() {
             arch = m.group('arch')
             src_uri[arch].append(f"SRC_URI[{component}-snapshot-{arch}.sha256sum] = \
\"{v}\"")  
+    config = """\
+RUST_DIST_SERVER ??= "%s"
+""" % config_dist_server
+
     snapshot = """\
 ## This is information on the rust-snapshot (binary) used to build our current \
release.  ## snapshot info is taken from rust/src/stage0.json
@@ -337,12 +341,13 @@ SRC_URI += " \\
     ${RUST_DIST_SERVER}/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \
\\  "
 
-RUST_DIST_SERVER = "%s"
-
 RUST_STD_SNAPSHOT = \
"rust-std-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu"  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
+"""
+
+    with open(os.path.join(d.getVar("THISDIR"), "rust-config.inc"), "w") as f:
+        f.write(config)
 
     with open(os.path.join(d.getVar("THISDIR"), "rust-snapshot.inc"), "w") as f:
         f.write(snapshot)
-- 
2.39.0



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#193074): https://lists.openembedded.org/g/openembedded-core/message/193074
Mute This Topic: https://lists.openembedded.org/mt/103433088/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic