From 1e45404676929d80290c4218db442ab5f04e1295 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Sun, 1 May 2022 08:42:30 -0700 Subject: [PATCH 01/31] nodejs-packaging-bundler: optionally use a local tarball instead of npm --- README.md | 4 ++-- nodejs-packaging-bundler | 18 ++++++++++++++++-- nodejs-packaging.spec | 5 ++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cbad903..ee3d30b 100644 --- a/README.md +++ b/README.md @@ -152,11 +152,11 @@ For more detailed packaging information go to the ## Bundling Script ``` -nodejs-packaging-bundler [version] +nodejs-packaging-bundler [version] [tarball] ``` nodejs-packaging-bundler is it's own package, nodejs-packaging-bundler and must be installed before use. -nodejs-packaging-bundler gets the latest npm version available, if no version is given. +nodejs-packaging-bundler gets the latest npm version available, if no version is given, or uses the existing tarball if one is given. Using npm is preferred for to ease reproducibility. If a local tarball is required (e.g. because the package is missing from npm or its version is too old), please ensure to document how the tarball was created. It produces four files and puts them in ${HOME}/rpmbuild/SOURCES * -.tgz - This is the tarball from npm.org diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index 5be05e1..0f05dc9 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -2,13 +2,14 @@ OUTPUT_DIR="$(rpm -E '%{_sourcedir}')" usage() { - echo "Usage `basename $0` [version] " >&2 + echo "Usage `basename $0` [version] [tarball]" >&2 echo >&2 echo " Given a npm module name, and optionally a version," >&2 echo " download the npm, the prod and dev dependencies," >&2 echo " each in their own tarball." >&2 echo " Also finds licenses prod dependencies." >&2 echo " All three tarballs and the license list are copied to ${OUTPUT_DIR}" >&2 + echo " If a tarball is passed, use that instead of downloading from npm" >&2 echo >&2 exit 1 } @@ -38,6 +39,9 @@ fi if [ $# -ge 2 ]; then VERSION="$2" + if [ $# -ge 3 ]; then + TARBALL="$(realpath "$3")" + fi else VERSION="$(npm view ${PACKAGE} version)" fi @@ -47,7 +51,17 @@ TMP_DIR=$(mktemp -d -t ci-XXXXXXXXXX) mkdir -p ${OUTPUT_DIR} mkdir -p ${TMP_DIR} pushd ${TMP_DIR} -npm pack ${PACKAGE} +if [ -f "$TARBALL" ]; then + TARBALL_DIR=$(mktemp -d -t ci-XXXXXXXXXX) + pushd ${TARBALL_DIR} + tar xfz ${TARBALL} --strip-components 1 + npm pack . + popd > /dev/null + mv ${TARBALL_DIR}/*.tgz . + rm -rf ${TARBALL_DIR} +else + npm pack ${PACKAGE} +fi tar xfz *.tgz cd package echo " Downloading prod dependencies" diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index f3d843e..f206c54 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 2021.06 -Release: 4%{?dist} +Release: 5%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -84,6 +84,9 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog +* Sun May 01 2022 Davide Cavalca - 2021.06-5 +- NPM bundler: optionally use a local tarball instead of npm + * Thu Jan 20 2022 Stephen Gallagher - 2021.06-4 - NPM bundler: also find namespaced bundled dependencies From 3c8da6aa4e7830de62e876bea80c31634c7f5721 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 22 Jul 2022 00:41:14 +0000 Subject: [PATCH 02/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- nodejs-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index f206c54..b0ef60e 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 2021.06 -Release: 5%{?dist} +Release: 6%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -84,6 +84,9 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog +* Fri Jul 22 2022 Fedora Release Engineering - 2021.06-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Sun May 01 2022 Davide Cavalca - 2021.06-5 - NPM bundler: optionally use a local tarball instead of npm From 53057fc31167b40665aac1ad3827410414feb7b9 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Sat, 2 Jul 2022 11:40:15 -0700 Subject: [PATCH 03/31] nodejs-packaging-bundler: recursively bundle modules for all packages found --- nodejs-packaging-bundler | 41 ++++++++++++++++++++++++---------------- nodejs-packaging.spec | 5 ++++- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index 0f05dc9..6fce03f 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -64,15 +64,20 @@ else fi tar xfz *.tgz cd package -echo " Downloading prod dependencies" -npm install --no-optional --only=prod -if [ $? -ge 1 ] ; then - echo " ERROR WILL ROBINSON" +for packagejson in $(find . -type d -name node_modules\* -prune -o -type f -name package.json -print); do + pushd $(dirname $packagejson) + echo " Downloading prod dependencies" + npm install --no-optional --only=prod + if [ $? -ge 1 ] ; then + echo " ERROR WILL ROBINSON" rm -rf node_modules -else - echo " Successful prod dependencies download" + else + echo " Successful prod dependencies download" mv node_modules/ node_modules_prod -fi + fi + popd +done + echo "LICENSES IN BUNDLE:" find . -name "package.json" -exec jq '.license | strings' {} \; >> ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt find . -name "package.json" -exec jq '.license | objects | .type' {} \; >> ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt 2>/dev/null @@ -89,19 +94,23 @@ if [ -s ${TMP_DIR}/nolicense.txt ]; then fi -echo " Downloading dev dependencies" -npm install --no-optional --only=dev -if [ $? -ge 1 ] ; then - echo " ERROR WILL ROBINSON" -else - echo " Successful dev dependencies download" +for packagejson in $(find . -type d -name node_modules\* -prune -o -type f -name package.json -print); do + pushd $(dirname $packagejson) + echo " Downloading dev dependencies" + npm install --no-optional --only=dev + if [ $? -ge 1 ] ; then + echo " ERROR WILL ROBINSON" + else + echo " Successful dev dependencies download" mv node_modules/ node_modules_dev -fi + fi + popd +done if [ -d node_modules_prod ] ; then - tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-prod.tgz node_modules_prod + tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-prod.tgz $(find . -type d -name node_modules_prod) fi if [ -d node_modules_dev ] ; then - tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-dev.tgz node_modules_dev + tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-dev.tgz $(find . -type d -name node_modules_dev) fi cd .. cp -v ${PACKAGE_SAFE}-${VERSION}* "${OUTPUT_DIR}" diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index b0ef60e..84997a2 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 2021.06 -Release: 6%{?dist} +Release: 7%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -84,6 +84,9 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog +* Tue Oct 18 2022 Davide Cavalca - 2021.06-7 +- NPM bundler: recursively bundle modules for all packages found + * Fri Jul 22 2022 Fedora Release Engineering - 2021.06-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From 2a08691cf3d07c737772210e5a7b7f4c0c70c4eb Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 24 Aug 2022 13:08:23 -0400 Subject: [PATCH 04/31] Move native module building tools here from Node.js Signed-off-by: Stephen Gallagher --- nodejs-packaging.spec | 18 +++++++++++++++--- nodejs_abi.attr | 2 ++ nodejs_abi.req | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 nodejs_abi.attr create mode 100755 nodejs_abi.req diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 84997a2..b1e8275 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -1,8 +1,8 @@ %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: nodejs-packaging -Version: 2021.06 -Release: 7%{?dist} +Version: 2022.10 +Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -19,13 +19,19 @@ Source0007: nodejs-symlink-deps Source0008: nodejs.attr Source0009: nodejs.prov Source0010: nodejs.req -Source0011: nodejs-packaging-bundler +Source0011: nodejs_abi.attr +Source0012: nodejs_abi.req + +Source0111: nodejs-packaging-bundler # Created with `tar cfz test.tar.gz test` Source0101: test.tar.gz BuildRequires: python3 +# Several of the macros require the /usr/bin/node command, so we need to +# ensure that it is present when packaging. +Requires: /usr/bin/node Requires: redhat-rpm-config %description @@ -59,8 +65,10 @@ popd %install install -Dpm0644 macros.nodejs %{buildroot}%{macrosdir}/macros.nodejs install -Dpm0644 nodejs.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs.attr +install -Dpm0644 nodejs_abi.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_abi.attr install -pm0755 nodejs.prov %{buildroot}%{_rpmconfigdir}/nodejs.prov install -pm0755 nodejs.req %{buildroot}%{_rpmconfigdir}/nodejs.req +install -pm0755 nodejs_abi.req %{buildroot}%{_rpmconfigdir}/nodejs_abi.req install -pm0755 nodejs-symlink-deps %{buildroot}%{_rpmconfigdir}/nodejs-symlink-deps install -pm0755 nodejs-fixdep %{buildroot}%{_rpmconfigdir}/nodejs-fixdep install -pm0755 nodejs-setversion %{buildroot}%{_rpmconfigdir}/nodejs-setversion @@ -84,6 +92,10 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog +* Thu Oct 20 2022 Stephen Gallagher - 2022.10-1 +- Move native module building tools here from Node.js +- Add `Requires: /usr/bin/node` + * Tue Oct 18 2022 Davide Cavalca - 2021.06-7 - NPM bundler: recursively bundle modules for all packages found diff --git a/nodejs_abi.attr b/nodejs_abi.attr new file mode 100644 index 0000000..d161239 --- /dev/null +++ b/nodejs_abi.attr @@ -0,0 +1,2 @@ +%__nodejs_native_requires %{_rpmconfigdir}/nodejs_abi.req +%__nodejs_native_path ^/usr/lib.*/node_modules/.*\\.node$ diff --git a/nodejs_abi.req b/nodejs_abi.req new file mode 100755 index 0000000..afc6f3d --- /dev/null +++ b/nodejs_abi.req @@ -0,0 +1,14 @@ +#!/bin/bash + +# Get the version from the default Node.js +full_version=$(/usr/bin/node --version) + +# Trim off the leading 'v' +full_version=${full_version:1} + +# Get the different version components +split_version=(${full_version//\./ }) + +# Write out the Virtual Requires +echo "nodejs(abi${split_version[0]}) >= ${split_version[0]}.${split_version[1]}" + From abc52b1e7bcc9b929e582b1a14245d387924f6a2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 21:42:02 +0000 Subject: [PATCH 05/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- nodejs-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index b1e8275..39603a8 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 2022.10 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -92,6 +92,9 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 2022.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Thu Oct 20 2022 Stephen Gallagher - 2022.10-1 - Move native module building tools here from Node.js - Add `Requires: /usr/bin/node` From 5079b893be201cc130b717193b8ae30cb8a43646 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 28 Oct 2022 15:13:32 -0400 Subject: [PATCH 06/31] Bundler: Update to modern npm arguments Signed-off-by: Stephen Gallagher --- nodejs-packaging-bundler | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index 6fce03f..943368a 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -67,7 +67,7 @@ cd package for packagejson in $(find . -type d -name node_modules\* -prune -o -type f -name package.json -print); do pushd $(dirname $packagejson) echo " Downloading prod dependencies" - npm install --no-optional --only=prod + npm install --omit=dev --omit=optional if [ $? -ge 1 ] ; then echo " ERROR WILL ROBINSON" rm -rf node_modules @@ -97,7 +97,7 @@ fi for packagejson in $(find . -type d -name node_modules\* -prune -o -type f -name package.json -print); do pushd $(dirname $packagejson) echo " Downloading dev dependencies" - npm install --no-optional --only=dev + npm install --omit=optional if [ $? -ge 1 ] ; then echo " ERROR WILL ROBINSON" else From 0cd3fed400c7b69acd2d9af9afb6ac83a733c11c Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 10 Mar 2023 10:09:57 -0500 Subject: [PATCH 07/31] The Node.js ABI version is now represented by the NODE_MODULE_VERSION Signed-off-by: Stephen Gallagher --- nodejs_abi.req | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/nodejs_abi.req b/nodejs_abi.req index afc6f3d..a33a7b5 100755 --- a/nodejs_abi.req +++ b/nodejs_abi.req @@ -1,14 +1,8 @@ #!/bin/bash -# Get the version from the default Node.js -full_version=$(/usr/bin/node --version) - -# Trim off the leading 'v' -full_version=${full_version:1} - -# Get the different version components -split_version=(${full_version//\./ }) +# Get the ABI version +abi_version=$(/usr/bin/node -p process.versions.modules) # Write out the Virtual Requires -echo "nodejs(abi${split_version[0]}) >= ${split_version[0]}.${split_version[1]}" +echo "nodejs(abi) = ${abi_version}" From 1998d72b1a351b5b58a56c0692d21a2216708b37 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 10 Mar 2023 10:37:28 -0500 Subject: [PATCH 08/31] Set correct %nodejs_sitelib path Resolves: rhbz#2177117 Signed-off-by: Stephen Gallagher --- macros.nodejs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/macros.nodejs b/macros.nodejs index f86891c..94eae4b 100644 --- a/macros.nodejs +++ b/macros.nodejs @@ -1,16 +1,17 @@ # nodejs binary %__nodejs %{_bindir}/node +# currently installed nodejs version +%nodejs_version %(%{__nodejs} -v | sed s/v//) +%_nodejs_major_version %(echo %{nodejs_version} | sed 's#^\\([0-9]\\+\\).*#\\1#') + # nodejs library directory -%nodejs_sitelib %{_prefix}/lib/node_modules +%nodejs_sitelib %{_prefix}/lib/node_modules_%{_nodejs_major_version} #arch specific library directory #for future-proofing only; we don't do multilib %nodejs_sitearch %{nodejs_sitelib} -# currently installed nodejs version -%nodejs_version %(%{__nodejs} -v | sed s/v//) - # symlink dependencies so `npm link` works # this should be run in every module's %%install section # pass --check to work in the current directory instead of the buildroot @@ -25,7 +26,7 @@ %nodejs_fixdep %{_rpmconfigdir}/nodejs-fixdep # patch package.json to set the package version -# e.g. `%%nodejs_setversion 1.2.3` +# e.g. `%%nodejs_setversion 1.2.3` %nodejs_setversion %{_rpmconfigdir}/nodejs-setversion # macro to filter unwanted provides from Node.js binary native modules From 5c3231171a8e419aecf396a870d04ac73022d2f1 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 10 Mar 2023 10:57:08 -0500 Subject: [PATCH 09/31] Update version and switch to rpmautospec Signed-off-by: Stephen Gallagher --- changelog | 170 ++++++++++++++++++++++++++++++++++++++++++ nodejs-packaging.spec | 4 +- 2 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 changelog diff --git a/changelog b/changelog new file mode 100644 index 0000000..d80c151 --- /dev/null +++ b/changelog @@ -0,0 +1,170 @@ +* Thu Jan 19 2023 Fedora Release Engineering - 2022.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Oct 20 2022 Stephen Gallagher - 2022.10-1 +- Move native module building tools here from Node.js +- Add `Requires: /usr/bin/node` + +* Tue Oct 18 2022 Davide Cavalca - 2021.06-7 +- NPM bundler: recursively bundle modules for all packages found + +* Fri Jul 22 2022 Fedora Release Engineering - 2021.06-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Sun May 01 2022 Davide Cavalca - 2021.06-5 +- NPM bundler: optionally use a local tarball instead of npm + +* Thu Jan 20 2022 Stephen Gallagher - 2021.06-4 +- NPM bundler: also find namespaced bundled dependencies + +* Thu Jul 22 2021 Fedora Release Engineering - 2021.06-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jun 22 2021 Stephen Gallagher - 2021.06-2 +- Fix hard-coded output directory in the bundler + +* Wed Jun 02 2021 Stephen Gallagher - 2021.06-1 +- Update to 2021.06-1 +- bundler: Handle archaic license metadata +- bundler: Warn about bundled dependencies with no license metadata + +* Tue Jan 26 2021 Fedora Release Engineering - 2021.01-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Jan 20 2021 Stephen Gallagher - 2021.01-2 +- nodejs-packaging-bundler improvements to handle uncommon characters + +* Wed Jan 06 2021 Troy Dawson - 2021.01 +- Add nodejs-packaging-bundler and update README.md + +* Fri Sep 18 2020 Stephen Gallagher - 2020.09-1 +- Move to dist-git as the upstream + +* Wed Sep 02 2020 Stephen Gallagher - 25-1 +- Fix incorrect bundled library detection for Requires + +* Tue Sep 01 2020 Stephen Gallagher - 24-1 +- Check node_modules_prod for bundled dependencies + +* Tue Jul 28 2020 Fedora Release Engineering - 23-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jun 03 2020 Stephen Gallagher - 23-3 +- Drop Requires: nodejs(engine) + +* Wed Jan 29 2020 Fedora Release Engineering - 23-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Oct 31 2019 Tom Hughes - 23-1 +- Ensure nodejs(engine) is required for packages with no dependencies + +* Thu Jul 25 2019 Fedora Release Engineering - 22-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue Jul 2 2019 Tom Hughes - 22-1 +- Refactor nodejs.req in more idiomatic Python +- Treat only external dependency links as un-bundled + +* Mon Jun 10 2019 Tom Hughes - 21-1 +- Refactor nodejs.prov in more idiomatic Python + +* Fri Feb 01 2019 Fedora Release Engineering - 20-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sat Jan 5 2019 Tom Hughes - 20-1 +- Fix handling of ^ dependencies for multiversion modules + +* Thu Jan 3 2019 Tom Hughes - 18-1 +- Handle =, >= and <= dependencies for multiversion modules + +* Fri Jul 13 2018 Fedora Release Engineering - 17-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Thu May 3 2018 Tom Hughes - 17-1 +- Fix version comparators with a space after the operator + +* Tue May 1 2018 Tom Hughes - 16-1 +- Rewrite nodejs.req to better match npm versioning rules +- Add tests for nodejs.req and nodejs.prov + +* Mon Apr 30 2018 Tom Hughes - 15-1 +- Fix caret dependency ranges + +* Thu Apr 12 2018 Tom Hughes - 14-1 +- Only match top level modules for requires and provides generation + +* Wed Feb 28 2018 Tom Hughes - 13-1 +- Add %%nodejs_setversion macro + +* Fri Feb 23 2018 Tom Hughes - 12-1 +- Port to python 3 + +* Thu Feb 08 2018 Fedora Release Engineering - 11-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sat Jan 13 2018 Tom Hughes - 11-1 +- nodesjs.req: use boolean with for range dependencies + +* Tue Sep 12 2017 Stephen Gallagher - 10-1 +- Release v10 +- Automatically generate Provides for bundled npm dependencies + +* Thu Jul 27 2017 Fedora Release Engineering - 9-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Tue Feb 21 2017 Tom Hughes - 9-3 +- switch source URL to pagure + +* Fri Feb 10 2017 Fedora Release Engineering - 9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Feb 2 2016 Tom Hughes - 9-1 +- nodejs-fixdep: stop --move erroring on missing dependency types + +* Sun Jan 31 2016 Tom Hughes - 8-1 +- nodejs-fixdep: add --move option +- nodejs-symlink-deps: add --optional option +- req: generate suggests for optional dependencies + +* Mon Nov 16 2015 Tom Hughes - 7-5 +- nodejs-symlink-deps: handle caret in versions + +* Wed Jun 17 2015 Fedora Release Engineering - 7-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Wed Mar 4 2015 Ville Skyttä - 7-3 +- Install macros in %%{_rpmconfidir}/macros.d where available (#1074279) + +* Sat Jun 07 2014 Fedora Release Engineering - 7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun May 25 2014 T.C. Hollingsworth - 7-1 +- nodejs-symlink-deps: fix regression preventing multiply versioned modules from + being symlinked correctly + +* Sat May 24 2014 T.C. Hollingsworth - 6-1 +- nodejs-fixdep: use real option parsing +- nodejs-fixdep: support modifying optionalDependencies and devDependencies +- req: support the caret operator +- nodejs-symlink-deps: add --force option +- nodejs-symlink-deps: add --build alias for --check +- nodejs-fixdep: support converting to caret dependencies +- nodejs-fixdep: support non-dictionary dependency properties +- multiver_modules: add nan + +* Mon Jul 29 2013 T.C. Hollingsworth - 4-1 +- handle cases where the symlink target exists gracefully + +* Wed Jul 10 2013 T.C. Hollingsworth - 3-1 +- dependencies and engines can be lists or strings too +- handle unversioned dependencies on multiply versioned modules correctly + (RHBZ#982798) +- restrict to compatible arches + +* Fri Jun 21 2013 T.C. Hollingsworth - 2-1 +- move multiple version list to /usr/share/node +- bump nodejs Requires to 0.10.12 +- add Requires: redhat-rpm-config + +* Thu Jun 13 2013 T.C. Hollingsworth - 1-1 +- initial package diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 39603a8..46fb651 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -1,8 +1,8 @@ %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: nodejs-packaging -Version: 2022.10 -Release: 2%{?dist} +Version: 2023.03 +Release: %autorelease Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT From aacfe2f12bd85b5f1c357185e3338fd339eca4a6 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 27 Apr 2023 11:44:13 -0400 Subject: [PATCH 10/31] Drop instructions for upgrading node pkg It is out of date as of https://www.fedoraproject.org/wiki/Changes/NodejsRepackaging and we now have packaging instructions included in the README.md of the individual Node.js interpreter packaging repositories. Signed-off-by: Stephen Gallagher --- README.md | 139 ------------------------------------------------------ 1 file changed, 139 deletions(-) diff --git a/README.md b/README.md index ee3d30b..dca99d9 100644 --- a/README.md +++ b/README.md @@ -1,142 +1,3 @@ -# How to update Node.js in Fedora - -## Determine the Node.js version -Monitor the [Node.js Blog](https://nodejs.org/en/blog/) to be notified of -available updates. - -For simplicity and copy-and-paste of instructions below, set some variables -here: - -``` -NODEJS_MAJOR=12 -NODEJS_VERSION=12.9.0 -``` - -## Clone the Fedora package repository -These steps assume that you are a comaintainer of Node.js or a provenpackager -in Fedora. - -``` -fedpkg clone nodejs nodejs-fedora -``` - -Next, switch to the major version branch you are going to update. We'll use -Node.js 12.9.0 in this document. Adjust the versions appropriately for the -version you are working on. - -``` -pushd nodejs-fedora -fedpkg switch-branch $NODEJS_MAJOR -popd -``` - - -## Clone the Fedora Module repository - -``` -fedpkg clone modules/nodejs nodejs-fedora-module -``` - - -## Clone the upstream Node.js repository -``` -git clone -o upstream git://github.com/nodejs/node.git nodejs-upstream -``` - - -## Rebase the Fedora patches atop the latest release - -``` -pushd nodejs-upstream -git checkout -b fedora-v$NODEJS_VERSION v$NODEJS_VERSION -git am -3 ../nodejs-fedora/*.patch -``` - -If the patches do not apply cleanly, resolve the merges appropriately. Once -they have all been applied, output them again: - -``` -git format-patch -M --patience --full-index -o ../nodejs-fedora v$NODEJS_VERSION..HEAD -popd -``` - - -## Update the Node.js tarball and specfile - -``` -pushd nodejs-fedora -./nodejs-tarball.sh $NODEJS_VERSION -``` - -Note that this command will also output all of the versions for the software -bundled with Node.js. You will need to edit `nodejs.spec` and update the -%global values near the top of that file to include the appropriate values -matching the dependencies. Make sure to also update the Node.js versions too! - -Note that if libuv is updated, you need to ensure that the libuv in each -buildroot is of a sufficient version. If not, you may need to update that -package first and submit a buildroot override. - -Update the RPM spec %changelog appropriately. - - -## (Preferred) Perform a scratch-build on at least one architecture - -``` -fedpkg scratch-build [--arch x86_64] --srpm -``` - -Verify that it built successfully. - - -## Push the changes up to Fedora -``` -fedpkg commit -cs -fedpkg push -popd -``` - - -## (Optional) Build for Fedora releases - -If this major version is the default for one or more Fedora releases, build it -for them. (Note: this step will go away in the future, once module default -streams are available in the non-modular buildroot.) - -In the case of Node.js 12.x, this is the default version for Fedora 31 and 32. - -``` -pushd nodejs-fedora -fedpkg switch-branch [master|31] -git merge $NODEJS_MAJOR -fedpkg push -fedpkg build -popd -``` - -## Build module stream - -``` -pushd nodejs-fedora-module -fedpkg switch-branch $NODEJS_MAJOR -``` - -If the module has changed any package dependencies (such as added a dep on a -new shared library), you may need to modify nodejs.yaml here. If not, you can -simply run: - -``` -git commit --allow-empty -sm "Update to $NODEJS_VERSION" -fedpkg push -fedpkg module-build -popd -``` - -## Submit built packages to Bodhi -Follow the usual processes for stable/branched releases to submit builds for -testing. - - # How to bundle nodejs libraries in Fedora The upstream Node.js stance on From 53bdaf5b75e669b29d84c70adb29a51a36fdfcb0 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jul 2023 16:47:03 +0000 Subject: [PATCH 11/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering From 7e46ce796e19c687254ed769078cda6879709fff Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 24 Oct 2023 08:35:12 -0400 Subject: [PATCH 12/31] Get autoprovides from any package.json Signed-off-by: Stephen Gallagher --- nodejs-packaging.spec | 2 +- nodejs.attr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 46fb651..2553949 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -1,7 +1,7 @@ %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: nodejs-packaging -Version: 2023.03 +Version: 2023.10 Release: %autorelease Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch diff --git a/nodejs.attr b/nodejs.attr index 1066499..c6bda9e 100644 --- a/nodejs.attr +++ b/nodejs.attr @@ -1,4 +1,4 @@ %__nodejs_provides %{_rpmconfigdir}/nodejs.prov %__nodejs_requires %{_rpmconfigdir}/nodejs.req %__nodejs_suggests %{_rpmconfigdir}/nodejs.req --optional -%__nodejs_path ^/usr/lib(64)?/node_modules/[^/]+/package\\.json$ +%__nodejs_path ^/usr/lib.*/node_modules.*/package\\.json$ From 9b4f2a673f2651f95df078a5143ee3ea8855de01 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 26 Oct 2023 10:04:04 -0400 Subject: [PATCH 13/31] Restrict autoprovides and requires to top-level Signed-off-by: Stephen Gallagher --- nodejs.attr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodejs.attr b/nodejs.attr index c6bda9e..018bdbe 100644 --- a/nodejs.attr +++ b/nodejs.attr @@ -1,4 +1,4 @@ %__nodejs_provides %{_rpmconfigdir}/nodejs.prov %__nodejs_requires %{_rpmconfigdir}/nodejs.req %__nodejs_suggests %{_rpmconfigdir}/nodejs.req --optional -%__nodejs_path ^/usr/lib.*/node_modules.*/package\\.json$ +%__nodejs_path ^/usr/lib/node_modules\(_[[:digit:]]\+\)\{0,1\}/[^/]\+/package\.json$ From 945b0837ce3bf902723f6d2b373d328fbfb8ac9f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 21 Jan 2024 09:48:26 +0000 Subject: [PATCH 14/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 72cb54ec6a73141e4dc5f8dad4fb5bffde84becd Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jan 2024 09:10:06 +0000 Subject: [PATCH 15/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 4299cf907618d1ca3956e095922f6c603ea96328 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 21 Jun 2024 15:18:06 -0400 Subject: [PATCH 16/31] Fix build with rpm 4.20 rpm 4.20 now uses a build-specific %_builddir (previously %_topdir/BUILD), but this directory change occurs by default even in older versions. https://github.com/rpm-software-management/rpm/issues/2078 --- nodejs-packaging.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 2553949..9c77106 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -52,10 +52,8 @@ It generates a bundled license file that gets the licenses in the runtime dependency tarball %prep -pushd %{_topdir}/BUILD cp -da %{_sourcedir}/* . tar xvf test.tar.gz -popd %build From d504fbf5e59a37a17bdb843583dcff4a370970b5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 18 Jul 2024 19:38:12 +0000 Subject: [PATCH 17/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 792f09d75da1839a964765763cf8755b1dd20e70 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jan 2025 20:15:35 +0000 Subject: [PATCH 18/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 15aac7eeb8a36e8b656b612ecbce38aa14da5617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Tue, 25 Feb 2025 12:00:58 +0100 Subject: [PATCH 19/31] Use %autochangelog macro Fixup: 5c3231171a8e419aecf396a870d04ac73022d2f1 --- nodejs-packaging.spec | 171 +----------------------------------------- 1 file changed, 1 insertion(+), 170 deletions(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 9c77106..2553f5b 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -90,173 +90,4 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog -* Thu Jan 19 2023 Fedora Release Engineering - 2022.10-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Thu Oct 20 2022 Stephen Gallagher - 2022.10-1 -- Move native module building tools here from Node.js -- Add `Requires: /usr/bin/node` - -* Tue Oct 18 2022 Davide Cavalca - 2021.06-7 -- NPM bundler: recursively bundle modules for all packages found - -* Fri Jul 22 2022 Fedora Release Engineering - 2021.06-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Sun May 01 2022 Davide Cavalca - 2021.06-5 -- NPM bundler: optionally use a local tarball instead of npm - -* Thu Jan 20 2022 Stephen Gallagher - 2021.06-4 -- NPM bundler: also find namespaced bundled dependencies - -* Thu Jul 22 2021 Fedora Release Engineering - 2021.06-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Tue Jun 22 2021 Stephen Gallagher - 2021.06-2 -- Fix hard-coded output directory in the bundler - -* Wed Jun 02 2021 Stephen Gallagher - 2021.06-1 -- Update to 2021.06-1 -- bundler: Handle archaic license metadata -- bundler: Warn about bundled dependencies with no license metadata - -* Tue Jan 26 2021 Fedora Release Engineering - 2021.01-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Wed Jan 20 2021 Stephen Gallagher - 2021.01-2 -- nodejs-packaging-bundler improvements to handle uncommon characters - -* Wed Jan 06 2021 Troy Dawson - 2021.01 -- Add nodejs-packaging-bundler and update README.md - -* Fri Sep 18 2020 Stephen Gallagher - 2020.09-1 -- Move to dist-git as the upstream - -* Wed Sep 02 2020 Stephen Gallagher - 25-1 -- Fix incorrect bundled library detection for Requires - -* Tue Sep 01 2020 Stephen Gallagher - 24-1 -- Check node_modules_prod for bundled dependencies - -* Tue Jul 28 2020 Fedora Release Engineering - 23-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Wed Jun 03 2020 Stephen Gallagher - 23-3 -- Drop Requires: nodejs(engine) - -* Wed Jan 29 2020 Fedora Release Engineering - 23-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Thu Oct 31 2019 Tom Hughes - 23-1 -- Ensure nodejs(engine) is required for packages with no dependencies - -* Thu Jul 25 2019 Fedora Release Engineering - 22-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Tue Jul 2 2019 Tom Hughes - 22-1 -- Refactor nodejs.req in more idiomatic Python -- Treat only external dependency links as un-bundled - -* Mon Jun 10 2019 Tom Hughes - 21-1 -- Refactor nodejs.prov in more idiomatic Python - -* Fri Feb 01 2019 Fedora Release Engineering - 20-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Sat Jan 5 2019 Tom Hughes - 20-1 -- Fix handling of ^ dependencies for multiversion modules - -* Thu Jan 3 2019 Tom Hughes - 18-1 -- Handle =, >= and <= dependencies for multiversion modules - -* Fri Jul 13 2018 Fedora Release Engineering - 17-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Thu May 3 2018 Tom Hughes - 17-1 -- Fix version comparators with a space after the operator - -* Tue May 1 2018 Tom Hughes - 16-1 -- Rewrite nodejs.req to better match npm versioning rules -- Add tests for nodejs.req and nodejs.prov - -* Mon Apr 30 2018 Tom Hughes - 15-1 -- Fix caret dependency ranges - -* Thu Apr 12 2018 Tom Hughes - 14-1 -- Only match top level modules for requires and provides generation - -* Wed Feb 28 2018 Tom Hughes - 13-1 -- Add %%nodejs_setversion macro - -* Fri Feb 23 2018 Tom Hughes - 12-1 -- Port to python 3 - -* Thu Feb 08 2018 Fedora Release Engineering - 11-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Sat Jan 13 2018 Tom Hughes - 11-1 -- nodesjs.req: use boolean with for range dependencies - -* Tue Sep 12 2017 Stephen Gallagher - 10-1 -- Release v10 -- Automatically generate Provides for bundled npm dependencies - -* Thu Jul 27 2017 Fedora Release Engineering - 9-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Tue Feb 21 2017 Tom Hughes - 9-3 -- switch source URL to pagure - -* Fri Feb 10 2017 Fedora Release Engineering - 9-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Tue Feb 2 2016 Tom Hughes - 9-1 -- nodejs-fixdep: stop --move erroring on missing dependency types - -* Sun Jan 31 2016 Tom Hughes - 8-1 -- nodejs-fixdep: add --move option -- nodejs-symlink-deps: add --optional option -- req: generate suggests for optional dependencies - -* Mon Nov 16 2015 Tom Hughes - 7-5 -- nodejs-symlink-deps: handle caret in versions - -* Wed Jun 17 2015 Fedora Release Engineering - 7-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - -* Wed Mar 4 2015 Ville Skyttä - 7-3 -- Install macros in %%{_rpmconfidir}/macros.d where available (#1074279) - -* Sat Jun 07 2014 Fedora Release Engineering - 7-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - -* Sun May 25 2014 T.C. Hollingsworth - 7-1 -- nodejs-symlink-deps: fix regression preventing multiply versioned modules from - being symlinked correctly - -* Sat May 24 2014 T.C. Hollingsworth - 6-1 -- nodejs-fixdep: use real option parsing -- nodejs-fixdep: support modifying optionalDependencies and devDependencies -- req: support the caret operator -- nodejs-symlink-deps: add --force option -- nodejs-symlink-deps: add --build alias for --check -- nodejs-fixdep: support converting to caret dependencies -- nodejs-fixdep: support non-dictionary dependency properties -- multiver_modules: add nan - -* Mon Jul 29 2013 T.C. Hollingsworth - 4-1 -- handle cases where the symlink target exists gracefully - -* Wed Jul 10 2013 T.C. Hollingsworth - 3-1 -- dependencies and engines can be lists or strings too -- handle unversioned dependencies on multiply versioned modules correctly - (RHBZ#982798) -- restrict to compatible arches - -* Fri Jun 21 2013 T.C. Hollingsworth - 2-1 -- move multiple version list to /usr/share/node -- bump nodejs Requires to 0.10.12 -- add Requires: redhat-rpm-config - -* Thu Jun 13 2013 T.C. Hollingsworth - 1-1 -- initial package +%autochangelog From bbd74d8e40a12abad3ee4b46ad4ba0a52df4debf Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 22:53:57 +0000 Subject: [PATCH 20/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 64a93f15aacb23ad22dfc8496eb7fe91b95c21db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Wed, 20 Aug 2025 13:53:21 +0200 Subject: [PATCH 21/31] Move nodejs_abi generator to the various streams The generator assumed there is only one /usr/bin/node available in the distro. Additionally, there were no generators presents for the alternative streams. This removes the generator from here; a variant of it is being added to each of the existing nodejs streams, adjusted to work with that stream specifically. Resolves: rhbz#2389160 --- nodejs-packaging.spec | 7 ------- nodejs_abi.attr | 2 -- nodejs_abi.req | 8 -------- 3 files changed, 17 deletions(-) delete mode 100644 nodejs_abi.attr delete mode 100755 nodejs_abi.req diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 2553f5b..2a280db 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -19,8 +19,6 @@ Source0007: nodejs-symlink-deps Source0008: nodejs.attr Source0009: nodejs.prov Source0010: nodejs.req -Source0011: nodejs_abi.attr -Source0012: nodejs_abi.req Source0111: nodejs-packaging-bundler @@ -29,9 +27,6 @@ Source0101: test.tar.gz BuildRequires: python3 -# Several of the macros require the /usr/bin/node command, so we need to -# ensure that it is present when packaging. -Requires: /usr/bin/node Requires: redhat-rpm-config %description @@ -63,10 +58,8 @@ tar xvf test.tar.gz %install install -Dpm0644 macros.nodejs %{buildroot}%{macrosdir}/macros.nodejs install -Dpm0644 nodejs.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs.attr -install -Dpm0644 nodejs_abi.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_abi.attr install -pm0755 nodejs.prov %{buildroot}%{_rpmconfigdir}/nodejs.prov install -pm0755 nodejs.req %{buildroot}%{_rpmconfigdir}/nodejs.req -install -pm0755 nodejs_abi.req %{buildroot}%{_rpmconfigdir}/nodejs_abi.req install -pm0755 nodejs-symlink-deps %{buildroot}%{_rpmconfigdir}/nodejs-symlink-deps install -pm0755 nodejs-fixdep %{buildroot}%{_rpmconfigdir}/nodejs-fixdep install -pm0755 nodejs-setversion %{buildroot}%{_rpmconfigdir}/nodejs-setversion diff --git a/nodejs_abi.attr b/nodejs_abi.attr deleted file mode 100644 index d161239..0000000 --- a/nodejs_abi.attr +++ /dev/null @@ -1,2 +0,0 @@ -%__nodejs_native_requires %{_rpmconfigdir}/nodejs_abi.req -%__nodejs_native_path ^/usr/lib.*/node_modules/.*\\.node$ diff --git a/nodejs_abi.req b/nodejs_abi.req deleted file mode 100755 index a33a7b5..0000000 --- a/nodejs_abi.req +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Get the ABI version -abi_version=$(/usr/bin/node -p process.versions.modules) - -# Write out the Virtual Requires -echo "nodejs(abi) = ${abi_version}" - From 36224631ac041f4df2a04745bf3b4ec98b84609b Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 27 Jun 2025 13:03:00 +0200 Subject: [PATCH 22/31] Correctly determine if a package has bundled dependencies I have a package that's as follows: # tree /usr/lib/node_modules/history /usr/lib/node_modules/history |-- DOMUtils.js |-- LocationUtils.js |-- PathUtils.js |-- createBrowserHistory.js |-- createHashHistory.js |-- createMemoryHistory.js |-- createTransitionManager.js |-- es | |-- DOMUtils.js | |-- LocationUtils.js | |-- PathUtils.js | |-- createBrowserHistory.js | |-- createHashHistory.js | |-- createMemoryHistory.js | |-- createTransitionManager.js | `-- index.js |-- index.js |-- node_modules | |-- invariant -> /usr/lib/node_modules/invariant | |-- loose-envify -> /usr/lib/node_modules/loose-envify | |-- resolve-pathname -> /usr/lib/node_modules/resolve-pathname | |-- value-equal -> /usr/lib/node_modules/value-equal | `-- warning -> /usr/lib/node_modules/warning |-- package.json `-- umd |-- history.js `-- history.min.js The node_modules directory was created by the %nodejs_symlink_deps macro. Then when using nodejs.req I don't get any dependencies: # echo /usr/lib/node_modules/history/package.json | /usr/lib/rpm/nodejs.req It looks like has_only_bundled_dependencies returns true, while it shouldn't. Critically, it runs this code: bundled_dependency_iter = ( os.path.realpath(path) for path in dependency_path_iter if not os.path.islink(path) or path.startswith(module_root_path) ) Here dependency_path_iter is: [ '/usr/lib/node_modules/history/node_modules/invariant', '/usr/lib/node_modules/history/node_modules/loose-envify', '/usr/lib/node_modules/history/node_modules/resolve-pathname', '/usr/lib/node_modules/history/node_modules/value-equal', '/usr/lib/node_modules/history/node_modules/warning' ] And module_root_path is /usr/lib/node_modules/history. We can conclude that path.startswith(module_root_path) will always be true, because we started with iterating over files under module_root_path. The code suggests it should have looked up the real path instead. If we make that change, it correctly generates the dependencies. --- nodejs.req | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodejs.req b/nodejs.req index 129606b..c89a3f7 100755 --- a/nodejs.req +++ b/nodejs.req @@ -633,9 +633,9 @@ def has_only_bundled_dependencies(module_dir_path): for basename in os.listdir(dependency_root_path) ) bundled_dependency_iter = ( - os.path.realpath(path) + path for path in dependency_path_iter - if not os.path.islink(path) or path.startswith(module_root_path) + if not os.path.islink(path) or os.path.realpath(path).startswith(module_root_path) ) return any(bundled_dependency_iter) From cd097f083d7c185e1f138752169464926eeab2b2 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Mon, 1 Sep 2025 08:24:15 +0000 Subject: [PATCH 23/31] Properly handle @group/package deps in nodejs-symlink-deps Node packages can have dependencies of the for "@group/package" instead of just "package". Calling symlink() (and thus os.symlink()) in such a case fails when there is no "@group" directory yet. ``` + /usr/lib/rpm/nodejs-symlink-deps /usr/lib/node_modules ERROR: the path for dependency "@babel/runtime" already exists This could mean that bundled modules are being installed. Bundled libraries are forbidden in Fedora. For more information, see: It is generally reccomended to remove the entire "node_modules" directory in %prep when it exists. For more information, see: If you have obtained permission from the Fedora Packaging Committee to bundle libraries, please use `%nodejs_fixdep -r` in %prep to remove the dependency on the bundled module. This will prevent an unnecessary dependency on the system version of the module and eliminate this error. error: Bad exit status from /var/tmp/rpm-tmp.nn3mkP (%install) ``` The reported error is misleading - the path does not exist yet, but it also can't be created. os.symlink throws OSError in both cases. The patch prevents the issue by calling os.makedirs on the group-part of the dependency if there is one. --- nodejs-symlink-deps | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nodejs-symlink-deps b/nodejs-symlink-deps index b5e44b3..ba525eb 100755 --- a/nodejs-symlink-deps +++ b/nodejs-symlink-deps @@ -30,6 +30,8 @@ import shutil import sys def symlink(source, dest): + if os.path.sep in dest: + os.makedirs(os.path.dirname(dest), exist_ok=True) try: os.symlink(source, dest) except OSError: From 4e33741bc94513a7717e1c3f0e9c0c91dca0c82b Mon Sep 17 00:00:00 2001 From: tjuhasz Date: Thu, 23 Oct 2025 12:58:35 +0200 Subject: [PATCH 24/31] Change %{nodejs_sitelib} to nonversion/shared path (rhbz#2404685) --- macros.nodejs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/macros.nodejs b/macros.nodejs index 94eae4b..4f14187 100644 --- a/macros.nodejs +++ b/macros.nodejs @@ -1,12 +1,8 @@ # nodejs binary %__nodejs %{_bindir}/node -# currently installed nodejs version -%nodejs_version %(%{__nodejs} -v | sed s/v//) -%_nodejs_major_version %(echo %{nodejs_version} | sed 's#^\\([0-9]\\+\\).*#\\1#') - # nodejs library directory -%nodejs_sitelib %{_prefix}/lib/node_modules_%{_nodejs_major_version} +%nodejs_sitelib %{_prefix}/lib/node_modules #arch specific library directory #for future-proofing only; we don't do multilib From aac86e36466f852be584d553027f907adfb0ec4f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 16 Jan 2026 22:12:26 +0000 Subject: [PATCH 25/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild From fdd68fbe2d0d49be7b3e7ef82f5449bf0665131e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 5 Sep 2024 15:49:43 +0100 Subject: [PATCH 26/31] Fix indentation mistakes in nodejs-packaging-bundler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- nodejs-packaging-bundler | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index 943368a..6c4d368 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -70,10 +70,10 @@ for packagejson in $(find . -type d -name node_modules\* -prune -o -type f -name npm install --omit=dev --omit=optional if [ $? -ge 1 ] ; then echo " ERROR WILL ROBINSON" - rm -rf node_modules + rm -rf node_modules else echo " Successful prod dependencies download" - mv node_modules/ node_modules_prod + mv node_modules/ node_modules_prod fi popd done @@ -102,7 +102,7 @@ for packagejson in $(find . -type d -name node_modules\* -prune -o -type f -name echo " ERROR WILL ROBINSON" else echo " Successful dev dependencies download" - mv node_modules/ node_modules_dev + mv node_modules/ node_modules_dev fi popd done From 0a0c95bab746e3c90611f72c5799d73e1feef6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 5 Sep 2024 11:56:49 +0100 Subject: [PATCH 27/31] Use --sort=name when creating tarballs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using --sort=name ensures that files are added to the tarball in a predictable ordering. This should result in a consistent checksum for the tarball and thus facilitate reproducibility for auditing purposes. Signed-off-by: Daniel P. Berrangé --- nodejs-packaging-bundler | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index 6c4d368..7044e69 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -107,10 +107,10 @@ for packagejson in $(find . -type d -name node_modules\* -prune -o -type f -name popd done if [ -d node_modules_prod ] ; then - tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-prod.tgz $(find . -type d -name node_modules_prod) + tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-prod.tgz --sort=name $(find . -type d -name node_modules_prod) fi if [ -d node_modules_dev ] ; then - tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-dev.tgz $(find . -type d -name node_modules_dev) + tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-dev.tgz --sort=name $(find . -type d -name node_modules_dev) fi cd .. cp -v ${PACKAGE_SAFE}-${VERSION}* "${OUTPUT_DIR}" From b786cecdf9c56069a122b09eeba373fa74e3a8fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 4 Sep 2024 18:59:03 +0100 Subject: [PATCH 28/31] Honour package version when no tarball is given MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- nodejs-packaging-bundler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index 7044e69..47486a4 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -60,7 +60,7 @@ if [ -f "$TARBALL" ]; then mv ${TARBALL_DIR}/*.tgz . rm -rf ${TARBALL_DIR} else - npm pack ${PACKAGE} + npm pack ${PACKAGE}@${VERSION} fi tar xfz *.tgz cd package From 8c93ed16060c9a3ce9feea73555a7ede76ceacca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 3 Feb 2026 16:43:30 +0000 Subject: [PATCH 29/31] Always report the nodejs engine dep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "has only bundled deps" check was short-circuiting logic too early, causing the "nodejs(engine) == " dep to be missed, which is still relevant even when bundling. Signed-off-by: Daniel P. Berrangé --- nodejs.req | 6 +++--- test/bundled/nodejs.req.out.exp | 2 +- test/bundled_namespace/nodejs.req.out.exp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nodejs.req b/nodejs.req index c89a3f7..47e94aa 100755 --- a/nodejs.req +++ b/nodejs.req @@ -659,9 +659,6 @@ def extract_dependencies(metadata_path, optional=False): TypeError: Invalid dependency data type. """ - if has_only_bundled_dependencies(os.path.dirname(metadata_path)): - return # skip - # Read metadata try: with open(metadata_path, mode="r") as metadata_file: @@ -676,6 +673,9 @@ def extract_dependencies(metadata_path, optional=False): except KeyError: # NodeJS engine version unspecified yield rpm_format("nodejs(engine)") + if has_only_bundled_dependencies(os.path.dirname(metadata_path)): + return # skip + # Report listed dependencies kind = "optionalDependencies" if optional else "dependencies" container = metadata.get(kind, {}) diff --git a/test/bundled/nodejs.req.out.exp b/test/bundled/nodejs.req.out.exp index 8b13789..64d8bb4 100644 --- a/test/bundled/nodejs.req.out.exp +++ b/test/bundled/nodejs.req.out.exp @@ -1 +1 @@ - +(nodejs(engine) >= 6 with nodejs(engine) < 10) diff --git a/test/bundled_namespace/nodejs.req.out.exp b/test/bundled_namespace/nodejs.req.out.exp index 8b13789..64d8bb4 100644 --- a/test/bundled_namespace/nodejs.req.out.exp +++ b/test/bundled_namespace/nodejs.req.out.exp @@ -1 +1 @@ - +(nodejs(engine) >= 6 with nodejs(engine) < 10) From d5492bc3059008b8b05e3221ee0fd2e16345ff95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Wed, 4 Feb 2026 14:42:48 +0100 Subject: [PATCH 30/31] Update tests from git --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index 52e9e27..a7170f1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (test.tar.gz) = dfbda67b8741f1ca36bf63b2e842f81ba07381b3d92e75fa7e29f8e456543b4cae55e95785902f31a14ae4d0b7e89161ba04c0c10c2fff617b4ae9607c91e599 +SHA512 (test.tar.gz) = 04c1e741caa124c12b1070b6411d1a9fef9b328e15ec274170b7dcd9d26d9a6f9db21d6722ce0b39d0b693f237398065dd127b95a9a6e4947e182db2e3fad6f2 From 769c465c78027de1ebda66f070d37a5b0e857f8a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jul 2026 09:39:21 +0000 Subject: [PATCH 31/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild