Tweak used macros

Resolves: RHEL-111978

- Use correct form of %node_evr in place of non-existent %nodejs_evr
- Utilize %nodejs_subpackage_release during definition of the version
  macros, then rely on %<name>_release everywhere.

[skip changelog]
This commit is contained in:
Jan Staněk 2025-08-12 14:18:36 +02:00 committed by Andrei Radchenko
parent 6a84fa4bbf
commit 6ae6129aeb
2 changed files with 21 additions and 15 deletions

View File

@ -5,6 +5,12 @@
# === Versions of any software shipped in the main nodejs tarball
%nodejs_define_version node 1:24.6.0-%{autorelease} -p
# Special release for sub-packages with their own version string.
# The complex release string ensures that the subpackage release is always increasing,
# even in the event that the main package version changes
# while the sub-package version stays the same.
%global nodejs_subpackage_release %{node_epoch}.%{node_version}.%{node_release}
# The following ones are generated via script;
# expect anything between the markers to be overwritten on any update.
@ -50,12 +56,6 @@
%nodejs_define_version zlib 1.3.1
# END automatic-version-macros # DO NOT REMOVE THIS LINE!
# Special release for sub-packages with their own version string.
# The complex release string ensures that the subpackage release is always increasing,
# even in the event that the main package version changes
# while the sub-package version stays the same.
%global nodejs_subpackage_release %{node_epoch}.%{node_version}.%{node_release}
# === Conditional build global options
# Use all vendored dependencies when bootstrapping
%bcond all_deps_bundled %{with bootstrap}
@ -124,7 +124,7 @@ Requires: ca-certificates
Requires: %{name}-libs%{?_isa} = %{node_evr}
Recommends: %{name}-docs = %{node_evr}
Recommends: %{name}-full-i18n%{?_isa} = %{node_evr}
Recommends: %{name}-npm >= %{npm_epoch}:%{npm_version}-%{nodejs_subpackage_release}
Recommends: %{name}-npm >= %{npm_evr}
# Virtual provides
Provides: nodejs(abi) = %{node_soversion}, nodejs(abi%{node_version_major}) = %{node_soversion}
Provides: nodejs(engine) = %{node_version}
@ -188,11 +188,11 @@ Development headers for the Node.js JavaScript runtime.
Summary: v8 development headers
Epoch: %{v8_epoch}
Version: %{v8_version}
Release: %{nodejs_subpackage_release}
Release: %{v8_release}
Requires: nodejs%{node_version_major}-devel%{?_isa} = %{node_evr}
Requires: nodejs%{node_version_major}-libs%{?_isa} = %{node_evr}
Provides: v8-devel = %{v8_epoch}:%{v8_version}-%{nodejs_subpackage_release}
Provides: v8-devel = %{v8_evr}
Obsoletes: v8-devel <= 2:10.2.154, v8-314-devel <= 2:3.14
%description -n v8-%{v8_version_major}.%{v8_version_minor}-devel
@ -201,8 +201,8 @@ Development headers for the v8 runtime.
%package libs
Summary: Node.js and v8 libraries
# v8 used to be a separate package; keep providing it virtually
Provides: v8 = %{v8_epoch}:%{v8_version}-%{nodejs_subpackage_release}
Provides: v8%{?_isa} = %{v8_epoch}:%{v8_version}-%{nodejs_subpackage_release}
Provides: v8 = %{v8_evr}
Provides: v8%{?_isa} = %{v8_evr}
Obsoletes: v8 < 1:6.7.17-10
Provides: libv8.so.%{v8_version_major}%{?_so_arch_suffix} = %{v8_epoch}:%{v8_version}
Provides: libv8_libbase.so.%{v8_version_major}%{?_so_arch_suffix} = %{v8_epoch}:%{v8_version}
@ -231,7 +231,7 @@ The API documentation for the Node.js JavaScript runtime.
Summary: Node.js Package Manager
Epoch: %{npm_epoch}
Version: %{npm_version}
Release: %{nodejs_subpackage_release}
Release: %{npm_release}
BuildArch: noarch
Requires: nodejs%{node_version_major} = %{node_evr}

View File

@ -108,19 +108,25 @@ parse_punycode_version() {
parse_npm_version() {
# NPM was originally a separate package using epoch; we need to keep it
local -r NPM_EPOCH=1
# NPM is a subpackage with it's own version. Use always-increasing release macro
local -r NPM_RELEASE='%{nodejs_subpackage_release}'
local -r path="${1?No path to npm package.json provided!}"
printf '%d:' "${NPM_EPOCH}" && version_from_json "${path}"
printf '%d:%s-%s\n' "${NPM_EPOCH}" "$(version_from_json "${path}")" "${NPM_RELEASE}"
}
parse_v8_version() {
# v8 was originally a separate package using epoch; we need to keep it
local -r V8_EPOCH=3
# v8 is a subpackage with it's own version. Use always-increasing release macro
local -r V8_RELEASE='%{nodejs_subpackage_release}'
local -r path="${1?No path to v8 version header provided!}"
printf '%d:' "${V8_EPOCH}" && version_from_c_define "${path}" \
V8_{MAJOR,MINOR}_VERSION V8_BUILD_NUMBER V8_PATCH_LEVEL
printf '%d:%s-%s\n' \
"${V8_EPOCH}" \
"$(version_from_c_define "${path}" V8_{MAJOR,MINOR}_VERSION V8_BUILD_NUMBER V8_PATCH_LEVEL)" \
"${V8_RELEASE}"
}
# Main script