From 8512b6a0e17e04528865db4733b760336b26d075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Tue, 18 Jan 2022 11:58:39 +0100 Subject: [PATCH] build: set LC_ALL on the make target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simply applying `LC_ALL=C` will work for the current shell only. For all the shells and sub-shell to use it, we must set it globally. Making it the first thing in the Make entrypoint now so the CRD and RBAC sorting works on all the platforms. Signed-off-by: Sébastien Han --- Makefile | 8 ++++++++ build/crds/build-crds.sh | 7 ------- build/rbac/keep-rbac-yaml.sh | 6 ------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 4ece242dc..1487ade6b 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Linux doesn't guarantee file ordering, so sort the files to make sure order is deterministic. +# And in order to handle file paths with spaces, it's easiest to read the file names into an array. +# Set locale `LC_ALL=C` because different OSes have different sort behavior; +# `C` sorting order is based on the byte values, +# Reference: https://blog.zhimingwang.org/macos-lc_collate-hunt +LC_ALL=C +export LC_ALL + include build/makelib/common.mk include build/makelib/helm.mk diff --git a/build/crds/build-crds.sh b/build/crds/build-crds.sh index 1f40effe2..06c652a8c 100755 --- a/build/crds/build-crds.sh +++ b/build/crds/build-crds.sh @@ -97,13 +97,6 @@ fi generating_main_crd -# Linux doesn't guarantee file ordering, so we must sort the output to make sure it's deterministic. -# In order to handle file paths with spaces in the yq command below, it's easiest to read the -# file names into an array. -# Set locale `LC_ALL=C` because different OSes have different sort behavior; -# `C` sorting order is based on the byte values, -# Reference: https://blog.zhimingwang.org/macos-lc_collate-hunt -LC_ALL=C CRD_FILES=() while read -r line; do CRD_FILES+=("$line") diff --git a/build/rbac/keep-rbac-yaml.sh b/build/rbac/keep-rbac-yaml.sh index b235846c3..098df8364 100755 --- a/build/rbac/keep-rbac-yaml.sh +++ b/build/rbac/keep-rbac-yaml.sh @@ -35,12 +35,6 @@ sed '/^# Source: /d' | # helm adds '# Source: ' comments atop of each yaml $YQ eval --split-exp '.kind + " " + .metadata.name + " "' - # split into files by .yaml # outputting the filenames with spaces after kind and name keeps the same sorting from before -# Linux doesn't guarantee file ordering, so sort the files to make sure order is deterministic. -# And in order to handle file paths with spaces, it's easiest to read the file names into an array. -# Set locale `LC_ALL=C` because different OSes have different sort behavior; -# `C` sorting order is based on the byte values, -# Reference: https://blog.zhimingwang.org/macos-lc_collate-hunt -LC_ALL=C RBAC_FILES=() while read -r line; do RBAC_FILES+=("$line")