16053: Fix test for already-installed en_US.UTF-8 locale.
authorTom Clegg <tom@tomclegg.ca>
Mon, 23 Mar 2020 20:30:55 +0000 (16:30 -0400)
committerTom Clegg <tom@tomclegg.ca>
Mon, 23 Mar 2020 20:30:55 +0000 (16:30 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

lib/install/deps.go

index b08dd33bf91462a5c1972daaaa4e66055a3c0fa1..167763e9fbc8b9efcc6a2b51b4cc8ab6b2b86924 100644 (file)
@@ -261,8 +261,11 @@ rm ${zip}
                        }
                }
 
+               // The entry in /etc/locale.gen is "en_US.UTF-8"; once
+               // it's installed, locale -a reports it as
+               // "en_US.utf8".
                wantlocale := "en_US.UTF-8"
-               if havelocales, err := exec.Command("locale", "-a").CombinedOutput(); err == nil && bytes.Contains(havelocales, []byte(wantlocale+"\n")) {
+               if havelocales, err := exec.Command("locale", "-a").CombinedOutput(); err == nil && bytes.Contains(havelocales, []byte(strings.Replace(wantlocale+"\n", "UTF-", "utf", 1))) {
                        logger.Print("locale " + wantlocale + " already installed")
                } else {
                        err = runBash(`sed -i 's/^# *\(`+wantlocale+`\)/\1/' /etc/locale.gen && locale-gen`, stdout, stderr)