Skip to content

Commit 4ce2ecb

Browse files
committed
tools: fix version parsing in brotli update script
Update `tools/dep_updaters/update-brotli.sh` to parse the current version of brotli from the newer macros `BROTLI_VERSION_MAJOR`, `BROTLI_VERSION_MINOR` and `BROTLI_VERSION_PATCH`. PR-URL: #51373 Refs: #50804 Refs: nodejs/security-wg#1181 Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent f301f82 commit 4ce2ecb

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tools/dep_updaters/update-brotli.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ console.log(tag_name.replace('v', ''));
2424
EOF
2525
)"
2626

27-
VERSION_HEX=$(grep "#define BROTLI_VERSION" ./deps/brotli/c/common/version.h | sed 's/.* //')
28-
29-
major=$(( ($VERSION_HEX >> 24) & 0xff ))
30-
minor=$(( ($VERSION_HEX >> 12) & 0xfff ))
31-
patch=$(( $VERSION_HEX & 0xfff ))
32-
CURRENT_VERSION="${major}.${minor}.${patch}"
27+
CURRENT_MAJOR_VERSION=$(grep "#define BROTLI_VERSION_MAJOR" ./deps/brotli/c/common/version.h | sed -n "s/^.*MAJOR \(.*\)/\1/p")
28+
CURRENT_MINOR_VERSION=$(grep "#define BROTLI_VERSION_MINOR" ./deps/brotli/c/common/version.h | sed -n "s/^.*MINOR \(.*\)/\1/p")
29+
CURRENT_PATCH_VERSION=$(grep "#define BROTLI_VERSION_PATCH" ./deps/brotli/c/common/version.h | sed -n "s/^.*PATCH \(.*\)/\1/p")
30+
CURRENT_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_PATCH_VERSION"
3331

3432
# This function exit with 0 if new version and current version are the same
3533
compare_dependency_version "brotli" "$NEW_VERSION" "$CURRENT_VERSION"

0 commit comments

Comments
 (0)