Skip to content

Commit

Permalink
tools: zlib update by checking latest commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fasenderos committed May 22, 2023
1 parent 03a7ff1 commit 60cc7a3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tools/dep_updaters/update-zlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 60cc7a3

Please sign in to comment.