From 60cc7a3b311e77f2011b3da56ca5e4a2c41438e1 Mon Sep 17 00:00:00 2001 From: Andrea Fassina Date: Thu, 18 May 2023 00:36:45 +0200 Subject: [PATCH] tools: zlib update by checking latest commit Refs: https://github.com/nodejs/security-wg/issues/973 --- tools/dep_updaters/update-zlib.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/dep_updaters/update-zlib.sh b/tools/dep_updaters/update-zlib.sh index 90a50607e64a2e..bb24c21842fcf8 100755 --- a/tools/dep_updaters/update-zlib.sh +++ b/tools/dep_updaters/update-zlib.sh @@ -7,19 +7,19 @@ set -e BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) DEPS_DIR="$BASE_DIR/deps" -CURRENT_VERSION=$(grep "#define ZLIB_VERSION" "$DEPS_DIR/zlib/zlib.h" | sed -n "s/^.*VERSION \"\(.*\)\"/\1/p") +NEW_UPSTREAM_SHA1=$(git ls-remote "https://chromium.googlesource.com/chromium/src/third_party/zlib.git" HEAD | awk '{print $1}') +NEW_VERSION=$(echo "$NEW_UPSTREAM_SHA1" | head -c 7) -NEW_VERSION_ZLIB_H=$(curl -s "https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/zlib/zlib.h?format=TEXT" | base64 --decode) +echo "Comparing $NEW_VERSION with current revision" -# Revert zconf.h changes before checking diff -perl -i -pe 's|^//#include "chromeconf.h"|#include "chromeconf.h"|' "$DEPS_DIR/zlib/zconf.h" -git stash -- "$DEPS_DIR/zlib/zconf.h" +git remote add zlib-upstream https://chromium.googlesource.com/chromium/src/third_party/zlib.git +git fetch zlib-upstream "$NEW_UPSTREAM_SHA1" +git remote remove zlib-upstream -git fetch https://chromium.googlesource.com/chromium/src/third_party/zlib.git HEAD - -DIFF_TREE=$(git diff --diff-filter=d 'stash@{0}:deps/zlib' FETCH_HEAD) - -git stash drop +# We exclude win32, GN-scraper.py and zlib.gyp from checking diff because they are not part of the zlib source +DIFF_TREE=$( + git diff HEAD:deps/zlib "$NEW_UPSTREAM_SHA1" -- ':!win32' ':!GN-scraper.py' ':!zlib.gyp' +) if [ -z "$DIFF_TREE" ]; then echo "Skipped because zlib is on the latest version."