felipepessoto commented on code in PR #13669:
URL: https://github.com/apache/gluten/pull/13669#discussion_r4646643018
##########
build/mvn:
##########
@@ -27,6 +27,54 @@ MVN_DOWNLOAD_DIR="${DOWNLOAD_DIR}/.mvn"
# Global variable for Maven binary path
MVN_BIN=""
+download_mvn() {
+ local URL="$1" DESTINATION="$2"
+ if command -v curl > /dev/null 2>&1; then
+ if curl -f -L --retry 3 --retry-delay 3 \
+ --connect-timeout 30 --max-time 600 \
+ -o "$DESTINATION" "$URL"; then
+ return 0
+ fi
+ elif command -v wget > /dev/null 2>&1; then
+ if wget --tries=3 --waitretry=3 \
+ --connect-timeout=30 --read-timeout=600 \
+ -O "$DESTINATION" "$URL"; then
+ return 0
+ fi
+ else
+ echo "ERROR: Neither curl nor wget found. Please install one of them
or install Maven manually." >&2
+ return 1
+ fi
+
+ echo "ERROR: Failed to download Maven from ${URL}" >&2
+ rm -f "$DESTINATION"
+ return 1
+}
+
+verify_mvn() {
+ local ARCHIVE="$1" CHECKSUM_FILE="$2" CHECKSUM
+ local SHA512
+ if command -v sha512sum > /dev/null 2>&1; then
+ SHA512=(sha512sum)
+ elif command -v shasum > /dev/null 2>&1; then
+ SHA512=(shasum -a 512)
+ else
+ echo "ERROR: Neither sha512sum nor shasum found. Install one to verify
the Maven distribution." >&2
+ return 1
+ fi
+
+ # Apache publishes a bare SHA-512 digest, not a checksum-tool manifest.
+ if ! CHECKSUM=$(tr -d '[:space:]' < "$CHECKSUM_FILE") ||
+ ! [[ "$CHECKSUM" =~ ^[0-9a-fA-F]{128}$ ]]; then
+ echo "ERROR: Invalid SHA-512 checksum in ${CHECKSUM_FILE}" >&2
+ return 1
+ fi
+ if ! printf '%s %s\n' "$CHECKSUM" "$ARCHIVE" | "${SHA512[@]}" -c - >&2;
then
Review Comment:
Fixed in 9a47b966a. An actual newline split the checksum manifest with both
`sha512sum` and `shasum`. In the literal `checkout\name` case, both tools
accepted the archive on my system, but GNU tar then interpreted `\n` in its
`-C` argument. The wrapper now verifies and extracts by basename from the
archive directory, without changing Maven’s working directory. Valid archives
install in both paths; corrupt ones are still rejected before extraction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]