sources: use jinja2 template to support patches
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
This commit is contained in:
parent
c37ef81437
commit
0b4597e2bc
@ -190,8 +190,8 @@ ICU_MINOR=$(jq -r '.[0].url' node-v${version}/tools/icu/current_ver.dep | sed --
|
||||
|
||||
# Download the ICU binary data files
|
||||
rm -Rf icu4c-${ICU_MAJOR}_${ICU_MINOR}-data-bin-*.zip
|
||||
wget $(grep Source3 packaging/nodejs.spec.in | sed --expression="s/.*http/http/g" --expression="s/\(\%{icu_major}\)/${ICU_MAJOR}/g" --expression="s/\(\%{icu_minor}\)/${ICU_MINOR}/g")
|
||||
wget $(grep Source4 packaging/nodejs.spec.in | sed --expression="s/.*http/http/g" --expression="s/\(\%{icu_major}\)/${ICU_MAJOR}/g" --expression="s/\(\%{icu_minor}\)/${ICU_MINOR}/g")
|
||||
wget $(grep Source3 packaging/nodejs.spec.j2 | sed --expression="s/.*http/http/g" --expression="s/\(\%{icu_major}\)/${ICU_MAJOR}/g" --expression="s/\(\%{icu_minor}\)/${ICU_MINOR}/g")
|
||||
wget $(grep Source4 packaging/nodejs.spec.j2 | sed --expression="s/.*http/http/g" --expression="s/\(\%{icu_major}\)/${ICU_MAJOR}/g" --expression="s/\(\%{icu_minor}\)/${ICU_MINOR}/g")
|
||||
|
||||
rm -f node-v${version}.tar.gz
|
||||
|
||||
@ -228,14 +228,16 @@ echo "========================="
|
||||
LLHTTP_MAJOR=$(grep -oP '(?<=#define LLHTTP_VERSION_MAJOR )\d+' node-v${version}/deps/llhttp/include/llhttp.h)
|
||||
LLHTTP_MINOR=$(grep -oP '(?<=#define LLHTTP_VERSION_MINOR )\d+' node-v${version}/deps/llhttp/include/llhttp.h)
|
||||
LLHTTP_PATCH=$(grep -oP '(?<=#define LLHTTP_VERSION_PATCH )\d+' node-v${version}/deps/llhttp/include/llhttp.h)
|
||||
echo "${LLHTTP_MAJOR}.${LLHTTP_MINOR}.${LLHTTP_PATCH}"
|
||||
LLHTTP_VERSION="${LLHTTP_MAJOR}.${LLHTTP_MINOR}.${LLHTTP_PATCH}"
|
||||
echo $LLHTTP_VERSION
|
||||
echo
|
||||
echo "libuv"
|
||||
echo "========================="
|
||||
UV_MAJOR=$(grep -oP '(?<=#define UV_VERSION_MAJOR )\d+' node-v${version}/deps/uv/include/uv/version.h)
|
||||
UV_MINOR=$(grep -oP '(?<=#define UV_VERSION_MINOR )\d+' node-v${version}/deps/uv/include/uv/version.h)
|
||||
UV_PATCH=$(grep -oP '(?<=#define UV_VERSION_PATCH )\d+' node-v${version}/deps/uv/include/uv/version.h)
|
||||
echo ${UV_MAJOR}.${UV_MINOR}.${UV_PATCH}
|
||||
LIBUV_VERSION="${UV_MAJOR}.${UV_MINOR}.${UV_PATCH}"
|
||||
echo $UV_VERSION
|
||||
echo
|
||||
echo "nghttp2"
|
||||
echo "========================="
|
||||
@ -281,40 +283,51 @@ echo "WASI-SDK: ${UNDICI_WASI_MAJOR}.${UNDICI_WASI_MINOR}"
|
||||
echo
|
||||
echo "ada"
|
||||
echo "========================="
|
||||
ADA_VERSION=$(grep -oP '(?<=#define ADA_VERSION ).*\"' node-v${version}/deps/ada/ada.h |sed -e 's/^"//' -e 's/"$//')
|
||||
ADA_VERSION=$(grep -osP '(?<=#define ADA_VERSION ).*\"' node-v${version}/deps/ada/ada.h |sed -e 's/^"//' -e 's/"$//')
|
||||
ADA_VERSION=${ADA_VERSION:-0}
|
||||
echo "${ADA_VERSION}"
|
||||
echo
|
||||
echo "Applying versions to spec template"
|
||||
|
||||
sed -e "s/@NODE_PKG_MAJOR@/${NODE_PKG_MAJOR}/g" \
|
||||
-e "s/@NODE_MAJOR@/${NODE_MAJOR}/g" \
|
||||
-e "s/@NODE_MINOR@/${NODE_MINOR}/g" \
|
||||
-e "s/@NODE_PATCH@/${NODE_PATCH}/g" \
|
||||
-e "s/@FEDORA_DEFAULT_RELEASE_LOW@/${FEDORA_DEFAULT_RELEASE_LOW}/g" \
|
||||
-e "s/@FEDORA_DEFAULT_RELEASE_HIGH@/${FEDORA_DEFAULT_RELEASE_HIGH}/g" \
|
||||
-e "s/@NODE_SOVERSION@/${NODE_SOVERSION}/g" \
|
||||
-e "s/@V8_MAJOR@/${V8_MAJOR}/g" \
|
||||
-e "s/@V8_MINOR@/${V8_MINOR}/g" \
|
||||
-e "s/@V8_BUILD@/${V8_BUILD}/g" \
|
||||
-e "s/@V8_PATCH@/${V8_PATCH}/g" \
|
||||
-e "s/@C_ARES_VERSION@/${C_ARES_VERSION}/g" \
|
||||
-e "s/@LLHTTP_VERSION@/${LLHTTP_MAJOR}.${LLHTTP_MINOR}.${LLHTTP_PATCH}/g" \
|
||||
-e "s/@LIBUV_VERSION@/${UV_MAJOR}.${UV_MINOR}.${UV_PATCH}/g" \
|
||||
-e "s/@NGHTTP2_VERSION@/${NGHTTP2_VERSION}/g" \
|
||||
-e "s/@ICU_MAJOR@/${ICU_MAJOR}/g" \
|
||||
-e "s/@ICU_MINOR@/${ICU_MINOR}/g" \
|
||||
-e "s/@PUNYCODE_VERSION@/${PUNYCODE_VERSION}/g" \
|
||||
-e "s/@UVWASI_VERSION@/${UVWASI_VERSION}/g" \
|
||||
-e "s/@NPM_VERSION@/${NPM_VERSION}/g" \
|
||||
-e "s/@ZLIB_VERSION@/${ZLIB_VERSION}/g" \
|
||||
-e "s/@LEXER_VERSION@/${LEXER_VERSION}/g" \
|
||||
-e "s/@LEXER_WASI_MAJOR@/${LEXER_WASI_MAJOR}/g" \
|
||||
-e "s/@LEXER_WASI_MINOR@/${LEXER_WASI_MINOR}/g" \
|
||||
-e "s/@UNDICI_VERSION@/${UNDICI_VERSION}/g" \
|
||||
-e "s/@UNDICI_WASI_MAJOR@/${UNDICI_WASI_MAJOR}/g" \
|
||||
-e "s/@UNDICI_WASI_MINOR@/${UNDICI_WASI_MINOR}/g" \
|
||||
-e "s/@ADA_VERSION@/${ADA_VERSION}/g" \
|
||||
${SCRIPT_DIR}/packaging/nodejs.spec.in \
|
||||
# Get the list of patches we need to add to the specfile
|
||||
readarray -t patchlist < <(git ls-files |grep '^[0-9]\{4\}-.*\.patch')
|
||||
json_patchlist=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${patchlist[@]}")
|
||||
|
||||
IFS='' read -r -d '' template_json <<EOF
|
||||
{
|
||||
"NODE_PKG_MAJOR": $NODE_PKG_MAJOR,
|
||||
"NODE_MAJOR": $NODE_MAJOR,
|
||||
"NODE_MINOR": $NODE_MINOR,
|
||||
"NODE_PATCH": $NODE_PATCH,
|
||||
"FEDORA_DEFAULT_RELEASE_LOW": $FEDORA_DEFAULT_RELEASE_LOW,
|
||||
"FEDORA_DEFAULT_RELEASE_HIGH": $FEDORA_DEFAULT_RELEASE_HIGH,
|
||||
"NODE_SOVERSION": $NODE_SOVERSION,
|
||||
"V8_MAJOR": $V8_MAJOR,
|
||||
"V8_MINOR": $V8_MINOR,
|
||||
"V8_BUILD": $V8_BUILD,
|
||||
"V8_PATCH": $V8_PATCH,
|
||||
"C_ARES_VERSION": $C_ARES_VERSION,
|
||||
"LLHTTP_VERSION": $LLHTTP_VERSION,
|
||||
"LIBUV_VERSION": $LIBUV_VERSION,
|
||||
"NGHTTP2_VERSION": $NGHTTP2_VERSION,
|
||||
"ICU_MAJOR": $ICU_MAJOR,
|
||||
"ICU_MINOR": $ICU_MINOR,
|
||||
"PUNYCODE_VERSION": $PUNYCODE_VERSION,
|
||||
"UVWASI_VERSION": $UVWASI_VERSION,
|
||||
"NPM_VERSION": $NPM_VERSION,
|
||||
"ZLIB_VERSION": $ZLIB_VERSION,
|
||||
"LEXER_VERSION": $LEXER_VERSION,
|
||||
"LEXER_WASI_MAJOR": $LEXER_WASI_MAJOR,
|
||||
"LEXER_WASI_MINOR": $LEXER_WASI_MINOR,
|
||||
"UNDICI_VERSION": $UNDICI_VERSION,
|
||||
"UNDICI_WASI_MAJOR": $UNDICI_WASI_MAJOR,
|
||||
"UNDICI_WASI_MINOR": $UNDICI_WASI_MINOR,
|
||||
"ADA_VERSION": $ADA_VERSION,
|
||||
"PATCHES": $json_patchlist
|
||||
}
|
||||
EOF
|
||||
|
||||
echo ${template_json} | jinja2 ${SCRIPT_DIR}/packaging/nodejs.spec.j2 \
|
||||
> ${SCRIPT_DIR}/nodejs${NODE_PKG_MAJOR}.spec
|
||||
|
||||
if [ $_arg_push = 'on' ]; then
|
||||
|
@ -127,9 +127,6 @@
|
||||
# histogram_c - assumed from timestamps
|
||||
%global histogram_version 0.9.7
|
||||
|
||||
# ada URL parser
|
||||
%global ada_version 1.0.1
|
||||
|
||||
|
||||
Name: nodejs20
|
||||
Epoch: %{nodejs_epoch}
|
||||
@ -162,6 +159,8 @@ Source102: wasi-sdk-11.0-linux.tar.gz
|
||||
Source111: undici-5.20.0-stripped.tar.gz
|
||||
Source112: wasi-sdk-14.0-linux.tar.gz
|
||||
|
||||
Patch: 0001-Remove-unused-OpenSSL-config.patch
|
||||
|
||||
%if 0%{?nodejs_default}
|
||||
%global pkgname nodejs
|
||||
%package -n %{pkgname}
|
||||
@ -299,11 +298,9 @@ Provides: bundled(icu) = %{icu_version}
|
||||
Provides: bundled(uvwasi) = %{uvwasi_version}
|
||||
Provides: bundled(histogram) = %{histogram_version}
|
||||
|
||||
%if 0%{?nodejs_major} > 9
|
||||
# Upstream has added a new URL parser that has no option to build as a shared
|
||||
# library (19.7.0+)
|
||||
Provides: bundled(ada) = ${ada_version}
|
||||
%endif
|
||||
Provides: bundled(ada) = 1.0.1
|
||||
|
||||
|
||||
%description
|
||||
|
@ -43,11 +43,11 @@
|
||||
# feature releases that are only supported for nine months, which is shorter
|
||||
# than a Fedora release lifecycle.
|
||||
%global nodejs_epoch 1
|
||||
%global nodejs_major @NODE_MAJOR@
|
||||
%global nodejs_minor @NODE_MINOR@
|
||||
%global nodejs_patch @NODE_PATCH@
|
||||
%global nodejs_major {{ NODE_MAJOR }}
|
||||
%global nodejs_minor {{ NODE_MINOR }}
|
||||
%global nodejs_patch {{ NODE_PATCH }}
|
||||
# nodejs_soversion - from NODE_MODULE_VERSION in src/node_version.h
|
||||
%global nodejs_soversion @NODE_SOVERSION@
|
||||
%global nodejs_soversion {{ NODE_SOVERSION }}
|
||||
%global nodejs_abi %{nodejs_soversion}
|
||||
%global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}
|
||||
%global nodejs_release %{baserelease}
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
# Determine if this should be the default version for this Fedora release
|
||||
# The default version will own /usr/bin/node and friends
|
||||
%if 0%{?fedora} == @FEDORA_DEFAULT_RELEASE_LOW@ || 0%{?fedora} == @FEDORA_DEFAULT_RELEASE_HIGH@
|
||||
%if 0%{?fedora} == {{ FEDORA_DEFAULT_RELEASE_LOW }} || 0%{?fedora} == {{ FEDORA_DEFAULT_RELEASE_HIGH }}
|
||||
%global nodejs_default %{nodejs_major}
|
||||
%endif
|
||||
%global nodejs_private_sitelib %{nodejs_sitelib}_%{nodejs_major}
|
||||
@ -67,32 +67,32 @@
|
||||
# v8 - from deps/v8/include/v8-version.h
|
||||
# Epoch is set to ensure clean upgrades from the old v8 package
|
||||
%global v8_epoch 3
|
||||
%global v8_major @V8_MAJOR@
|
||||
%global v8_minor @V8_MINOR@
|
||||
%global v8_build @V8_BUILD@
|
||||
%global v8_patch @V8_PATCH@
|
||||
%global v8_major {{ V8_MAJOR }}
|
||||
%global v8_minor {{ V8_MINOR }}
|
||||
%global v8_build {{ V8_BUILD }}
|
||||
%global v8_patch {{ V8_PATCH }}
|
||||
%global v8_version %{v8_major}.%{v8_minor}.%{v8_build}.%{v8_patch}
|
||||
%global v8_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release}
|
||||
|
||||
# zlib - from deps/zlib/zlib.h
|
||||
%global zlib_version @ZLIB_VERSION@
|
||||
%global zlib_version {{ ZLIB_VERSION }}
|
||||
|
||||
# c-ares - from deps/cares/include/ares_version.h
|
||||
# https://github.com/nodejs/node/pull/9332
|
||||
%global c_ares_version @C_ARES_VERSION@
|
||||
%global c_ares_version {{ C_ARES_VERSION }}
|
||||
|
||||
# llhttp - from deps/llhttp/include/llhttp.h
|
||||
%global llhttp_version @LLHTTP_VERSION@
|
||||
%global llhttp_version {{ LLHTTP_VERSION }}
|
||||
|
||||
# libuv - from deps/uv/include/uv/version.h
|
||||
%global libuv_version @LIBUV_VERSION@
|
||||
%global libuv_version {{ LIBUV_VERSION }}
|
||||
|
||||
# nghttp2 - from deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
|
||||
%global nghttp2_version @NGHTTP2_VERSION@
|
||||
%global nghttp2_version {{ NGHTTP2_VERSION }}
|
||||
|
||||
# ICU - from tools/icu/current_ver.dep
|
||||
%global icu_major @ICU_MAJOR@
|
||||
%global icu_minor @ICU_MINOR@
|
||||
%global icu_major {{ ICU_MAJOR }}
|
||||
%global icu_minor {{ ICU_MINOR }}
|
||||
%global icu_version %{icu_major}.%{icu_minor}
|
||||
|
||||
%global icudatadir %{nodejs_datadir}/icudata
|
||||
@ -107,11 +107,11 @@
|
||||
# punycode - from lib/punycode.js
|
||||
# Note: this was merged into the mainline since 0.6.x
|
||||
# Note: this will be unmerged in an upcoming major release
|
||||
%global punycode_version @PUNYCODE_VERSION@
|
||||
%global punycode_version {{ PUNYCODE_VERSION }}
|
||||
|
||||
# npm - from deps/npm/package.json
|
||||
%global npm_epoch 1
|
||||
%global npm_version @NPM_VERSION@
|
||||
%global npm_version {{ NPM_VERSION }}
|
||||
|
||||
# In order to avoid needing to keep incrementing the release version for the
|
||||
# main package forever, we will just construct one for npm that is guaranteed
|
||||
@ -122,16 +122,13 @@
|
||||
%global npm_envr %{npm_epoch}:%{npm_version}-%{npm_release}
|
||||
|
||||
# uvwasi - from deps/uvwasi/include/uvwasi.h
|
||||
%global uvwasi_version @UVWASI_VERSION@
|
||||
%global uvwasi_version {{ UVWASI_VERSION }}
|
||||
|
||||
# histogram_c - assumed from timestamps
|
||||
%global histogram_version 0.9.7
|
||||
|
||||
# ada URL parser
|
||||
%global ada_version @ADA_VERSION@
|
||||
|
||||
|
||||
Name: nodejs@NODE_PKG_MAJOR@
|
||||
Name: nodejs{{ NODE_PKG_MAJOR }}
|
||||
Epoch: %{nodejs_epoch}
|
||||
Version: %{nodejs_version}
|
||||
Release: %{nodejs_release}
|
||||
@ -157,17 +154,21 @@ Source100: nodejs-sources.sh
|
||||
# Note: These sources would also include pre-compiled WASM blobs… so they are adjusted not to.
|
||||
# Recipes for creating these blobs are included in the sources.
|
||||
# These are generated by nodejs-sources.sh
|
||||
Source101: cjs-module-lexer-@LEXER_VERSION@-stripped.tar.gz
|
||||
Source102: wasi-sdk-@LEXER_WASI_MAJOR@.@LEXER_WASI_MINOR@-linux.tar.gz
|
||||
Source111: undici-@UNDICI_VERSION@-stripped.tar.gz
|
||||
Source112: wasi-sdk-@UNDICI_WASI_MAJOR@.@UNDICI_WASI_MINOR@-linux.tar.gz
|
||||
Source101: cjs-module-lexer-{{ LEXER_VERSION }}-stripped.tar.gz
|
||||
Source102: wasi-sdk-{{ LEXER_WASI_MAJOR }}.{{ LEXER_WASI_MINOR }}-linux.tar.gz
|
||||
Source111: undici-{{ UNDICI_VERSION }}-stripped.tar.gz
|
||||
Source112: wasi-sdk-{{ UNDICI_WASI_MAJOR }}.{{ UNDICI_WASI_MINOR }}-linux.tar.gz
|
||||
|
||||
{% for patch in PATCHES -%}
|
||||
Patch: {{ patch }}
|
||||
{% endfor -%}
|
||||
{# #}
|
||||
%if 0%{?nodejs_default}
|
||||
%global pkgname nodejs
|
||||
%package -n %{pkgname}
|
||||
Summary: JavaScript runtime
|
||||
%else
|
||||
%global pkgname nodejs@NODE_PKG_MAJOR@
|
||||
%global pkgname nodejs{{ NODE_PKG_MAJOR }}
|
||||
%endif
|
||||
|
||||
BuildRequires: make
|
||||
@ -299,12 +300,11 @@ Provides: bundled(icu) = %{icu_version}
|
||||
Provides: bundled(uvwasi) = %{uvwasi_version}
|
||||
Provides: bundled(histogram) = %{histogram_version}
|
||||
|
||||
%if 0%{?nodejs_major} > 9
|
||||
{% if ADA_VERSION -%}
|
||||
# Upstream has added a new URL parser that has no option to build as a shared
|
||||
# library (19.7.0+)
|
||||
Provides: bundled(ada) = ${ada_version}
|
||||
%endif
|
||||
|
||||
Provides: bundled(ada) = {{ ADA_VERSION }}
|
||||
{% endif %}
|
||||
|
||||
%description
|
||||
Node.js is a platform built on Chrome's JavaScript runtime \
|
Loading…
Reference in New Issue
Block a user