From 946e7a0bbdac068b66643fd25af0b7f89b029fb1 Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Tue, 27 Aug 2024 10:20:53 +0800 Subject: [PATCH 1/5] build: poetry update --- poetry.lock | 86 ++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/poetry.lock b/poetry.lock index 949be46..beedb66 100644 --- a/poetry.lock +++ b/poetry.lock @@ -212,13 +212,13 @@ files = [ [[package]] name = "idna" -version = "3.7" +version = "3.8" description = "Internationalized Domain Names in Applications (IDNA)" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" files = [ - {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, - {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, + {file = "idna-3.8-py3-none-any.whl", hash = "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac"}, + {file = "idna-3.8.tar.gz", hash = "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"}, ] [[package]] @@ -355,38 +355,38 @@ files = [ [[package]] name = "mypy" -version = "1.11.1" +version = "1.11.2" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ - {file = "mypy-1.11.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a32fc80b63de4b5b3e65f4be82b4cfa362a46702672aa6a0f443b4689af7008c"}, - {file = "mypy-1.11.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c1952f5ea8a5a959b05ed5f16452fddadbaae48b5d39235ab4c3fc444d5fd411"}, - {file = "mypy-1.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e1e30dc3bfa4e157e53c1d17a0dad20f89dc433393e7702b813c10e200843b03"}, - {file = "mypy-1.11.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:2c63350af88f43a66d3dfeeeb8d77af34a4f07d760b9eb3a8697f0386c7590b4"}, - {file = "mypy-1.11.1-cp310-cp310-win_amd64.whl", hash = "sha256:a831671bad47186603872a3abc19634f3011d7f83b083762c942442d51c58d58"}, - {file = "mypy-1.11.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7b6343d338390bb946d449677726edf60102a1c96079b4f002dedff375953fc5"}, - {file = "mypy-1.11.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e4fe9f4e5e521b458d8feb52547f4bade7ef8c93238dfb5bbc790d9ff2d770ca"}, - {file = "mypy-1.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:886c9dbecc87b9516eff294541bf7f3655722bf22bb898ee06985cd7269898de"}, - {file = "mypy-1.11.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:fca4a60e1dd9fd0193ae0067eaeeb962f2d79e0d9f0f66223a0682f26ffcc809"}, - {file = "mypy-1.11.1-cp311-cp311-win_amd64.whl", hash = "sha256:0bd53faf56de9643336aeea1c925012837432b5faf1701ccca7fde70166ccf72"}, - {file = "mypy-1.11.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f39918a50f74dc5969807dcfaecafa804fa7f90c9d60506835036cc1bc891dc8"}, - {file = "mypy-1.11.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0bc71d1fb27a428139dd78621953effe0d208aed9857cb08d002280b0422003a"}, - {file = "mypy-1.11.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b868d3bcff720dd7217c383474008ddabaf048fad8d78ed948bb4b624870a417"}, - {file = "mypy-1.11.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a707ec1527ffcdd1c784d0924bf5cb15cd7f22683b919668a04d2b9c34549d2e"}, - {file = "mypy-1.11.1-cp312-cp312-win_amd64.whl", hash = "sha256:64f4a90e3ea07f590c5bcf9029035cf0efeae5ba8be511a8caada1a4893f5525"}, - {file = "mypy-1.11.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:749fd3213916f1751fff995fccf20c6195cae941dc968f3aaadf9bb4e430e5a2"}, - {file = "mypy-1.11.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b639dce63a0b19085213ec5fdd8cffd1d81988f47a2dec7100e93564f3e8fb3b"}, - {file = "mypy-1.11.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4c956b49c5d865394d62941b109728c5c596a415e9c5b2be663dd26a1ff07bc0"}, - {file = "mypy-1.11.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:45df906e8b6804ef4b666af29a87ad9f5921aad091c79cc38e12198e220beabd"}, - {file = "mypy-1.11.1-cp38-cp38-win_amd64.whl", hash = "sha256:d44be7551689d9d47b7abc27c71257adfdb53f03880841a5db15ddb22dc63edb"}, - {file = "mypy-1.11.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2684d3f693073ab89d76da8e3921883019ea8a3ec20fa5d8ecca6a2db4c54bbe"}, - {file = "mypy-1.11.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:79c07eb282cb457473add5052b63925e5cc97dfab9812ee65a7c7ab5e3cb551c"}, - {file = "mypy-1.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11965c2f571ded6239977b14deebd3f4c3abd9a92398712d6da3a772974fad69"}, - {file = "mypy-1.11.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a2b43895a0f8154df6519706d9bca8280cda52d3d9d1514b2d9c3e26792a0b74"}, - {file = "mypy-1.11.1-cp39-cp39-win_amd64.whl", hash = "sha256:1a81cf05975fd61aec5ae16501a091cfb9f605dc3e3c878c0da32f250b74760b"}, - {file = "mypy-1.11.1-py3-none-any.whl", hash = "sha256:0624bdb940255d2dd24e829d99a13cfeb72e4e9031f9492148f410ed30bcab54"}, - {file = "mypy-1.11.1.tar.gz", hash = "sha256:f404a0b069709f18bbdb702eb3dcfe51910602995de00bd39cea3050b5772d08"}, + {file = "mypy-1.11.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d42a6dd818ffce7be66cce644f1dff482f1d97c53ca70908dff0b9ddc120b77a"}, + {file = "mypy-1.11.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:801780c56d1cdb896eacd5619a83e427ce436d86a3bdf9112527f24a66618fef"}, + {file = "mypy-1.11.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:41ea707d036a5307ac674ea172875f40c9d55c5394f888b168033177fce47383"}, + {file = "mypy-1.11.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6e658bd2d20565ea86da7d91331b0eed6d2eee22dc031579e6297f3e12c758c8"}, + {file = "mypy-1.11.2-cp310-cp310-win_amd64.whl", hash = "sha256:478db5f5036817fe45adb7332d927daa62417159d49783041338921dcf646fc7"}, + {file = "mypy-1.11.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:75746e06d5fa1e91bfd5432448d00d34593b52e7e91a187d981d08d1f33d4385"}, + {file = "mypy-1.11.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a976775ab2256aadc6add633d44f100a2517d2388906ec4f13231fafbb0eccca"}, + {file = "mypy-1.11.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cd953f221ac1379050a8a646585a29574488974f79d8082cedef62744f0a0104"}, + {file = "mypy-1.11.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:57555a7715c0a34421013144a33d280e73c08df70f3a18a552938587ce9274f4"}, + {file = "mypy-1.11.2-cp311-cp311-win_amd64.whl", hash = "sha256:36383a4fcbad95f2657642a07ba22ff797de26277158f1cc7bd234821468b1b6"}, + {file = "mypy-1.11.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e8960dbbbf36906c5c0b7f4fbf2f0c7ffb20f4898e6a879fcf56a41a08b0d318"}, + {file = "mypy-1.11.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:06d26c277962f3fb50e13044674aa10553981ae514288cb7d0a738f495550b36"}, + {file = "mypy-1.11.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6e7184632d89d677973a14d00ae4d03214c8bc301ceefcdaf5c474866814c987"}, + {file = "mypy-1.11.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:3a66169b92452f72117e2da3a576087025449018afc2d8e9bfe5ffab865709ca"}, + {file = "mypy-1.11.2-cp312-cp312-win_amd64.whl", hash = "sha256:969ea3ef09617aff826885a22ece0ddef69d95852cdad2f60c8bb06bf1f71f70"}, + {file = "mypy-1.11.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:37c7fa6121c1cdfcaac97ce3d3b5588e847aa79b580c1e922bb5d5d2902df19b"}, + {file = "mypy-1.11.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4a8a53bc3ffbd161b5b2a4fff2f0f1e23a33b0168f1c0778ec70e1a3d66deb86"}, + {file = "mypy-1.11.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2ff93107f01968ed834f4256bc1fc4475e2fecf6c661260066a985b52741ddce"}, + {file = "mypy-1.11.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:edb91dded4df17eae4537668b23f0ff6baf3707683734b6a818d5b9d0c0c31a1"}, + {file = "mypy-1.11.2-cp38-cp38-win_amd64.whl", hash = "sha256:ee23de8530d99b6db0573c4ef4bd8f39a2a6f9b60655bf7a1357e585a3486f2b"}, + {file = "mypy-1.11.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:801ca29f43d5acce85f8e999b1e431fb479cb02d0e11deb7d2abb56bdaf24fd6"}, + {file = "mypy-1.11.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:af8d155170fcf87a2afb55b35dc1a0ac21df4431e7d96717621962e4b9192e70"}, + {file = "mypy-1.11.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f7821776e5c4286b6a13138cc935e2e9b6fde05e081bdebf5cdb2bb97c9df81d"}, + {file = "mypy-1.11.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:539c570477a96a4e6fb718b8d5c3e0c0eba1f485df13f86d2970c91f0673148d"}, + {file = "mypy-1.11.2-cp39-cp39-win_amd64.whl", hash = "sha256:3f14cd3d386ac4d05c5a39a51b84387403dadbd936e17cb35882134d4f8f0d24"}, + {file = "mypy-1.11.2-py3-none-any.whl", hash = "sha256:b499bc07dbdcd3de92b0a8b29fdf592c111276f6a12fe29c30f6c417dd546d12"}, + {file = "mypy-1.11.2.tar.gz", hash = "sha256:7f9993ad3e0ffdc95c2a14b66dee63729f021968bff8ad911867579c65d13a79"}, ] [package.dependencies] @@ -412,12 +412,12 @@ files = [ [[package]] name = "nuitka" -version = "2.4.5" +version = "2.4.8" description = "Python compiler with full language support and CPython compatibility" optional = false python-versions = "*" files = [ - {file = "Nuitka-2.4.5.tar.gz", hash = "sha256:26743df70d08278c67cdd1dac581bc3bd5ad49b60f1101aef4e99911a323ecc4"}, + {file = "Nuitka-2.4.8.tar.gz", hash = "sha256:ea04d15dde0d5967719d8181f26d714fe602a6cbd6c76df49ca8be7a45915d50"}, ] [package.dependencies] @@ -653,13 +653,13 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "rich" -version = "13.7.1" +version = "13.8.0" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" optional = false python-versions = ">=3.7.0" files = [ - {file = "rich-13.7.1-py3-none-any.whl", hash = "sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222"}, - {file = "rich-13.7.1.tar.gz", hash = "sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432"}, + {file = "rich-13.8.0-py3-none-any.whl", hash = "sha256:2e85306a063b9492dffc86278197a60cbece75bcb766022f3436f567cae11bdc"}, + {file = "rich-13.8.0.tar.gz", hash = "sha256:a5ac1f1cd448ade0d59cc3356f7db7a7ccda2c8cbae9c7a90c28ff463d3e91f4"}, ] [package.dependencies] @@ -733,13 +733,13 @@ types-setuptools = "*" [[package]] name = "types-pygit2" -version = "1.15.0.20240806" +version = "1.15.0.20240822" description = "Typing stubs for pygit2" optional = false python-versions = ">=3.8" files = [ - {file = "types-pygit2-1.15.0.20240806.tar.gz", hash = "sha256:2143be22a5bfe5748d91d6c26d77649621ae3ef6d7bf5a3c2faf815895497ee4"}, - {file = "types_pygit2-1.15.0.20240806-py3-none-any.whl", hash = "sha256:0c758f087c39c0b0bc082683209ace3c7dbf94432b360d56261dbefb067a5720"}, + {file = "types-pygit2-1.15.0.20240822.tar.gz", hash = "sha256:9824a56d6671e25e287a3c7937d76bb52afad54618532625cacf6d0408081211"}, + {file = "types_pygit2-1.15.0.20240822-py3-none-any.whl", hash = "sha256:1aca0709cdca3c0f531e7b35ddd37425bf5da1bfc27482fe794f3118251bf9aa"}, ] [package.dependencies] @@ -772,13 +772,13 @@ urllib3 = ">=2" [[package]] name = "types-setuptools" -version = "71.1.0.20240806" +version = "73.0.0.20240822" description = "Typing stubs for setuptools" optional = false python-versions = ">=3.8" files = [ - {file = "types-setuptools-71.1.0.20240806.tar.gz", hash = "sha256:ae5e7b4d643ab9e99fc00ac00041804118cabe72a56183c30d524fb064897ad6"}, - {file = "types_setuptools-71.1.0.20240806-py3-none-any.whl", hash = "sha256:3bd8dd02039be0bb79ad880d8893b8eefcb022fabbeeb61245c61b20c9ab1ed0"}, + {file = "types-setuptools-73.0.0.20240822.tar.gz", hash = "sha256:3a060681098eb3fbc2fea0a86f7f6af6aa1ca71906039d88d891ea2cecdd4dbf"}, + {file = "types_setuptools-73.0.0.20240822-py3-none-any.whl", hash = "sha256:b9eba9b68546031317a0fa506d4973641d987d74f79e7dd8369ad4f7a93dea17"}, ] [[package]] From 728f757ea3b7157d0ea3eb2623ec318de222ce31 Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Tue, 27 Aug 2024 13:21:16 +0800 Subject: [PATCH 2/5] build: bump dist image * fix build with new _image_tag_base.sh helper usage * upgrade riscv64 python3.12 from 3.12.4 to 3.12.5 * bump build tools version --- .github/workflows/dist.yml | 2 +- scripts/_image_tag_base.sh | 2 +- scripts/build-and-push-dist-image.sh | 2 +- scripts/dist-image/Dockerfile | 6 +++--- scripts/dist-image/prepare-distro.ubuntu2204-riscv64.sh | 2 +- scripts/dist-image/prepare-poetry.sh | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index f066c98..ab91c89 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -64,7 +64,7 @@ jobs: run_id: ${{ github.run_id }} release_mirror_url: ${{ steps.run_dist.outputs.release_mirror_url }} container: - image: ghcr.io/ruyisdk/ruyi-python-dist:20240623 + image: ghcr.io/ruyisdk/ruyi-python-dist:20240827 options: --user root # https://github.com/actions/checkout/issues/1014 credentials: username: ${{ github.actor }} diff --git a/scripts/_image_tag_base.sh b/scripts/_image_tag_base.sh index 954f785..4579c2a 100644 --- a/scripts/_image_tag_base.sh +++ b/scripts/_image_tag_base.sh @@ -1,6 +1,6 @@ # this file is meant to be sourced -_COMMON_DIST_IMAGE_TAG="ghcr.io/ruyisdk/ruyi-python-dist:20240623" +_COMMON_DIST_IMAGE_TAG="ghcr.io/ruyisdk/ruyi-python-dist:20240827" # Map of `uname -m` outputs to Debian arch name convention which Ruyi adopts # diff --git a/scripts/build-and-push-dist-image.sh b/scripts/build-and-push-dist-image.sh index 25003da..66435b5 100755 --- a/scripts/build-and-push-dist-image.sh +++ b/scripts/build-and-push-dist-image.sh @@ -9,6 +9,6 @@ source "$MY_DIR/_image_tag_base.sh" cd "$MY_DIR/dist-image" exec docker buildx build --rm \ --platform "linux/amd64,linux/arm64,linux/riscv64" \ - -t "$(image_tag_base "")" \ + -t "$(image_tag_base amd64)" \ --push \ . diff --git a/scripts/dist-image/Dockerfile b/scripts/dist-image/Dockerfile index dfcba8c..51ac693 100644 --- a/scripts/dist-image/Dockerfile +++ b/scripts/dist-image/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 -FROM --platform=linux/amd64 ubuntu:20.04 as build-amd64 -FROM --platform=linux/arm64 ubuntu:20.04 as build-arm64 -FROM --platform=linux/riscv64 riscv64/ubuntu:22.04 as build-riscv64 +FROM --platform=linux/amd64 ubuntu:20.04 AS build-amd64 +FROM --platform=linux/arm64 ubuntu:20.04 AS build-arm64 +FROM --platform=linux/riscv64 riscv64/ubuntu:22.04 AS build-riscv64 FROM build-$TARGETARCH diff --git a/scripts/dist-image/prepare-distro.ubuntu2204-riscv64.sh b/scripts/dist-image/prepare-distro.ubuntu2204-riscv64.sh index f672f99..000cc4f 100755 --- a/scripts/dist-image/prepare-distro.ubuntu2204-riscv64.sh +++ b/scripts/dist-image/prepare-distro.ubuntu2204-riscv64.sh @@ -55,7 +55,7 @@ apt-get clean # # See: https://github.com/Nuitka/Nuitka/commit/54f2a2222abedf92d45b8f397233cfb3bef340c5 -PYTHON_V=3.12.4 +PYTHON_V=3.12.5 pushd /tmp wget https://www.python.org/ftp/python/${PYTHON_V}/Python-${PYTHON_V}.tar.xz mkdir py-src py-build diff --git a/scripts/dist-image/prepare-poetry.sh b/scripts/dist-image/prepare-poetry.sh index f5f6fa2..2380ab3 100755 --- a/scripts/dist-image/prepare-poetry.sh +++ b/scripts/dist-image/prepare-poetry.sh @@ -9,7 +9,7 @@ export MAKEFLAGS="-j$(nproc)" python3.12 -m venv /home/b/build-tools-venv /home/b/build-tools-venv/bin/pip install -U pip setuptools wheel /home/b/build-tools-venv/bin/pip install poetry -/home/b/build-tools-venv/bin/pip install maturin==1.6.0 cibuildwheel==2.19.1 auditwheel==6.0.0 +/home/b/build-tools-venv/bin/pip install maturin==1.7.1 cibuildwheel==2.20.0 auditwheel==6.1.0 for tool in poetry maturin cibuildwheel auditwheel; do ln -s /home/b/build-tools-venv/bin/"$tool" /usr/local/bin/"$tool" done From cd38a5df341b65ab3d3cc37f444a1655adae7b17 Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Tue, 27 Aug 2024 14:19:29 +0800 Subject: [PATCH 3/5] build: fix non-preservation of built xingque artifacts --- scripts/dist-inner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/dist-inner.py b/scripts/dist-inner.py index be94a33..402aa77 100755 --- a/scripts/dist-inner.py +++ b/scripts/dist-inner.py @@ -130,8 +130,8 @@ def delete_cached_files_older_than_days(root: str, days: int, epoch: int) -> Non root_path = pathlib.Path(root) dirs_to_remove: list[tuple[pathlib.Path, int | None]] = [] for f in root_path.iterdir(): - if f.name.startswith("pygit2"): - INFO.print(f"ignoring pygit2 cache [cyan]{f}") + if f.name.startswith("pygit2") or f.name.startswith("xingque"): + INFO.print(f"ignoring library artifact cache [cyan]{f}") continue ts: int | None From 5ac1115079d49482cfed33a12289e151d870b4c8 Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Tue, 27 Aug 2024 14:23:44 +0800 Subject: [PATCH 4/5] build: only apply riscv64 manylinux tag when building pygit2 for riscv64 --- scripts/build-pygit2.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/build-pygit2.py b/scripts/build-pygit2.py index 8537461..52c44c3 100755 --- a/scripts/build-pygit2.py +++ b/scripts/build-pygit2.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import os +import platform import shutil import subprocess import sys @@ -173,10 +174,11 @@ def get_pygit2_wheel_build_env(pygit2_dir: str) -> dict[str, str]: # this is unnecessary del r["LIBGIT2"] - # auditwheel 6.1.0+ has manylinux policies for riscv64, but the default - # is too low for our environment - # bump it up - r["AUDITWHEEL_PLAT"] = "manylinux_2_35_riscv64" + if platform.machine() == "riscv64": + # auditwheel 6.1.0+ has manylinux policies for riscv64, but the default + # is too low for our environment + # bump it up + r["AUDITWHEEL_PLAT"] = "manylinux_2_35_riscv64" return r From 653c971fde8546cdc28c9f03521c3d7ae1ad9a1a Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Tue, 27 Aug 2024 14:43:46 +0800 Subject: [PATCH 5/5] build: prevent apparent cross-building from known build arches This should prevent a common pitfall that seems intuitive but is not going to work: * not having emulation in place beforehand, * trying to cross-build for one of the supported arches (so they do not have the expectation of things not working), * after seeing the failure (being unable to run programs in the foreign sysroot), disabling the Docker-based dist and retrying. Fixes: #182 --- scripts/dist.sh | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/scripts/dist.sh b/scripts/dist.sh index 0eecf1c..0e1533f 100755 --- a/scripts/dist.sh +++ b/scripts/dist.sh @@ -130,21 +130,49 @@ main() { do_inner "$@" fi - local arch="$1" - if [[ -z $arch ]]; then - arch="$(convert_uname_arch_to_ruyi "$(uname -m)")" + local build_arch="$(convert_uname_arch_to_ruyi "$(uname -m)")" + local build_arch_is_officially_supported=false + if is_docker_dist_build_supported "$build_arch"; then + build_arch_is_officially_supported=true + fi + + local host_arch="$1" + if [[ -z $host_arch ]]; then + host_arch="$build_arch" echo "usage: $0 [arch]" >&2 - echo "info: defaulting to host arch $arch" >&2 + echo "info: defaulting to build machine arch $build_arch" >&2 fi - if is_docker_dist_build_supported "$arch"; then - do_docker_build "$arch" + if is_docker_dist_build_supported "$host_arch"; then + do_docker_build "$host_arch" else - echo "warning: Docker-based dist builds for architecture $arch is not supported" >&2 + echo "warning: Docker-based dist builds for architecture $host_arch is not supported" >&2 if [[ -n "$RUYI_DIST_FORCE_IMAGE_TAG" ]]; then # but this is explicitly requested so... - do_docker_build "$arch" + do_docker_build "$host_arch" else + # Because of the way Nuitka works, cross builds cannot be supported. + # + # But without knowledge of the Debian name for the user's arch, we + # cannot know whether the user is actually doing native builds on + # their arch, with $build_arch expected to differ from `uname -m` + # output. + # + # On the other hand, if the build arch is supported, when + # $host_arch differs from $build_arch we can indeed be sure that + # the build will fail. + if [[ $build_arch != $host_arch ]]; then + if "$build_arch_is_officially_supported"; then + echo "error: cross building is not possible with Nuitka" >&2 + echo "info: to our knowledge, $host_arch is not the same as $build_arch" >&2 + echo "info: please retry with $host_arch hardware / emulation / sysroot instead" >&2 + exit 1 + fi + + echo "warning: the requested arch $host_arch differs from the build machine arch $build_arch, but the build is not Docker-based" >&2 + echo "warning: cross builds are not supported and will fail" >&2 + fi + echo "warning: your build may not be reproducible" >&2 do_inner "$@" fi