[Git][ghc/ghc][ghc-9.0] 3 commits: gitlab-ci: More intelligent detection of locale availability

Ben Gamari gitlab at gitlab.haskell.org
Mon Sep 7 21:17:54 UTC 2020



Ben Gamari pushed to branch ghc-9.0 at Glasgow Haskell Compiler / GHC


Commits:
4e8f05fa by Ben Gamari at 2020-09-06T15:27:00-04:00
gitlab-ci: More intelligent detection of locale availability

Previously ci.sh would unconditionally use C.UTF-8. However, this fails
on Centos 7, which appears not to provide this locale. Now we first try
C.UTF-8, then try en_US.UTF-8, then fail.

Works around #18607.

(cherry picked from commit be2cc0ad2109894d2f576c73e3f037b6b79a6bdc)

- - - - -
104b0ccd by Ben Gamari at 2020-09-07T03:18:32-04:00
gitlab-ci: Configure bignum backend in Hadrian builds

- - - - -
cee137dc by Ben Gamari at 2020-09-07T03:18:32-04:00
gitlab-ci: Use hadrian builds for Window release artifacts

- - - - -


2 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -879,13 +879,13 @@ nightly-x86_64-windows:
 # Normal Windows validate builds are profiled; that won't do for releases.
 release-x86_64-windows:
   <<: *release
-  extends: validate-x86_64-windows
+  extends: validate-x86_64-windows-hadrian
   variables:
     BUILD_FLAVOUR: "perf"
-    #
+
 release-x86_64-windows-integer-simple:
   <<: *release
-  extends: validate-x86_64-windows
+  extends: validate-x86_64-windows-hadrian
   variables:
     BIGNUM_BACKEND: native
     BUILD_FLAVOUR: "perf"


=====================================
.gitlab/ci.sh
=====================================
@@ -26,9 +26,6 @@ LT_CYAN="1;36"
 WHITE="1;37"
 LT_GRAY="0;37"
 
-export LANG=C.UTF-8
-export LC_ALL=C.UTF-8
-
 # GitLab Pipelines log section delimiters
 # https://gitlab.com/gitlab-org/gitlab-foss/issues/14664
 start_section() {
@@ -60,6 +57,30 @@ function run() {
 
 TOP="$(pwd)"
 
+function setup_locale() {
+  # BSD grep terminates early with -q, consequently locale -a will get a
+  # SIGPIPE and the pipeline will fail with pipefail.
+  shopt -o -u pipefail
+  if locale -a | grep -q C.UTF-8; then
+    # Debian
+    export LANG=C.UTF-8
+  elif locale -a | grep -q C.utf8; then
+    # Fedora calls it this
+    export LANG=C.utf8
+  elif locale -a | grep -q en_US.UTF-8; then
+    # Centos doesn't have C.UTF-8
+    export LANG=en_US.UTF-8
+  else
+    error "Failed to find usable locale"
+    info "Available locales:"
+    locale -a
+    fail "No usable locale, aborting..."
+  fi
+  info "Using locale $LANG..."
+  export LC_ALL=$LANG
+  shopt -o -s pipefail
+}
+
 function mingw_init() {
   case "$MSYSTEM" in
     MINGW32)
@@ -406,10 +427,12 @@ function clean() {
 }
 
 function run_hadrian() {
+  if [ -z "$BIGNUM_BACKEND" ]; then BIGNUM_BACKEND="gmp"; fi
   run hadrian/build-cabal \
     --flavour="$FLAVOUR" \
     -j"$cores" \
     --broken-test="$BROKEN_TESTS" \
+    --bignum=$BIGNUM_BACKEND \
     $HADRIAN_ARGS \
     $@
 }
@@ -423,6 +446,8 @@ function shell() {
   run $cmd
 }
 
+setup_locale
+
 # Determine Cabal data directory
 case "$(uname)" in
   MSYS_*|MINGW*) exe=".exe"; cabal_dir="$APPDATA/cabal" ;;



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2dbdb7b9f3c4f10566072f18d7b5f11a9d330211...cee137dcab0b33915b0add69db9535ef4227f824

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2dbdb7b9f3c4f10566072f18d7b5f11a9d330211...cee137dcab0b33915b0add69db9535ef4227f824
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200907/98cfde21/attachment-0001.html>


More information about the ghc-commits mailing list