From 2fd78fc39e3b3ff5e31180fe9ecf977976f83ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 6 Nov 2023 11:21:49 +0000 Subject: [PATCH] tools: compare ICU checksums before file changes Otherwise we end up with an bad update PR when checksums don't match. Refs: https://github.com/nodejs/node/pull/50495 PR-URL: https://github.com/nodejs/node/pull/50522 Reviewed-By: Marco Ippolito Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca --- tools/dep_updaters/update-icu.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/dep_updaters/update-icu.sh b/tools/dep_updaters/update-icu.sh index 6949632b27f14a..0f53d5cce85f5e 100755 --- a/tools/dep_updaters/update-icu.sh +++ b/tools/dep_updaters/update-icu.sh @@ -42,23 +42,23 @@ NEW_VERSION_TGZ_URL="https://github.com/unicode-org/icu/releases/download/releas NEW_VERSION_MD5="https://github.com/unicode-org/icu/releases/download/release-${DASHED_NEW_VERSION}/icu4c-${LOW_DASHED_NEW_VERSION}-src.md5" -./configure --with-intl=full-icu --with-icu-source="$NEW_VERSION_TGZ_URL" - -"$TOOLS_DIR/icu/shrink-icu-src.py" - -rm -rf "$DEPS_DIR/icu" - CHECKSUM=$(curl -sL "$NEW_VERSION_MD5" | grep "$NEW_VERSION_TGZ" | grep -v "\.asc$" | awk '{print $1}') GENERATED_CHECKSUM=$( curl -sL "$NEW_VERSION_TGZ_URL" | md5sum | cut -d ' ' -f1) -echo "Comparing checksums: deposited $CHECKSUM with $GENERATED_CHECKSUM" +echo "Comparing checksums: deposited '$CHECKSUM' with '$GENERATED_CHECKSUM'" if [ "$CHECKSUM" != "$GENERATED_CHECKSUM" ]; then echo "Skipped because checksums do not match." exit 0 fi +./configure --with-intl=full-icu --with-icu-source="$NEW_VERSION_TGZ_URL" + +"$TOOLS_DIR/icu/shrink-icu-src.py" + +rm -rf "$DEPS_DIR/icu" + perl -i -pe "s|\"url\": .*|\"url\": \"$NEW_VERSION_TGZ_URL\",|" "$TOOLS_DIR/icu/current_ver.dep" perl -i -pe "s|\"md5\": .*|\"md5\": \"$CHECKSUM\"|" "$TOOLS_DIR/icu/current_ver.dep"