From d6076d5bea0f727fc8f66d45cdcc922a66c4d6e8 Mon Sep 17 00:00:00 2001 From: ethanwee1 Date: Thu, 24 Apr 2025 20:40:37 +0000 Subject: [PATCH 1/8] Adding in changes from pytorch/pull/141988 --- manywheel/build_common.sh | 20 +++++++++++++++++++- manywheel/build_torch_wheel.sh | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/manywheel/build_common.sh b/manywheel/build_common.sh index c26502eba..01ede3dbb 100644 --- a/manywheel/build_common.sh +++ b/manywheel/build_common.sh @@ -13,7 +13,7 @@ SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" # so manually do the work of copying dependency libs and patchelfing # and fixing RECORDS entries correctly ###################################################################### - +PLATFORM="manylinux2014_x86_64" fname_with_sha256() { HASH=$(sha256sum $1 | cut -c1-8) DIRNAME=$(dirname $1) @@ -152,6 +152,11 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/${WHEELNAME_MA $PATCHELF_BIN --set-rpath ${LIB_SO_RPATH:-'$ORIGIN'} ${FORCE_RPATH:-} $sofile $PATCHELF_BIN --print-rpath $sofile done + # create Manylinux 2_28 tag this needs to happen before regenerate the RECORD + if [[ $PLATFORM == "manylinux_2_28_x86_64" && $GPU_ARCH_TYPE != "cpu-s390x" && $GPU_ARCH_TYPE != "xpu" ]]; then + wheel_file=$(echo $(basename $pkg) | sed -e 's/-cp.*$/.dist-info\/WHEEL/g') + sed -i -e s#linux_x86_64#"${PLATFORM}"# $wheel_file; + fi # regenerate the RECORD file with new hashes # record_file=$(echo $(basename $pkg) | sed -e 's/-cp.*$/.dist-info\/RECORD/g') @@ -197,6 +202,19 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/${WHEELNAME_MA popd fi + # Rename wheel for Manylinux 2_28 + if [[ $PLATFORM == "manylinux_2_28_x86_64" && $GPU_ARCH_TYPE != "cpu-s390x" && $GPU_ARCH_TYPE != "xpu" ]]; then + pkg_name=$(echo $(basename $pkg) | sed -e s#linux_x86_64#"${PLATFORM}"#) + zip -rq $pkg_name $PREIX* + rm -f $pkg + mv $pkg_name $(dirname $pkg)/$pkg_name + else + # zip up the wheel back + zip -rq $(basename $pkg) $PREIX* + # remove original wheel + rm -f $pkg + mv $(basename $pkg) $pkg + fi # zip up the wheel back zip -rq $(basename $pkg) $PREIX* diff --git a/manywheel/build_torch_wheel.sh b/manywheel/build_torch_wheel.sh index d56dd2ac6..ce99069f6 100644 --- a/manywheel/build_torch_wheel.sh +++ b/manywheel/build_torch_wheel.sh @@ -21,6 +21,7 @@ if [[ "$OS_NAME" == *"CentOS Linux"* ]]; then retry yum install -q -y zip openssl elif [[ "$OS_NAME" == *"AlmaLinux"* ]]; then retry yum install -q -y zip openssl + PLATFORM="manylinux_2_28_x86_64" elif [[ "$OS_NAME" == *"Red Hat Enterprise Linux"* ]]; then retry dnf install -q -y zip openssl elif [[ "$OS_NAME" == *"Ubuntu"* ]]; then From 0801b48774938e5c90d5ed5f911ab5948cf5e98b Mon Sep 17 00:00:00 2001 From: Ethan Wee Date: Mon, 28 Apr 2025 11:34:25 -0700 Subject: [PATCH 2/8] Lint --- manywheel/build_common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manywheel/build_common.sh b/manywheel/build_common.sh index 01ede3dbb..9e89819cc 100644 --- a/manywheel/build_common.sh +++ b/manywheel/build_common.sh @@ -153,7 +153,7 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/${WHEELNAME_MA $PATCHELF_BIN --print-rpath $sofile done # create Manylinux 2_28 tag this needs to happen before regenerate the RECORD - if [[ $PLATFORM == "manylinux_2_28_x86_64" && $GPU_ARCH_TYPE != "cpu-s390x" && $GPU_ARCH_TYPE != "xpu" ]]; then + if [[ $PLATFORM == "manylinux_2_28_x86_64" ]]; then wheel_file=$(echo $(basename $pkg) | sed -e 's/-cp.*$/.dist-info\/WHEEL/g') sed -i -e s#linux_x86_64#"${PLATFORM}"# $wheel_file; fi @@ -203,7 +203,7 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/${WHEELNAME_MA popd fi # Rename wheel for Manylinux 2_28 - if [[ $PLATFORM == "manylinux_2_28_x86_64" && $GPU_ARCH_TYPE != "cpu-s390x" && $GPU_ARCH_TYPE != "xpu" ]]; then + if [[ $PLATFORM == "manylinux_2_28_x86_64"]]; then pkg_name=$(echo $(basename $pkg) | sed -e s#linux_x86_64#"${PLATFORM}"#) zip -rq $pkg_name $PREIX* rm -f $pkg From 8e5dadad422b11e58715ef170779257a4f2ac48f Mon Sep 17 00:00:00 2001 From: Ethan Wee Date: Mon, 28 Apr 2025 13:54:06 -0700 Subject: [PATCH 3/8] Lint --- manywheel/build_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manywheel/build_common.sh b/manywheel/build_common.sh index 9e89819cc..295814dad 100644 --- a/manywheel/build_common.sh +++ b/manywheel/build_common.sh @@ -203,7 +203,7 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/${WHEELNAME_MA popd fi # Rename wheel for Manylinux 2_28 - if [[ $PLATFORM == "manylinux_2_28_x86_64"]]; then + if [[ $PLATFORM == "manylinux_2_28_x86_64" ]]; then pkg_name=$(echo $(basename $pkg) | sed -e s#linux_x86_64#"${PLATFORM}"#) zip -rq $pkg_name $PREIX* rm -f $pkg From f3f200436946e8e0b547ba13eca05e672aa87cc0 Mon Sep 17 00:00:00 2001 From: Ethan Wee Date: Tue, 29 Apr 2025 13:10:51 -0700 Subject: [PATCH 4/8] lint --- manywheel/build_common.sh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/manywheel/build_common.sh b/manywheel/build_common.sh index 295814dad..bdf4d3522 100644 --- a/manywheel/build_common.sh +++ b/manywheel/build_common.sh @@ -154,7 +154,7 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/${WHEELNAME_MA done # create Manylinux 2_28 tag this needs to happen before regenerate the RECORD if [[ $PLATFORM == "manylinux_2_28_x86_64" ]]; then - wheel_file=$(echo $(basename $pkg) | sed -e 's/-cp.*$/.dist-info\/WHEEL/g') + wheel_file=$(basename "$pkg" | sed -e 's/-cp.*$/.dist-info\/WHEEL/g') sed -i -e s#linux_x86_64#"${PLATFORM}"# $wheel_file; fi @@ -204,16 +204,9 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/${WHEELNAME_MA fi # Rename wheel for Manylinux 2_28 if [[ $PLATFORM == "manylinux_2_28_x86_64" ]]; then - pkg_name=$(echo $(basename $pkg) | sed -e s#linux_x86_64#"${PLATFORM}"#) - zip -rq $pkg_name $PREIX* - rm -f $pkg - mv $pkg_name $(dirname $pkg)/$pkg_name + zip -rq "$(basename "$pkg" | sed -e "s#manylinux2014_x86_64#${PLATFORM}#")" "${PREFIX}"* else - # zip up the wheel back - zip -rq $(basename $pkg) $PREIX* - # remove original wheel - rm -f $pkg - mv $(basename $pkg) $pkg + zip -rq "$(basename "$pkg")" "${PREFIX}"* fi # zip up the wheel back From 30bec32217273132562db81496ee05e88fac4594 Mon Sep 17 00:00:00 2001 From: Ethan Wee Date: Fri, 30 May 2025 10:56:49 -0700 Subject: [PATCH 5/8] Try rename again --- manywheel/build_common.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manywheel/build_common.sh b/manywheel/build_common.sh index bdf4d3522..db887ad58 100644 --- a/manywheel/build_common.sh +++ b/manywheel/build_common.sh @@ -204,7 +204,10 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/${WHEELNAME_MA fi # Rename wheel for Manylinux 2_28 if [[ $PLATFORM == "manylinux_2_28_x86_64" ]]; then - zip -rq "$(basename "$pkg" | sed -e "s#manylinux2014_x86_64#${PLATFORM}#")" "${PREFIX}"* + wheel_file=$(basename "$pkg" | sed -e 's/-cp.*$/.dist-info\/WHEEL/') + sed -i -e "s#linux_x86_64#${PLATFORM}#" "$wheel_file" + + zip -rq "$(basename "$pkg" | sed -e "s#linux_x86_64#${PLATFORM}#")" "${PREFIX}"* else zip -rq "$(basename "$pkg")" "${PREFIX}"* fi From 6d03a15ee9271351c060b6e6522dc35b1bb4798b Mon Sep 17 00:00:00 2001 From: Ethan Wee Date: Mon, 9 Jun 2025 12:45:15 -0700 Subject: [PATCH 6/8] Resolved comments --- manywheel/build_common.sh | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/manywheel/build_common.sh b/manywheel/build_common.sh index db887ad58..192bd66ba 100644 --- a/manywheel/build_common.sh +++ b/manywheel/build_common.sh @@ -203,21 +203,19 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/${WHEELNAME_MA popd fi # Rename wheel for Manylinux 2_28 - if [[ $PLATFORM == "manylinux_2_28_x86_64" ]]; then - wheel_file=$(basename "$pkg" | sed -e 's/-cp.*$/.dist-info\/WHEEL/') - sed -i -e "s#linux_x86_64#${PLATFORM}#" "$wheel_file" - - zip -rq "$(basename "$pkg" | sed -e "s#linux_x86_64#${PLATFORM}#")" "${PREFIX}"* - else - zip -rq "$(basename "$pkg")" "${PREFIX}"* + if [[ "$PLATFORM" == "manylinux_2_28_x86_64" ]]; then + new_pkg=$(echo "$pkg" | sed "s#linux_x86_64#${PLATFORM}#") + if [[ "$pkg" != "$new_pkg" ]]; then + pkg="$new_pkg" + fi fi - # zip up the wheel back - zip -rq $(basename $pkg) $PREIX* + # Re-zip the edited tree into the wheel + zip -rq "$(basename "$pkg")" "${PREFIX}"* - # replace original wheel - rm -f $pkg - mv $(basename $pkg) $pkg + # Replace the original wheel with the one we just built + rm -f "$pkg" + mv "$(basename "$pkg")" "$pkg" # Rename wheel to reflect lightweight/heavyweight if [[ -n "${WHEELNAME_MARKER}" ]]; then # Rename wheel to match metadata in dist-info From d1eaa1c129d629065be812cbaeb26c5a2f19f6d2 Mon Sep 17 00:00:00 2001 From: Ethan Wee Date: Tue, 8 Jul 2025 13:22:05 -0700 Subject: [PATCH 7/8] Add manylinux_2_28_x86_64 --- manywheel/build_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manywheel/build_common.sh b/manywheel/build_common.sh index 192bd66ba..a7001d6a9 100644 --- a/manywheel/build_common.sh +++ b/manywheel/build_common.sh @@ -13,7 +13,7 @@ SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" # so manually do the work of copying dependency libs and patchelfing # and fixing RECORDS entries correctly ###################################################################### -PLATFORM="manylinux2014_x86_64" +PLATFORM="manylinux_2_28_x86_64" fname_with_sha256() { HASH=$(sha256sum $1 | cut -c1-8) DIRNAME=$(dirname $1) From 50ddb762c0c06eefe215f4d7f41d520a935be1d6 Mon Sep 17 00:00:00 2001 From: Ethan Wee Date: Fri, 11 Jul 2025 10:41:04 -0700 Subject: [PATCH 8/8] Update build_common.sh --- manywheel/build_common.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/manywheel/build_common.sh b/manywheel/build_common.sh index a7001d6a9..24efd8488 100644 --- a/manywheel/build_common.sh +++ b/manywheel/build_common.sh @@ -153,9 +153,14 @@ for pkg in /$WHEELHOUSE_DIR/torch_no_python*.whl /$WHEELHOUSE_DIR/${WHEELNAME_MA $PATCHELF_BIN --print-rpath $sofile done # create Manylinux 2_28 tag this needs to happen before regenerate the RECORD - if [[ $PLATFORM == "manylinux_2_28_x86_64" ]]; then - wheel_file=$(basename "$pkg" | sed -e 's/-cp.*$/.dist-info\/WHEEL/g') - sed -i -e s#linux_x86_64#"${PLATFORM}"# $wheel_file; + if [[ "$PLATFORM" == "manylinux_2_28_x86_64" ]]; then + # Pick the right WHEEL file, even when the dist-info dir was renamed + if [[ -n "${WHEELNAME_MARKER}" ]]; then + wheel_file="${new_dist_info_dir}/WHEEL" + else + wheel_file=$(basename "$pkg" | sed -e 's/-cp.*$/.dist-info\/WHEEL/') + fi + sed -i -e "s#linux_x86_64#${PLATFORM}#" "$wheel_file" fi # regenerate the RECORD file with new hashes