Blame SOURCES/nodejs-tarball.sh

6261c9
#!/bin/sh
fa8520
# Uses Argbash to generate command argument parsing. To update
fa8520
# arguments, make sure to call
fa8520
# `argbash nodejs-tarball.sh -o nodejs-tarball.sh`
6261c9
fa8520
# ARG_POSITIONAL_SINGLE([version],[Node.js release version],[""])
fa8520
# ARG_DEFAULTS_POS([])
fa8520
# ARG_HELP([Tool to aid in Node.js packaging of new releases])
fa8520
# ARGBASH_GO()
fa8520
# needed because of Argbash --> m4_ignore([
fa8520
### START OF CODE GENERATED BY Argbash v2.8.1 one line above ###
fa8520
# Argbash is a bash code generator used to get arguments parsing right.
fa8520
# Argbash is FREE SOFTWARE, see https://argbash.io for more info
fa8520
fa8520
fa8520
die()
fa8520
{
fa8520
	local _ret=$2
fa8520
	test -n "$_ret" || _ret=1
fa8520
	test "$_PRINT_HELP" = yes && print_help >&2
fa8520
	echo "$1" >&2
fa8520
	exit ${_ret}
fa8520
}
fa8520
fa8520
fa8520
begins_with_short_option()
fa8520
{
fa8520
	local first_option all_short_options='h'
fa8520
	first_option="${1:0:1}"
fa8520
	test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0
fa8520
}
fa8520
fa8520
# THE DEFAULTS INITIALIZATION - POSITIONALS
fa8520
_positionals=()
fa8520
_arg_version=""
fa8520
# THE DEFAULTS INITIALIZATION - OPTIONALS
fa8520
fa8520
fa8520
print_help()
fa8520
{
fa8520
	printf '%s\n' "Tool to aid in Node.js packaging of new releases"
fa8520
	printf 'Usage: %s [-h|--help] [<version>]\n' "$0"
fa8520
	printf '\t%s\n' "<version>: Node.js release version (default: '""')"
fa8520
	printf '\t%s\n' "-h, --help: Prints help"
fa8520
}
fa8520
fa8520
fa8520
parse_commandline()
fa8520
{
fa8520
	_positionals_count=0
fa8520
	while test $# -gt 0
fa8520
	do
fa8520
		_key="$1"
fa8520
		case "$_key" in
fa8520
			-h|--help)
fa8520
				print_help
fa8520
				exit 0
fa8520
				;;
fa8520
			-h*)
fa8520
				print_help
fa8520
				exit 0
fa8520
				;;
fa8520
			*)
fa8520
				_last_positional="$1"
fa8520
				_positionals+=("$_last_positional")
fa8520
				_positionals_count=$((_positionals_count + 1))
fa8520
				;;
fa8520
		esac
fa8520
		shift
fa8520
	done
fa8520
}
fa8520
fa8520
fa8520
handle_passed_args_count()
fa8520
{
fa8520
	test "${_positionals_count}" -le 1 || _PRINT_HELP=yes die "FATAL ERROR: There were spurious positional arguments --- we expect between 0 and 1, but got ${_positionals_count} (the last one was: '${_last_positional}')." 1
fa8520
}
fa8520
fa8520
fa8520
assign_positional_args()
fa8520
{
fa8520
	local _positional_name _shift_for=$1
fa8520
	_positional_names="_arg_version "
fa8520
fa8520
	shift "$_shift_for"
fa8520
	for _positional_name in ${_positional_names}
fa8520
	do
fa8520
		test $# -gt 0 || break
fa8520
		eval "$_positional_name=\${1}" || die "Error during argument parsing, possibly an Argbash bug." 1
fa8520
		shift
fa8520
	done
fa8520
}
fa8520
fa8520
parse_commandline "$@"
fa8520
handle_passed_args_count
fa8520
assign_positional_args 1 "${_positionals[@]}"
fa8520
fa8520
# OTHER STUFF GENERATED BY Argbash
fa8520
fa8520
### END OF CODE GENERATED BY Argbash (sortof) ### ])
fa8520
# [ <-- needed because of Argbash
fa8520
fa8520
fa8520
set -e
fa8520
fa8520
echo $_arg_version
fa8520
fa8520
if [ x$_arg_version != x ]; then
fa8520
    version=$_arg_version
fa8520
else
fa8520
    version=$(rpm -q --specfile --qf='%{version}\n' nodejs.spec | head -n1)
fa8520
fi
fa8520
fa8520
rm -f node-v${version}.tar.gz node-v${version}-stripped.tar.gz
fa8520
wget http://nodejs.org/dist/v${version}/node-v${version}.tar.gz \
fa8520
     http://nodejs.org/dist/v${version}/SHASUMS256.txt
fa8520
sha256sum -c SHASUMS256.txt --ignore-missing
6261c9
tar -zxf node-v${version}.tar.gz
6261c9
rm -rf node-v${version}/deps/openssl
6261c9
tar -zcf node-v${version}-stripped.tar.gz node-v${version}
fa8520
fa8520
# Download the matching version of ICU
fa8520
rm -f icu4c*-src.tgz icu.md5
fa8520
ICUMD5=$(cat node-v${version}/tools/icu/current_ver.dep |jq -r '.[0].md5')
fa8520
wget $(cat node-v${version}/tools/icu/current_ver.dep |jq -r '.[0].url')
fa8520
ICUTARBALL=$(ls -1 icu4c*-src.tgz)
fa8520
echo "$ICUMD5  $ICUTARBALL" > icu.md5
fa8520
md5sum -c icu.md5
fa8520
rm -f icu.md5 SHASUMS256.txt
fa8520
fa8520
rhpkg new-sources node-v${version}-stripped.tar.gz icu4c*-src.tgz
fa8520
fa8520
rm -f node-v${version}.tar.gz
fa8520
fa8520
set +e
fa8520
fa8520
# Determine the bundled versions of the various packages
fa8520
echo "Bundled software versions"
fa8520
echo "-------------------------"
fa8520
echo
fa8520
echo "libnode shared object version"
fa8520
echo "========================="
fa8520
grep "define NODE_MODULE_VERSION" node-v${version}/src/node_version.h
fa8520
echo
fa8520
echo "V8"
fa8520
echo "========================="
fa8520
grep "define V8_MAJOR_VERSION" node-v${version}/deps/v8/include/v8-version.h
fa8520
grep "define V8_MINOR_VERSION" node-v${version}/deps/v8/include/v8-version.h
fa8520
grep "define V8_BUILD_NUMBER" node-v${version}/deps/v8/include/v8-version.h
fa8520
grep "define V8_PATCH_LEVEL" node-v${version}/deps/v8/include/v8-version.h
fa8520
echo
fa8520
echo "c-ares"
fa8520
echo "========================="
fa8520
grep "define ARES_VERSION_MAJOR" node-v${version}/deps/cares/include/ares_version.h
fa8520
grep "define ARES_VERSION_MINOR" node-v${version}/deps/cares/include/ares_version.h
fa8520
grep "define ARES_VERSION_PATCH" node-v${version}/deps/cares/include/ares_version.h
fa8520
echo
fa8520
echo "http-parser"
fa8520
echo "========================="
fa8520
grep "define HTTP_PARSER_VERSION_MAJOR" node-v${version}/deps/http_parser/http_parser.h
fa8520
grep "define HTTP_PARSER_VERSION_MINOR" node-v${version}/deps/http_parser/http_parser.h
fa8520
grep "define HTTP_PARSER_VERSION_PATCH" node-v${version}/deps/http_parser/http_parser.h
fa8520
echo
fa8520
echo "llhttp"
fa8520
echo "========================="
fa8520
grep "define LLHTTP_VERSION_MAJOR" node-v${version}/deps/llhttp/include/llhttp.h
fa8520
grep "define LLHTTP_VERSION_MINOR" node-v${version}/deps/llhttp/include/llhttp.h
fa8520
grep "define LLHTTP_VERSION_PATCH" node-v${version}/deps/llhttp/include/llhttp.h
fa8520
echo
fa8520
echo "libuv"
fa8520
echo "========================="
fa8520
grep "define UV_VERSION_MAJOR" node-v${version}/deps/uv/include/uv/version.h
fa8520
grep "define UV_VERSION_MINOR" node-v${version}/deps/uv/include/uv/version.h
fa8520
grep "define UV_VERSION_PATCH" node-v${version}/deps/uv/include/uv/version.h
fa8520
echo
fa8520
echo "nghttp2"
fa8520
echo "========================="
fa8520
grep "define NGHTTP2_VERSION " node-v${version}/deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
fa8520
echo
fa8520
echo "ICU"
fa8520
echo "========================="
fa8520
grep "url" node-v${version}/tools/icu/current_ver.dep
fa8520
echo
fa8520
echo "punycode"
fa8520
echo "========================="
fa8520
grep "'version'" node-v${version}/lib/punycode.js
fa8520
echo
fa8520
echo "uvwasi"
fa8520
echo "========================="
fa8520
grep "define UVWASI_VERSION_MAJOR" node-v${version}/deps/uvwasi/include/uvwasi.h
fa8520
grep "define UVWASI_VERSION_MINOR" node-v${version}/deps/uvwasi/include/uvwasi.h
fa8520
grep "define UVWASI_VERSION_PATCH" node-v${version}/deps/uvwasi/include/uvwasi.h
fa8520
echo
fa8520
echo "npm"
fa8520
echo "========================="
fa8520
grep "\"version\":" node-v${version}/deps/npm/package.json
fa8520
echo
fa8520
echo "Make sure these versions match what is in the RPM spec file"
fa8520
fa8520
rm -rf node-v${version}
fa8520
# ] <-- needed because of Argbash