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