rust: Introduce RS_BUILD_ARCH to handle ppc64le

Message ID 20220218054315.169005-1-andrew@aj.id.au
State New
Headers show
Series rust: Introduce RS_BUILD_ARCH to handle ppc64le | expand

Commit Message

Andrew Jeffery Feb. 18, 2022, 5:43 a.m. UTC
On modern Power systems `uname -m` reports 'ppc64le'. However, Rust's
toolchain names the architecture 'powerpc64le'.

Introduce RS_BUILD_ARCH to provide an indirection to fix this mismatch.

I've tested each of the generated URIs for Power using the output from
`bitbake -e rust-native` and could successfully fetch the artifacts.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 meta/recipes-devtools/rust/rust-snapshot.inc | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Comments

Khem Raj Feb. 18, 2022, 6:13 a.m. UTC | #1
On Thu, Feb 17, 2022 at 9:43 PM Andrew Jeffery <andrew@aj.id.au> wrote:
>
> On modern Power systems `uname -m` reports 'ppc64le'. However, Rust's
> toolchain names the architecture 'powerpc64le'.
>
> Introduce RS_BUILD_ARCH to provide an indirection to fix this mismatch.
>
> I've tested each of the generated URIs for Power using the output from
> `bitbake -e rust-native` and could successfully fetch the artifacts.
>
thanks
can you also check if arch_to_rust_target_arch() in
meta/recipes-devtools/rust/rust-common.inc
is computing it right for ppc64le case ?

> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>  meta/recipes-devtools/rust/rust-snapshot.inc | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/meta/recipes-devtools/rust/rust-snapshot.inc b/meta/recipes-devtools/rust/rust-snapshot.inc
> index 74b558262f62..9b309b6f330c 100644
> --- a/meta/recipes-devtools/rust/rust-snapshot.inc
> +++ b/meta/recipes-devtools/rust/rust-snapshot.inc
> @@ -14,12 +14,20 @@ SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "3618da916a0f92f241cf1d67d04bb578
>  SRC_URI[rustc-snapshot-aarch64.sha256sum] = "f26811e48d03c56c125de03d389e1ae7c6df36990953c1670c6a5676bc12d4cb"
>  SRC_URI[cargo-snapshot-aarch64.sha256sum] = "6d11cd94618d80cda273eeeae7285980445f61a49ebacc616777b482a41cbf3f"
>
> +python () {
> +    build_arch = d.getVar('BUILD_ARCH')
> +    if build_arch == "ppc64le":
> +        d.setVar("RS_BUILD_ARCH", "powerpc64le")
> +    else:
> +        d.setVar("RS_BUILD_ARCH", build_arch)
> +}
> +
>  SRC_URI += " \
> -    https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
> -    https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
> -    https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
> +    https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${RS_BUILD_ARCH};subdir=rust-snapshot-components \
> +    https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${RS_BUILD_ARCH};subdir=rust-snapshot-components \
> +    https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${RS_BUILD_ARCH};subdir=rust-snapshot-components \
>  "
>
> -RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
> -RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
> -CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
> +RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${RS_BUILD_ARCH}-unknown-linux-gnu"
> +RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${RS_BUILD_ARCH}-unknown-linux-gnu"
> +CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${RS_BUILD_ARCH}-unknown-linux-gnu"
> --
> 2.32.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#161878): https://lists.openembedded.org/g/openembedded-core/message/161878
> Mute This Topic: https://lists.openembedded.org/mt/89227468/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Andrew Jeffery Feb. 19, 2022, 1:45 a.m. UTC | #2
On Fri, 18 Feb 2022, at 16:43, Khem Raj wrote:
> On Thu, Feb 17, 2022 at 9:43 PM Andrew Jeffery <andrew@aj.id.au> wrote:
>>
>> On modern Power systems `uname -m` reports 'ppc64le'. However, Rust's
>> toolchain names the architecture 'powerpc64le'.
>>
>> Introduce RS_BUILD_ARCH to provide an indirection to fix this mismatch.
>>
>> I've tested each of the generated URIs for Power using the output from
>> `bitbake -e rust-native` and could successfully fetch the artifacts.
>>
> thanks
> can you also check if arch_to_rust_target_arch() in
> meta/recipes-devtools/rust/rust-common.inc
> is computing it right for ppc64le case ?

Yep, I'll poke at that.

Andrew

Patch

diff --git a/meta/recipes-devtools/rust/rust-snapshot.inc b/meta/recipes-devtools/rust/rust-snapshot.inc
index 74b558262f62..9b309b6f330c 100644
--- a/meta/recipes-devtools/rust/rust-snapshot.inc
+++ b/meta/recipes-devtools/rust/rust-snapshot.inc
@@ -14,12 +14,20 @@  SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "3618da916a0f92f241cf1d67d04bb578
 SRC_URI[rustc-snapshot-aarch64.sha256sum] = "f26811e48d03c56c125de03d389e1ae7c6df36990953c1670c6a5676bc12d4cb"
 SRC_URI[cargo-snapshot-aarch64.sha256sum] = "6d11cd94618d80cda273eeeae7285980445f61a49ebacc616777b482a41cbf3f"
 
+python () {
+    build_arch = d.getVar('BUILD_ARCH')
+    if build_arch == "ppc64le":
+        d.setVar("RS_BUILD_ARCH", "powerpc64le")
+    else:
+        d.setVar("RS_BUILD_ARCH", build_arch)
+}
+
 SRC_URI += " \
-    https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-    https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-    https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+    https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${RS_BUILD_ARCH};subdir=rust-snapshot-components \
+    https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${RS_BUILD_ARCH};subdir=rust-snapshot-components \
+    https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${RS_BUILD_ARCH};subdir=rust-snapshot-components \
 "
 
-RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${RS_BUILD_ARCH}-unknown-linux-gnu"
+RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${RS_BUILD_ARCH}-unknown-linux-gnu"
+CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${RS_BUILD_ARCH}-unknown-linux-gnu"