From b4ca26cde82c281a21298e4420354474b60e1560 Mon Sep 17 00:00:00 2001
From: Huy Do <huydhn@gmail.com>
Date: Mon, 5 Feb 2024 18:34:37 -0800
Subject: [PATCH 1/2] Pin conda-build to 3.28.4

---
 conda/build_pytorch.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/conda/build_pytorch.sh b/conda/build_pytorch.sh
index 39aab7ee8..ec613bba4 100755
--- a/conda/build_pytorch.sh
+++ b/conda/build_pytorch.sh
@@ -208,7 +208,8 @@ if [[ "$(uname)" == 'Darwin' ]]; then
         "$miniconda_sh" -b -p "$tmp_conda" && \
         rm "$miniconda_sh"
     export PATH="$tmp_conda/bin:$PATH"
-    retry conda install -yq conda-build
+    # TODO(huydhn): We can revert the pin after https://github.com/conda/conda-build/issues/5167 is resolved
+    retry conda install -yq conda-build=3.28.4
 elif [[ "$OSTYPE" == "msys" ]]; then
     export tmp_conda="${WIN_PACKAGE_WORK_DIR}\\conda"
     export miniconda_exe="${WIN_PACKAGE_WORK_DIR}\\miniconda.exe"
@@ -219,7 +220,8 @@ elif [[ "$OSTYPE" == "msys" ]]; then
     pushd $tmp_conda
     export PATH="$(pwd):$(pwd)/Library/usr/bin:$(pwd)/Library/bin:$(pwd)/Scripts:$(pwd)/bin:$PATH"
     popd
-    retry conda install -yq conda-build
+    # TODO(huydhn): We can revert the pin after https://github.com/conda/conda-build/issues/5167 is resolved
+    retry conda install -yq conda-build=3.28.4
 fi
 
 cd "$SOURCE_DIR"
@@ -351,8 +353,6 @@ for py_ver in "${DESIRED_PYTHON[@]}"; do
       conda install -y conda-package-handling conda==22.9.0
     else
       conda install -y conda-package-handling conda==23.5.2
-      # NS: To be removed after conda docker images are updated
-      conda update -y conda-build
     fi
 
     echo "Calling conda-build at $(date)"

From 4f5520fed8cff77dbc49f7a8455eb54eabc25623 Mon Sep 17 00:00:00 2001
From: Huy Do <huydhn@gmail.com>
Date: Tue, 6 Feb 2024 11:12:43 -0800
Subject: [PATCH 2/2] Keep Windows setup

---
 conda/build_pytorch.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/conda/build_pytorch.sh b/conda/build_pytorch.sh
index ec613bba4..473d3bf27 100755
--- a/conda/build_pytorch.sh
+++ b/conda/build_pytorch.sh
@@ -220,8 +220,7 @@ elif [[ "$OSTYPE" == "msys" ]]; then
     pushd $tmp_conda
     export PATH="$(pwd):$(pwd)/Library/usr/bin:$(pwd)/Library/bin:$(pwd)/Scripts:$(pwd)/bin:$PATH"
     popd
-    # TODO(huydhn): We can revert the pin after https://github.com/conda/conda-build/issues/5167 is resolved
-    retry conda install -yq conda-build=3.28.4
+    retry conda install -yq conda-build
 fi
 
 cd "$SOURCE_DIR"