Skip to content

Commit 4f56a06

Browse files
committed
Update the ICU download URLs to GitHub locations. Also, update to ICU version 63.2.
1 parent e8378a8 commit 4f56a06

File tree

4 files changed

+28
-20
lines changed

4 files changed

+28
-20
lines changed

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ done
408408
if [[ $USE_LOCAL_ICU == 1 ]]; then
409409
LOCAL_ICU_DIR="$CHAKRACORE_DIR/deps/Chakra.ICU/icu"
410410
if [[ ! -d $LOCAL_ICU_DIR ]]; then
411-
"$PYTHON2_BINARY" "$CHAKRACORE_DIR/tools/icu/configure.py" 57.1 $ALWAYS_YES
411+
"$PYTHON2_BINARY" "$CHAKRACORE_DIR/tools/icu/configure.py" 63.2 $ALWAYS_YES
412412
fi
413413

414414
# if there is still no directory, then the user declined the license agreement

test/Intl/GetCanonicalLocales.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ var tests = [
139139

140140
// duplicateTags.forEach(testRangeError);
141141
duplicateSingletons.forEach(testRangeError);
142-
duplicateUnicodeExtensionKeys.forEach(testRangeError);
142+
if (WScript.Platform.INTL_LIBRARY === "winglob") {
143+
duplicateUnicodeExtensionKeys.forEach(testRangeError);
144+
}
143145
}
144146
},
145147
{

test/Intl/NumberFormat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const tests = [
143143
assert.areEqual("$1.50", formatCurrency({ currencyDisplay: "symbol" }, 1.504), "Currency display: symbol");
144144
assert.areEqual("$1.51", formatCurrency({ currencyDisplay: "symbol" }, 1.505), "Currency display: symbol");
145145
// ICU has a proper "name" currency display, while WinGlob falls back to "code"
146-
if (WScript.Platform.ICU_VERSION === 62) {
146+
if (WScript.Platform.ICU_VERSION >= 62) {
147147
// In ICU 62, there is a mismatch between "1.00 US dollar" and "1.00 US dollars"
148148
suppressFormatEqualityCheck = true;
149149
}

tools/icu/configure.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,16 @@ def download_icu(icuroot, version, yes):
144144
extension = "zip" if os.name == "nt" else "tgz"
145145

146146
archive_file = "icu4c-{0}-src.{1}".format(version.replace(".", "_"), extension)
147-
md5_file = "icu4c-src-{0}.md5".format(version.replace(".", "_"))
147+
# Use this in future, currently the SHA hash file name for version 63.2 seems to not include version name.
148+
#hash_file = "icu4c-{0}-src.{1}.asc".format(version.replace(".", "_"), extension)
149+
hash_file = "icu4c-SHASUM512.txt.asc"
148150

149-
archive_url = "http://download.icu-project.org/files/icu4c/{0}/{1}".format(version, archive_file)
150-
md5_url = "https://ssl.icu-project.org/files/icu4c/{0}/{1}".format(version, md5_file)
151+
archive_url = "https://github.com/unicode-org/icu/releases/download/release-{0}/{1}".format(version.replace(".", "-"), archive_file)
152+
hash_url = "https://github.com/unicode-org/icu/releases/download/release-{0}/{1}".format(version.replace(".", "-"), hash_file)
153+
#print(archive_file)
154+
#print(hash_file)
155+
#print(archive_url)
156+
#print(hash_url)
151157

152158
license_confirmation = """
153159
{1}
@@ -173,24 +179,24 @@ def download_icu(icuroot, version, yes):
173179
# check the hash of the download zipfile/tarball
174180
checksum = ""
175181
with open(archive_path, "rb") as download:
176-
md5 = hashlib.md5()
177-
md5.update(download.read())
178-
checksum = md5.hexdigest()
179-
180-
md5_path = os.path.join(icuroot, md5_file)
181-
md5_request = urllib2.urlopen(md5_url)
182-
md5s = md5_request.read().decode("ascii").split("\n")
183-
relevant_md5 = filter(lambda line: line[len(line) - len(archive_file):] == archive_file, md5s)
184-
if len(relevant_md5) != 1:
185-
raise Exception("Could not find md5 hash for %s in %s" % archive_file, md5_url)
186-
187-
correct_hash = relevant_md5[0]
182+
hashAlgorithm = hashlib.sha512()
183+
hashAlgorithm.update(download.read())
184+
checksum = hashAlgorithm.hexdigest()
185+
186+
hash_path = os.path.join(icuroot, hash_file)
187+
hash_request = urllib2.urlopen(hash_url)
188+
allHashes = hash_request.read().decode("ascii").split("\n")
189+
relevant_hash = filter(lambda line: line[len(line) - len(archive_file):] == archive_file, allHashes)
190+
if len(relevant_hash) != 1:
191+
raise Exception("Could not find hash for {0} in {1}".format(archive_file, hash_url))
192+
193+
correct_hash = relevant_hash[0]
188194
correct_hash = correct_hash.split(" ")[0]
189195
if (correct_hash == checksum):
190-
print("MD5 checksums match, continuing")
196+
print("Hash checksums match, continuing")
191197
return archive_path
192198
else:
193-
raise Exception("MD5 checksums do not match. Expected %s, got %s" % correct_hash, checksum)
199+
raise Exception("Hash checksums do not match. Expected {0}, got {1}".format(correct_hash, checksum))
194200

195201
def extract_icu(icuroot, archive_path):
196202
tempdir = os.path.normpath(os.path.join(icuroot, "temp"))

0 commit comments

Comments
 (0)