Sync to latest nodejs-sources.sh

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
This commit is contained in:
Stephen Gallagher 2023-07-12 13:36:15 -04:00
parent a955794775
commit d1beeb0f81

View file

@ -6,6 +6,7 @@
# ARG_POSITIONAL_SINGLE([version],[Node.js release version])
# ARG_OPTIONAL_BOOLEAN([push],[],[Whether to upload to the lookaside cache],[on])
# ARG_OPTIONAL_BOOLEAN([debug],[],[Print all commands],[off])
# ARG_OPTIONAL_SINGLE([undici-wasi-sdk-version],[],[Override the wasi-sdk version for undici])
# ARG_DEFAULTS_POS([])
# ARG_HELP([Tool to aid in Node.js packaging of new releases])
# ARGBASH_GO()
@ -37,15 +38,17 @@ _arg_version=
# THE DEFAULTS INITIALIZATION - OPTIONALS
_arg_push="on"
_arg_debug="off"
_arg_undici_wasi_sdk_version=
print_help()
{
printf '%s\n' "Tool to aid in Node.js packaging of new releases"
printf 'Usage: %s [--(no-)push] [--(no-)debug] [-h|--help] <version>\n' "$0"
printf 'Usage: %s [--(no-)push] [--(no-)debug] [--undici-wasi-sdk-version <arg>] [-h|--help] <version>\n' "$0"
printf '\t%s\n' "<version>: Node.js release version"
printf '\t%s\n' "--push, --no-push: Whether to upload to the lookaside cache (on by default)"
printf '\t%s\n' "--debug, --no-debug: Print all commands (off by default)"
printf '\t%s\n' "--undici-wasi-sdk-version: Override the wasi-sdk version for undici (no default)"
printf '\t%s\n' "-h, --help: Prints help"
}
@ -65,6 +68,14 @@ parse_commandline()
_arg_debug="on"
test "${1:0:5}" = "--no-" && _arg_debug="off"
;;
--undici-wasi-sdk-version)
test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
_arg_undici_wasi_sdk_version="$2"
shift
;;
--undici-wasi-sdk-version=*)
_arg_undici_wasi_sdk_version="${_key##--undici-wasi-sdk-version=}"
;;
-h|--help)
print_help
exit 0
@ -123,7 +134,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
alias wget='wget --quiet'
packages=("jq" "wget" "tar" "fedpkg" "grep" "sed" "python3-jinja2-cli")
packages=("jq" "wget" "tar" "fedpkg" "grep" "sed" "python3-jinja2-cli" "nodejs")
rpm -q ${packages[@]} >/dev/null
if [ $? -ne 0 ]; then
@ -195,8 +206,18 @@ tar -zcf undici-${UNDICI_VERSION}-stripped.tar.gz undici-${UNDICI_VERSION}/
rm -f v${UNDICI_VERSION}.tar.gz
# Download the WASI compiler used to build undici
UNDICI_WASI_MAJOR=$(grep -oP '(?<=WASI_SDK_VERSION_MAJOR=).*' undici-${UNDICI_VERSION}/build/Dockerfile)
UNDICI_WASI_MINOR=$(grep -oP '(?<=WASI_SDK_VERSION_MINOR=).*' undici-${UNDICI_VERSION}/build/Dockerfile)
if [ -z $_arg_undici_wasi_sdk_version ]; then
UNDICI_WASI_MAJOR=$(grep -oP '(?<=WASI_SDK_VERSION_MAJOR=).*' undici-${UNDICI_VERSION}/build/Dockerfile)
UNDICI_WASI_MINOR=$(grep -oP '(?<=WASI_SDK_VERSION_MINOR=).*' undici-${UNDICI_VERSION}/build/Dockerfile)
else
OIFS=$IFS
IFS="."
UNDICI_WASI_VERSION=($_arg_undici_wasi_sdk_version)
UNDICI_WASI_MAJOR=${UNDICI_WASI_VERSION[0]}
UNDICI_WASI_MINOR=${UNDICI_WASI_VERSION[1]}
IFS=$OIFS
fi
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${UNDICI_WASI_MAJOR}/wasi-sdk-${UNDICI_WASI_MAJOR}.${UNDICI_WASI_MINOR}-linux.tar.gz
rm -rf undici-${UNDICI_VERSION}/