From 79a61a71ff426ee050bca355ae9d75a1f5cb077f Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 12 Sep 2017 08:59:41 -0400 Subject: [PATCH 01/72] Release v10 Automatically generate Provides for bundled npm dependencies Signed-off-by: Stephen Gallagher --- .gitignore | 1 + nodejs-packaging.spec | 8 ++++++-- sources | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ec21f42..e4d8e4e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /nodejs-packaging-fedora-7.tar.xz /nodejs-packaging-fedora-8.tar.xz /nodejs-packaging-fedora-9.tar.xz +/nodejs-packaging-fedora-10.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 42db633..fcc6884 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: 9 -Release: 4%{?dist} +Version: 10 +Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -46,6 +46,10 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 8ef8ee2..f7d44dc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-9.tar.xz) = 9a989c17f691761899af0186b788cc952bee61ce0a27254fa413ad5c636aaa9916243effde3399fe21794937509dbd2952e2d94797f855dc3c4c1ee7deb05aec +SHA512 (nodejs-packaging-fedora-10.tar.xz) = 73b3ae20cd9e808fb3613afdcf020689a47d9699cd7bf4f2a6d0a55ad5f3e05921fd0c535e21c4fa237dffac332daa0118f87ae1b70cd1d166f9e71bb3eb4c91 From d0b93300e41fa39b76c7e8c6b1e95e8936c005e3 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 13 Jan 2018 00:23:08 +0000 Subject: [PATCH 02/72] nodejs-packaging-11 - nodesjs.req: use boolean with for range dependencies --- .gitignore | 1 + nodejs-packaging.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e4d8e4e..d28d26c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /nodejs-packaging-fedora-8.tar.xz /nodejs-packaging-fedora-9.tar.xz /nodejs-packaging-fedora-10.tar.xz +/nodejs-packaging-fedora-11.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index fcc6884..1d594e7 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: 10 +Version: 11 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch @@ -46,6 +46,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index f7d44dc..6e84af2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-10.tar.xz) = 73b3ae20cd9e808fb3613afdcf020689a47d9699cd7bf4f2a6d0a55ad5f3e05921fd0c535e21c4fa237dffac332daa0118f87ae1b70cd1d166f9e71bb3eb4c91 +SHA512 (nodejs-packaging-fedora-11.tar.xz) = 07a2c4a4bba89d747fe6ade8a7516b5e28c66a082195ba063046810c90810d02f0872e06634522cbd91fe38f7ac155e3cef360b54afe1ae27a78fda2ffa4769c From e35ac626e9ef20d89aac10f1672cd7f12d921cfb Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 8 Feb 2018 06:56:45 +0000 Subject: [PATCH 03/72] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_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 1d594e7..d7620c3 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 11 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -46,6 +46,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 From b023303eb2349d7cf94d139e8e2f71b884cbd5db Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 23 Feb 2018 22:22:08 +0000 Subject: [PATCH 04/72] Port to python 3 --- .gitignore | 1 + nodejs-packaging.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d28d26c..a94c4d0 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /nodejs-packaging-fedora-9.tar.xz /nodejs-packaging-fedora-10.tar.xz /nodejs-packaging-fedora-11.tar.xz +/nodejs-packaging-fedora-12.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index d7620c3..b8b87e7 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: 11 -Release: 2%{?dist} +Version: 12 +Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -46,6 +46,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 6e84af2..b3259c2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-11.tar.xz) = 07a2c4a4bba89d747fe6ade8a7516b5e28c66a082195ba063046810c90810d02f0872e06634522cbd91fe38f7ac155e3cef360b54afe1ae27a78fda2ffa4769c +SHA512 (nodejs-packaging-fedora-12.tar.xz) = c333137e50ea463dffcfa172efbe4dd152b27eb8b807a356a7af25ba9afae8be99f934cb2cd250ad29491af3c6d88309ed1ae1e7282b5c4b22be2c1dba09bcaa From 1f15ed794312601956c1ea13aa99f1f494154be8 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 28 Feb 2018 11:29:43 +0000 Subject: [PATCH 05/72] Add %nodejs_setversion macro --- .gitignore | 1 + nodejs-packaging.spec | 6 +++++- sources | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a94c4d0..2c1f545 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /nodejs-packaging-fedora-10.tar.xz /nodejs-packaging-fedora-11.tar.xz /nodejs-packaging-fedora-12.tar.xz +/nodejs-packaging-fedora-13.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index b8b87e7..5bf678c 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: 12 +Version: 13 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch @@ -34,6 +34,7 @@ install -pm0755 nodejs.prov %{buildroot}%{_rpmconfigdir}/nodejs.prov install -pm0755 nodejs.req %{buildroot}%{_rpmconfigdir}/nodejs.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 install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules @@ -46,6 +47,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* Wed Feb 28 2018 Tom Hughes - 13-1 +- Add %%nodejs_setversion macro + * Fri Feb 23 2018 Tom Hughes - 12-1 - Port to python 3 diff --git a/sources b/sources index b3259c2..45bc897 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-12.tar.xz) = c333137e50ea463dffcfa172efbe4dd152b27eb8b807a356a7af25ba9afae8be99f934cb2cd250ad29491af3c6d88309ed1ae1e7282b5c4b22be2c1dba09bcaa +SHA512 (nodejs-packaging-fedora-13.tar.xz) = 0d20be3e8d7c30f545d60c1e8d59372e244ed75c2de93cf80ae095bda3b0ab2a0c2651c7eb51e2f1a71571801a572e4aa00c282f1729c47e56ca8fb1222cfd8c From 0f8a055f945913d7979d7453b687360845a45f4d Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 12 Apr 2018 14:01:03 +0100 Subject: [PATCH 06/72] Only match top level modules for requires and provides generation --- .gitignore | 1 + nodejs-packaging.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2c1f545..61e2b06 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /nodejs-packaging-fedora-11.tar.xz /nodejs-packaging-fedora-12.tar.xz /nodejs-packaging-fedora-13.tar.xz +/nodejs-packaging-fedora-14.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 5bf678c..48cdb57 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: 13 +Version: 14 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch @@ -47,6 +47,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 45bc897..7e8ba74 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-13.tar.xz) = 0d20be3e8d7c30f545d60c1e8d59372e244ed75c2de93cf80ae095bda3b0ab2a0c2651c7eb51e2f1a71571801a572e4aa00c282f1729c47e56ca8fb1222cfd8c +SHA512 (nodejs-packaging-fedora-14.tar.xz) = 0890e5aa5a2f6d7ef9b558ba68c4b6379417796365fb2df5912ed21aea10fa10587c34f9241daae14a53bd9da4a5f188933ed2c0b655f4101f1fc222c9ff2677 From 9ab0cce29a2e55e1023ae3df7a81dd7221365c4e Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 30 Apr 2018 20:44:41 +0100 Subject: [PATCH 07/72] Fix caret dependency ranges --- .gitignore | 1 + nodejs-packaging.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 61e2b06..3288be1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /nodejs-packaging-fedora-12.tar.xz /nodejs-packaging-fedora-13.tar.xz /nodejs-packaging-fedora-14.tar.xz +/nodejs-packaging-fedora-15.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 48cdb57..9442dd7 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: 14 +Version: 15 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch @@ -47,6 +47,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 7e8ba74..c780eb3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-14.tar.xz) = 0890e5aa5a2f6d7ef9b558ba68c4b6379417796365fb2df5912ed21aea10fa10587c34f9241daae14a53bd9da4a5f188933ed2c0b655f4101f1fc222c9ff2677 +SHA512 (nodejs-packaging-fedora-15.tar.xz) = c8d7876b75fdb44d3d2152f4e1a7116a8bd1f3633b12a70015b201efdc99daec8f122f173278a21b6f851e932879dda6c3a1b9c03a2a810f102ae5d0e0b58e78 From 7428d76bde5e5b3088382eb8cc0357512d48b1e6 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 2 May 2018 00:47:38 +0100 Subject: [PATCH 08/72] Rewrite nodejs.req to better match npm versioning rules --- .gitignore | 1 + nodejs-packaging.spec | 10 +++++++++- sources | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3288be1..072f470 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ /nodejs-packaging-fedora-13.tar.xz /nodejs-packaging-fedora-14.tar.xz /nodejs-packaging-fedora-15.tar.xz +/nodejs-packaging-fedora-16.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 9442dd7..d24cdc3 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: 15 +Version: 16 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch @@ -38,6 +38,10 @@ install -pm0755 nodejs-setversion %{buildroot}%{_rpmconfigdir}/nodejs-setversion install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules +%check +./test/run + + %files %license LICENSE %{macrosdir}/macros.nodejs @@ -47,6 +51,10 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index c780eb3..78cde86 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-15.tar.xz) = c8d7876b75fdb44d3d2152f4e1a7116a8bd1f3633b12a70015b201efdc99daec8f122f173278a21b6f851e932879dda6c3a1b9c03a2a810f102ae5d0e0b58e78 +SHA512 (nodejs-packaging-fedora-16.tar.xz) = 2805db488fc5eb9353d7a7812577c0f12bae370d01c2a6aa18f2c65dce1f4b9f82b0be0189df781f758cf5094f9ed4ed77ed49e989500421e1c053758be0fdaa From 9983689c06faaedb6e37ad9570d777b83b053919 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 2 May 2018 01:01:02 +0100 Subject: [PATCH 09/72] Add BR for python3 --- nodejs-packaging.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index d24cdc3..89334c9 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -10,6 +10,8 @@ URL: https://fedoraproject.org/wiki/Node.js/Packagers Source0: https://releases.pagure.org/%{name}/%{name}-fedora-%{version}.tar.xz ExclusiveArch: %{nodejs_arches} noarch +BuildRequires: python3 + #nodejs-devel before 0.10.12 provided these macros and owned /usr/share/node Requires: nodejs(engine) >= 0.10.12 Requires: redhat-rpm-config From 682ccaa77386e2a2e18420d04fa9d7343548440a Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 3 May 2018 08:51:04 +0100 Subject: [PATCH 10/72] Fix version comparators with a space after the operator --- .gitignore | 1 + nodejs-packaging.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 072f470..f69a8f6 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ /nodejs-packaging-fedora-14.tar.xz /nodejs-packaging-fedora-15.tar.xz /nodejs-packaging-fedora-16.tar.xz +/nodejs-packaging-fedora-17.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 89334c9..d79aeab 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: 16 +Version: 17 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch @@ -53,6 +53,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 78cde86..d71f42c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-16.tar.xz) = 2805db488fc5eb9353d7a7812577c0f12bae370d01c2a6aa18f2c65dce1f4b9f82b0be0189df781f758cf5094f9ed4ed77ed49e989500421e1c053758be0fdaa +SHA512 (nodejs-packaging-fedora-17.tar.xz) = ed87ddb2bbaaabcc8842d875e3f2453809becdde231f961d6a369ab1ef85b192b72271697952c69fe5e55d3516a5e73dc52a938d3525c5957c0f5ea2a7e0ddc4 From fefb4a0eae9bad52394fec84cdfc20f4bcb91ca6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 13 Jul 2018 13:29:19 +0000 Subject: [PATCH 11/72] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_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 d79aeab..9591b69 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 17 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -53,6 +53,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 From d4c27e1ef4ea8ea695c886c6b56043f3034eed07 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 3 Jan 2019 17:23:45 +0000 Subject: [PATCH 12/72] Handle =, >= and <= dependencies for multiversion modules --- .gitignore | 1 + nodejs-packaging.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index f69a8f6..6160566 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /nodejs-packaging-fedora-15.tar.xz /nodejs-packaging-fedora-16.tar.xz /nodejs-packaging-fedora-17.tar.xz +/nodejs-packaging-fedora-18.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 9591b69..1b09851 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: 17 -Release: 2%{?dist} +Version: 18 +Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -53,6 +53,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index d71f42c..33b9f8d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-17.tar.xz) = ed87ddb2bbaaabcc8842d875e3f2453809becdde231f961d6a369ab1ef85b192b72271697952c69fe5e55d3516a5e73dc52a938d3525c5957c0f5ea2a7e0ddc4 +SHA512 (nodejs-packaging-fedora-18.tar.xz) = c9af286d2241711ce10aae3f5d508db030e7e5befb989ae602f1c1cf8bcb4bb06c7b64e9e3f22189725260757af7354dbdd00fd11ca4e516ba69d8f80957916e From 3b498424086518071c734292aaa8a3e6088a3715 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 5 Jan 2019 12:24:53 +0000 Subject: [PATCH 13/72] Fix handling of ^ dependencies for multiversion modules --- .gitignore | 2 ++ nodejs-packaging.spec | 5 ++++- sources | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6160566..d527298 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ /nodejs-packaging-fedora-16.tar.xz /nodejs-packaging-fedora-17.tar.xz /nodejs-packaging-fedora-18.tar.xz +/nodejs-packaging-fedora-19.tar.xz +/nodejs-packaging-fedora-20.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 1b09851..5cfc618 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: 18 +Version: 20 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch @@ -53,6 +53,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 33b9f8d..8125735 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-18.tar.xz) = c9af286d2241711ce10aae3f5d508db030e7e5befb989ae602f1c1cf8bcb4bb06c7b64e9e3f22189725260757af7354dbdd00fd11ca4e516ba69d8f80957916e +SHA512 (nodejs-packaging-fedora-20.tar.xz) = e740971cae64f1b82a2936bedd0d90ed3ce09dad9780d0076fc702d8ef75eb160917370fa1c0eb403e51639bcb8e85d47d186fa9433cc9194a27426d637d9387 From 82f548aa2597510aba78bb84931fac31a1768bb6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 1 Feb 2019 15:00:05 +0000 Subject: [PATCH 14/72] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_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 5cfc618..97b9f3e 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 20 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -53,6 +53,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 From 0af8638afde75c10a04127b2b7bea8564a052627 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 10 Jun 2019 15:31:39 +0100 Subject: [PATCH 15/72] Refactor nodejs.prov in more idiomatic Python --- .gitignore | 1 + nodejs-packaging.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d527298..933402d 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ /nodejs-packaging-fedora-18.tar.xz /nodejs-packaging-fedora-19.tar.xz /nodejs-packaging-fedora-20.tar.xz +/nodejs-packaging-fedora-21.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 97b9f3e..c223da3 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: 20 -Release: 2%{?dist} +Version: 21 +Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -53,6 +53,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 8125735..0ecca11 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-20.tar.xz) = e740971cae64f1b82a2936bedd0d90ed3ce09dad9780d0076fc702d8ef75eb160917370fa1c0eb403e51639bcb8e85d47d186fa9433cc9194a27426d637d9387 +SHA512 (nodejs-packaging-fedora-21.tar.xz) = 23e9b9e35d3f6c148aca76129c73fd040990e4317e086bff29aa248b98174309e69ce7ea42d9c9ef70dc410f8721727ac7546dea2116b9d9c91b94f215b2637d From 9875fea47c181b8240cca8a36156e5b4626d9a13 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 2 Jul 2019 18:14:32 +0100 Subject: [PATCH 16/72] Refactor nodejs.req in more idiomatic Python Also treat only external dependency links as un-bundled. --- .gitignore | 1 + nodejs-packaging.spec | 6 +++++- sources | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 933402d..7ee106a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ /nodejs-packaging-fedora-19.tar.xz /nodejs-packaging-fedora-20.tar.xz /nodejs-packaging-fedora-21.tar.xz +/nodejs-packaging-fedora-22.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index c223da3..b24618c 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: 21 +Version: 22 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch @@ -53,6 +53,10 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 0ecca11..8069d53 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-21.tar.xz) = 23e9b9e35d3f6c148aca76129c73fd040990e4317e086bff29aa248b98174309e69ce7ea42d9c9ef70dc410f8721727ac7546dea2116b9d9c91b94f215b2637d +SHA512 (nodejs-packaging-fedora-22.tar.xz) = c4760b591c68bbea349e963272d26e1436389cf65a0dc81c5148ad02e0e8c3c375e91767c64ea7249ec2a303eac883e8c9ceb4587151365226a93bf0817bf55e From 47235c6094bbb8f6b595aaec8bc8793b61c17fbf Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jul 2019 21:14:55 +0000 Subject: [PATCH 17/72] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_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 b24618c..9255a7d 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 22 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -53,6 +53,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 From f3e8a0485d4f68cf6fee47f36c2915e2616a5b76 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 31 Oct 2019 10:04:50 +0000 Subject: [PATCH 18/72] Ensure nodejs(engine) is required for packages with no dependencies --- .gitignore | 1 + nodejs-packaging.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7ee106a..24cd277 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ /nodejs-packaging-fedora-20.tar.xz /nodejs-packaging-fedora-21.tar.xz /nodejs-packaging-fedora-22.tar.xz +/nodejs-packaging-fedora-23.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 9255a7d..5465a71 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: 22 -Release: 2%{?dist} +Version: 23 +Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -53,6 +53,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 8069d53..6fa90fe 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-22.tar.xz) = c4760b591c68bbea349e963272d26e1436389cf65a0dc81c5148ad02e0e8c3c375e91767c64ea7249ec2a303eac883e8c9ceb4587151365226a93bf0817bf55e +SHA512 (nodejs-packaging-fedora-23.tar.xz) = 9a49c6a4d59a80d757f4e556b6bcdf771d6a3a037a28b00f31eaefc737c85add130cd7e2281ff0f423ee87bcfa0d8cb34a400f0c5678f9af031911c4d80084c4 From 06eeb0e6994355bec1b882666ff50540ad2ee1c6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jan 2020 17:45:01 +0000 Subject: [PATCH 19/72] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_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 5465a71..0fff29f 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 23 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -53,6 +53,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 From 021f0badabbe076a6e869e2ebdedfbcb7c2e1ea8 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 3 Jun 2020 09:25:32 -0400 Subject: [PATCH 20/72] Drop `Requires: nodejs(engine)` This is no longer needed (Fedora and EPEL are both well past 0.10 at this point). It was also incorrect to begin with. It should have been `Conflicts: nodejs(engine) < 0.10.13` since it was only intended to force the upgrade if it was currently installed, not to force nodejs itself to be brought in. Signed-off-by: Stephen Gallagher --- nodejs-packaging.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 0fff29f..858d4d1 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 23 -Release: 2%{?dist} +Release: 3%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -12,8 +12,6 @@ ExclusiveArch: %{nodejs_arches} noarch BuildRequires: python3 -#nodejs-devel before 0.10.12 provided these macros and owned /usr/share/node -Requires: nodejs(engine) >= 0.10.12 Requires: redhat-rpm-config %description @@ -53,6 +51,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 From 3ee96cddfd304ceb793462c5c423195abe41bd86 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 28 Jul 2020 10:55:05 +0000 Subject: [PATCH 21/72] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_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 858d4d1..d099e32 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 23 -Release: 3%{?dist} +Release: 4%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -51,6 +51,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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) From 372df431efa1cb980c6ca21e2327e59021ed2e6b Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 1 Sep 2020 10:46:37 -0400 Subject: [PATCH 22/72] Check node_modules_prod for bundled dependencies Signed-off-by: Stephen Gallagher --- .gitignore | 1 + nodejs-packaging.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 24cd277..89424e1 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ /nodejs-packaging-fedora-21.tar.xz /nodejs-packaging-fedora-22.tar.xz /nodejs-packaging-fedora-23.tar.xz +/nodejs-packaging-fedora-24.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index d099e32..5d3e950 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: 23 -Release: 4%{?dist} +Version: 24 +Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -51,6 +51,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 6fa90fe..59f35a1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-23.tar.xz) = 9a49c6a4d59a80d757f4e556b6bcdf771d6a3a037a28b00f31eaefc737c85add130cd7e2281ff0f423ee87bcfa0d8cb34a400f0c5678f9af031911c4d80084c4 +SHA512 (nodejs-packaging-fedora-24.tar.xz) = 5eac56aca0e1ad1a7aefcae070515a0207eb305cba43ab61f3127b962a4d9c7064c1a69f14df0adb5f70278c1a237057fe6ac224ad8d89b069e054c2896e826d From c68c968e27fcc93349a701ad3e34292a7e679f68 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 2 Sep 2020 10:52:07 -0400 Subject: [PATCH 23/72] Fix incorrect bundled library detection for Requires Signed-off-by: Stephen Gallagher --- .gitignore | 5 +++++ nodejs-packaging.spec | 5 ++++- sources | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 89424e1..5ea9eaa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +*.rpm +.build-*.log +noarch/ +nodejs-packaging-fedora-*/ /nodejs-packaging-fedora-2.tar.xz /nodejs-packaging-fedora-3.tar.xz /nodejs-packaging-fedora-4.tar.xz @@ -20,3 +24,4 @@ /nodejs-packaging-fedora-22.tar.xz /nodejs-packaging-fedora-23.tar.xz /nodejs-packaging-fedora-24.tar.xz +/nodejs-packaging-fedora-25.tar.xz diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 5d3e950..e15f2ca 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: 24 +Version: 25 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch @@ -51,6 +51,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/sources b/sources index 59f35a1..a462a2e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-24.tar.xz) = 5eac56aca0e1ad1a7aefcae070515a0207eb305cba43ab61f3127b962a4d9c7064c1a69f14df0adb5f70278c1a237057fe6ac224ad8d89b069e054c2896e826d +SHA512 (nodejs-packaging-fedora-25.tar.xz) = ba82999a2ac41114f2925be7a8fe9602e9ac17474b4c4b29de888f2eec9f9ca4ec7fad0e830f763426e1c5026b212bd1d2ddc1d19dbad74ac13fb77d36f85b80 From 8de3f914f4c8e2e0ed07563d68b6bfacd96f2aa3 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 18 Sep 2020 15:47:37 -0400 Subject: [PATCH 24/72] Make dist-git the upstream repo Since the scripts and tools in this package are really Fedora (and derivatives) specific, it doesn't really make a lot of sense to maintain them in a separate upstream with tarball releases. This moves all the files into dist-git and builds the RPM from there. Signed-off-by: Stephen Gallagher --- .gitignore | 35 +- LICENSE | 19 + README.md | 137 ++++ macros.nodejs | 37 + multiver_modules | 3 + nodejs-fixdep | 117 +++ nodejs-packaging.spec | 25 +- nodejs-setversion | 43 ++ nodejs-symlink-deps | 141 ++++ nodejs.attr | 4 + nodejs.prov | 121 +++ nodejs.req | 707 ++++++++++++++++++ sources | 2 +- .../bundled/node_modules/test100/package.json | 4 + .../bundled/node_modules/test101/package.json | 4 + test/bundled/nodejs.prov.err.exp | 0 test/bundled/nodejs.prov.out.exp | 3 + test/bundled/nodejs.req.err.exp | 0 test/bundled/nodejs.req.out.exp | 1 + test/bundled/package.json.in | 11 + test/run | 18 + test/unbundled/nodejs.prov.err.exp | 0 test/unbundled/nodejs.prov.out.exp | 1 + test/unbundled/nodejs.req.err.exp | 2 + test/unbundled/nodejs.req.out.exp | 74 ++ test/unbundled/package.json.in | 108 +++ 26 files changed, 1589 insertions(+), 28 deletions(-) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 macros.nodejs create mode 100644 multiver_modules create mode 100755 nodejs-fixdep create mode 100755 nodejs-setversion create mode 100755 nodejs-symlink-deps create mode 100644 nodejs.attr create mode 100755 nodejs.prov create mode 100755 nodejs.req create mode 100644 test/bundled/node_modules/test100/package.json create mode 100644 test/bundled/node_modules/test101/package.json create mode 100644 test/bundled/nodejs.prov.err.exp create mode 100644 test/bundled/nodejs.prov.out.exp create mode 100644 test/bundled/nodejs.req.err.exp create mode 100644 test/bundled/nodejs.req.out.exp create mode 100644 test/bundled/package.json.in create mode 100755 test/run create mode 100644 test/unbundled/nodejs.prov.err.exp create mode 100644 test/unbundled/nodejs.prov.out.exp create mode 100644 test/unbundled/nodejs.req.err.exp create mode 100644 test/unbundled/nodejs.req.out.exp create mode 100644 test/unbundled/package.json.in diff --git a/.gitignore b/.gitignore index 5ea9eaa..9756798 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,14 @@ +*~ +*.swp +__pycache__/ +*.pyc +nodejs_req.py +test/*/package.json +test/*/nodejs.prov.err +test/*/nodejs.prov.out +test/*/nodejs.req.err +test/*/nodejs.req.out *.rpm .build-*.log noarch/ -nodejs-packaging-fedora-*/ -/nodejs-packaging-fedora-2.tar.xz -/nodejs-packaging-fedora-3.tar.xz -/nodejs-packaging-fedora-4.tar.xz -/nodejs-packaging-fedora-6.tar.xz -/nodejs-packaging-fedora-7.tar.xz -/nodejs-packaging-fedora-8.tar.xz -/nodejs-packaging-fedora-9.tar.xz -/nodejs-packaging-fedora-10.tar.xz -/nodejs-packaging-fedora-11.tar.xz -/nodejs-packaging-fedora-12.tar.xz -/nodejs-packaging-fedora-13.tar.xz -/nodejs-packaging-fedora-14.tar.xz -/nodejs-packaging-fedora-15.tar.xz -/nodejs-packaging-fedora-16.tar.xz -/nodejs-packaging-fedora-17.tar.xz -/nodejs-packaging-fedora-18.tar.xz -/nodejs-packaging-fedora-19.tar.xz -/nodejs-packaging-fedora-20.tar.xz -/nodejs-packaging-fedora-21.tar.xz -/nodejs-packaging-fedora-22.tar.xz -/nodejs-packaging-fedora-23.tar.xz -/nodejs-packaging-fedora-24.tar.xz -/nodejs-packaging-fedora-25.tar.xz +/test.tar.gz diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3792306 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright 2012, 2013 T.C. Hollingsworth + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9c45063 --- /dev/null +++ b/README.md @@ -0,0 +1,137 @@ +# 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 [--arches 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. diff --git a/macros.nodejs b/macros.nodejs new file mode 100644 index 0000000..f86891c --- /dev/null +++ b/macros.nodejs @@ -0,0 +1,37 @@ +# nodejs binary +%__nodejs %{_bindir}/node + +# nodejs library directory +%nodejs_sitelib %{_prefix}/lib/node_modules + +#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 +# pass --no-devdeps to ignore devDependencies when --check is used +%nodejs_symlink_deps %{_rpmconfigdir}/nodejs-symlink-deps %{nodejs_sitelib} + +# patch package.json to fix a dependency +# see `man npm-json` for details on writing dependencies for package.json files +# e.g. `%%nodejs_fixdep frobber` makes any version of frobber do +# `%%nodejs_fixdep frobber '>1.0'` requires frobber > 1.0 +# `%%nodejs_fixdep -r frobber removes the frobber dep +%nodejs_fixdep %{_rpmconfigdir}/nodejs-fixdep + +# patch package.json to set the package version +# e.g. `%%nodejs_setversion 1.2.3` +%nodejs_setversion %{_rpmconfigdir}/nodejs-setversion + +# macro to filter unwanted provides from Node.js binary native modules +%nodejs_default_filter %{expand: \ +%global __provides_exclude_from ^%{nodejs_sitearch}/.*\\.node$ +} + +# no-op macro to allow spec compatibility with EPEL +%nodejs_find_provides_and_requires %{nil} diff --git a/multiver_modules b/multiver_modules new file mode 100644 index 0000000..2dc44eb --- /dev/null +++ b/multiver_modules @@ -0,0 +1,3 @@ +uglify-js +inherits +nan \ No newline at end of file diff --git a/nodejs-fixdep b/nodejs-fixdep new file mode 100755 index 0000000..2569266 --- /dev/null +++ b/nodejs-fixdep @@ -0,0 +1,117 @@ +#!/usr/bin/python3 + +"""Modify a dependency listed in a package.json file""" + +# Copyright 2013 T.C. Hollingsworth +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +import json +import optparse +import os +import re +import shutil +import sys + +RE_VERSION = re.compile(r'\s*v?([<>=~^]{0,2})\s*([0-9][0-9\.\-]*)\s*') + +p = optparse.OptionParser( + description='Modifies dependency entries in package.json files') + +p.add_option('-r', '--remove', action='store_true') +p.add_option('-m', '--move', action='store_true') +p.add_option('--dev', action='store_const', const='devDependencies', + dest='deptype', help='affect devDependencies') +p.add_option('--optional', action='store_const', const='optionalDependencies', + dest='deptype', help='affect optionalDependencies') +p.add_option('--caret', action='store_true', + help='convert all or specified dependencies to use the caret operator') + +options, args = p.parse_args() + +if not os.path.exists('package.json~'): + shutil.copy2('package.json', 'package.json~') + +md = json.load(open('package.json')) + +deptype = options.deptype if options.deptype is not None else 'dependencies' + +if deptype not in md: + md[deptype] = {} + +# convert alternate JSON dependency representations to a dictionary +if not options.caret and not isinstance(md[deptype], dict): + if isinstance(md[deptype], list): + deps = md[deptype] + md[deptype] = {} + for dep in deps: + md[deptype][dep] = '*' + elif isinstance(md[deptype], str): + md[deptype] = { md[deptype] : '*' } + +if options.remove: + dep = args[0] + del md[deptype][dep] +elif options.move: + dep = args[0] + ver = None + for fromtype in ['dependencies', 'optionalDependencies', 'devDependencies']: + if fromtype in md: + if isinstance(md[fromtype], dict) and dep in md[fromtype]: + ver = md[fromtype][dep] + del md[fromtype][dep] + elif isinstance(md[fromtype], list) and md[fromtype].count(dep) > 0: + ver = '*' + md[fromtype].remove(dep) + elif isinstance(md[fromtype], str) and md[fromtype] == dep: + ver = '*' + del md[fromtype] + if ver != None: + md[deptype][dep] = ver +elif options.caret: + if not isinstance(md[deptype], dict): + sys.stderr.write('All dependencies are unversioned. Unable to apply ' + + 'caret operator.\n') + sys.exit(2) + + deps = args if len(args) > 0 else md[deptype].keys() + for dep in deps: + if md[deptype][dep][0] == '^': + continue + elif md[deptype][dep][0] in ('~','0','1','2','3','4','5','6','7','8','9'): + ver = re.match(RE_VERSION, md[deptype][dep]).group(2) + md[deptype][dep] = '^' + ver + else: + sys.stderr.write('Attempted to convert non-numeric or tilde ' + + 'dependency to caret. This is not permitted.\n') + sys.exit(1) +else: + dep = args[0] + + if len(args) > 1: + ver = args[1] + else: + ver = '*' + + md[deptype][dep] = ver + +fh = open('package.json', 'w') +data = json.JSONEncoder(indent=4).encode(md) +fh.write(data) +fh.close() diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index e15f2ca..1292b9c 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -1,15 +1,28 @@ %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: nodejs-packaging -Version: 25 +Version: 2020.09 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT URL: https://fedoraproject.org/wiki/Node.js/Packagers -Source0: https://releases.pagure.org/%{name}/%{name}-fedora-%{version}.tar.xz ExclusiveArch: %{nodejs_arches} noarch +Source0001: LICENSE +Source0002: README.md +Source0003: macros.nodejs +Source0004: multiver_modules +Source0005: nodejs-fixdep +Source0006: nodejs-setversion +Source0007: nodejs-symlink-deps +Source0008: nodejs.attr +Source0009: nodejs.prov +Source0010: nodejs.req + +# Created with `tar cfz test.tar.gz test` +Source0101: test.tar.gz + BuildRequires: python3 Requires: redhat-rpm-config @@ -20,7 +33,10 @@ Node.js modules and applications in RPM-based distributions. %prep -%autosetup -p 1 -n %{name}-fedora-%{version} +pushd %{_topdir}/BUILD +cp -da %{_sourcedir}/* . +tar xvf test.tar.gz +popd %build @@ -51,6 +67,9 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %changelog +* 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 diff --git a/nodejs-setversion b/nodejs-setversion new file mode 100755 index 0000000..49bbe1e --- /dev/null +++ b/nodejs-setversion @@ -0,0 +1,43 @@ +#!/usr/bin/python3 + +"""Set a package version in a package.json file""" + +# Copyright 2018 Tom Hughes +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +import json +import os +import shutil +import sys + +if not os.path.exists('package.json~'): + shutil.copy2('package.json', 'package.json~') + +md = json.load(open('package.json')) + +if 'version' in md and sys.argv[1] != md['version']: + raise RuntimeError('Version is already set to {0}'.format(md['version'])) +else: + md['version'] = sys.argv[1] + +fh = open('package.json', 'w') +data = json.JSONEncoder(indent=4).encode(md) +fh.write(data) +fh.close() diff --git a/nodejs-symlink-deps b/nodejs-symlink-deps new file mode 100755 index 0000000..b5e44b3 --- /dev/null +++ b/nodejs-symlink-deps @@ -0,0 +1,141 @@ +#!/usr/bin/python3 + +"""Symlink a node module's dependencies into the node_modules directory so users +can `npm link` RPM-installed modules into their personal projects.""" + +# Copyright 2012, 2013 T.C. Hollingsworth +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +import json +import os +import re +import shutil +import sys + +def symlink(source, dest): + try: + os.symlink(source, dest) + except OSError: + if os.path.islink(dest) and os.path.realpath(dest) == os.path.normpath(source): + sys.stderr.write(""" +WARNING: the symlink for dependency "{0}" already exists + +This could mean that the dependency exists in both devDependencies and +dependencies, which may cause trouble for people using this module with npm. + +Please report this to upstream. For more information, see: + +""".format(dest)) + + elif '--force' in sys.argv: + if os.path.isdir(dest): + shutil.rmtree(dest) + else: + os.unlink(dest) + + os.symlink(source, dest) + + else: + sys.stderr.write(""" +ERROR: the path for dependency "{0}" 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. +""".format(dest)) + sys.exit(1) + + +def symlink_deps(deps, check): + if isinstance(deps, dict): + #read in the list of mutiple-versioned packages + mvpkgs = open('/usr/share/node/multiver_modules').read().split('\n') + + for dep, ver in deps.items(): + if dep in mvpkgs and ver != '' and ver != '*' and ver != 'latest': + depver = re.sub('^ *(~|\^|=|>=|<=) *', '', ver).split('.')[0] + target = os.path.join(sitelib, '{0}@{1}'.format(dep, depver)) + else: + target = os.path.join(sitelib, dep) + + if not check or os.path.exists(target): + symlink(target, dep) + + elif isinstance(deps, list): + for dep in deps: + target = os.path.join(sitelib, dep) + if not check or os.path.exists(target): + symlink(target, dep) + + elif isinstance(deps, str): + target = os.path.join(sitelib, deps) + if not check or os.path.exists(target): + symlink(target, deps) + + else: + raise TypeError("Invalid package.json: dependencies weren't a recognized type") + + +#the %nodejs_symlink_deps macro passes %nodejs_sitelib as the first argument +sitelib = sys.argv[1] + +if '--check' in sys.argv or '--build' in sys.argv: + check = True + modules = [os.getcwd()] +else: + check = False + br_sitelib = os.path.join(os.environ['RPM_BUILD_ROOT'], sitelib.lstrip('/')) + modules = [os.path.join(br_sitelib, module) for module in os.listdir(br_sitelib)] + +if '--optional' in sys.argv: + optional = True +else: + optional = False + +for path in modules: + os.chdir(path) + md = json.load(open('package.json')) + + if 'dependencies' in md or (check and 'devDependencies' in md) or (optional and 'optionalDependencies' in md): + try: + os.mkdir('node_modules') + except OSError: + sys.stderr.write('WARNING: node_modules already exists. Make sure you have ' + + 'no bundled dependencies.\n') + + os.chdir('node_modules') + + if 'dependencies' in md: + symlink_deps(md['dependencies'], check) + + if check and '--no-devdeps' not in sys.argv and 'devDependencies' in md: + symlink_deps(md['devDependencies'], check) + + if optional and 'optionalDependencies' in md: + symlink_deps(md['optionalDependencies'], check) diff --git a/nodejs.attr b/nodejs.attr new file mode 100644 index 0000000..1066499 --- /dev/null +++ b/nodejs.attr @@ -0,0 +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$ diff --git a/nodejs.prov b/nodejs.prov new file mode 100755 index 0000000..663d3d9 --- /dev/null +++ b/nodejs.prov @@ -0,0 +1,121 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# Copyright 2012 T.C. Hollingsworth +# Copyright 2017 Tomas Tomecek +# Copyright 2019 Jan Staněk +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +"""Automatic provides generator for Node.js libraries. + +Metadata taken from package.json. See `man npm-json` for details. +""" + +from __future__ import print_function, with_statement + +import json +import os +import sys +from itertools import chain, groupby + +DEPENDENCY_TEMPLATE = "npm(%(name)s) = %(version)s" +BUNDLED_TEMPLATE = "bundled(nodejs-%(name)s) = %(version)s" +NODE_MODULES = {"node_modules", "node_modules_prod"} + + +class PrivatePackage(RuntimeError): + """Private package metadata that should not be listed.""" + + +#: Something is wrong with the ``package.json`` file +_INVALID_METADATA_FILE = (IOError, PrivatePackage, KeyError) + + +def format_metadata(metadata, bundled=False): + """Format ``package.json``-like metadata into RPM dependency. + + Arguments: + metadata (dict): Package metadata, presumably read from ``package.json``. + bundled (bool): Should the bundled dependency format be used? + + Returns: + str: RPM dependency (i.e. ``npm(example) = 1.0.0``) + + Raises: + KeyError: Expected key (i.e. ``name``, ``version``) missing in metadata. + PrivatePackage: The metadata indicate private (unlisted) package. + """ + + # Skip private packages + if metadata.get("private", False): + raise PrivatePackage(metadata) + + template = BUNDLED_TEMPLATE if bundled else DEPENDENCY_TEMPLATE + return template % metadata + + +def generate_dependencies(module_path, module_dir_set=NODE_MODULES): + """Generate RPM dependency for a module and all it's dependencies. + + Arguments: + module_path (str): Path to a module directory or it's ``package.json`` + module_dir_set (set): Base names of directories to look into + for bundled dependencies. + + Yields: + str: RPM dependency for the module and each of it's (public) bundled dependencies. + + Raises: + ValueError: module_path is not valid module or ``package.json`` file + """ + + # Determine paths to root module directory and package.json + if os.path.isdir(module_path): + root_dir = module_path + elif os.path.basename(module_path) == "package.json": + root_dir = os.path.dirname(module_path) + else: # Invalid metadata path + raise ValueError("Invalid module path '%s'" % module_path) + + for dir_path, subdir_list, __ in os.walk(root_dir): + # Currently in node_modules (or similar), continue to subdirs + if os.path.basename(dir_path) in module_dir_set: + continue + + # Read and format metadata + metadata_path = os.path.join(dir_path, "package.json") + bundled = dir_path != root_dir + try: + with open(metadata_path, mode="r") as metadata_file: + metadata = json.load(metadata_file) + yield format_metadata(metadata, bundled=bundled) + except _INVALID_METADATA_FILE: + pass # Ignore + + # Only visit subdirectories in module_dir_set + subdir_list[:] = list(module_dir_set & set(subdir_list)) + + +if __name__ == "__main__": + module_paths = (path.strip() for path in sys.stdin) + provides = chain.from_iterable(generate_dependencies(m) for m in module_paths) + + # sort|uniq + for provide, __ in groupby(sorted(provides)): + print(provide) diff --git a/nodejs.req b/nodejs.req new file mode 100755 index 0000000..129606b --- /dev/null +++ b/nodejs.req @@ -0,0 +1,707 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# Copyright 2012, 2013 T.C. Hollingsworth +# Copyright 2019 Jan Staněk +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +""" Automatic dependency generator for Node.js libraries. + +Metadata parsed from package.json. See `man npm-json` for details. +""" + +from __future__ import print_function, with_statement + +import json +import operator +import os +import re +import sys +from collections import namedtuple +from itertools import chain +from itertools import takewhile + +# Python version detection +_PY2 = sys.version_info[0] <= 2 +_PY3 = sys.version_info[0] >= 3 + +if _PY2: + from future_builtins import map, filter + + +#: Name format of the requirements +REQUIREMENT_NAME_TEMPLATE = "npm({name})" + +#: ``simple`` product of the NPM semver grammar. +RANGE_SPECIFIER_SIMPLE = re.compile( + r""" + (?P + <= | >= | < | > | = # primitive + | ~ | \^ # tilde/caret operators + )? + \s*(?P\S+)\s* # version specifier + """, + flags=re.VERBOSE, +) + + +class UnsupportedVersionToken(ValueError): + """Version specifier contains token unsupported by the parser.""" + + +class Version(tuple): + """Normalized RPM/NPM version. + + The version has up to 3 components – major, minor, patch. + Any part set to None is treated as unspecified. + + :: + + 1.2.3 == Version(1, 2, 3) + 1.2 == Version(1, 2) + 1 == Version(1) + * == Version() + """ + + __slots__ = () + + #: Version part meaning 'Any' + #: ``xr`` in https://docs.npmjs.com/misc/semver#range-grammar + _PART_ANY = re.compile(r"^[xX*]$") + #: Numeric version part + #: ``nr`` in https://docs.npmjs.com/misc/semver#range-grammar + _PART_NUMERIC = re.compile(r"0|[1-9]\d*") + + def __new__(cls, *args): + """Create new version. + + Arguments: + Version components in the order of "major", "minor", "patch". + All parts are optional:: + + >>> Version(1, 2, 3) + Version(1, 2, 3) + >>> Version(1) + Version(1) + >>> Version() + Version() + + Returns: + New Version. + """ + + if len(args) > 3: + raise ValueError("Version has maximum of 3 components") + return super(Version, cls).__new__(cls, map(int, args)) + + def __repr__(self): + """Pretty debugging format.""" + + return "{0}({1})".format(self.__class__.__name__, ", ".join(map(str, self))) + + def __str__(self): + """RPM version format.""" + + return ".".join(format(part, "d") for part in self) + + @property + def major(self): + """Major version number, if any.""" + return self[0] if len(self) > 0 else None + + @property + def minor(self): + """Major version number, if any.""" + return self[1] if len(self) > 1 else None + + @property + def patch(self): + """Major version number, if any.""" + return self[2] if len(self) > 2 else None + + @property + def empty(self): + """True if the version contains nothing but zeroes.""" + return not any(self) + + @classmethod + def parse(cls, version_string): + """Parse individual version string (like ``1.2.3``) into Version. + + This is the ``partial`` production in the grammar: + https://docs.npmjs.com/misc/semver#range-grammar + + Examples:: + + >>> Version.parse("1.2.3") + Version(1, 2, 3) + >>> Version.parse("v2.x") + Version(2) + >>> Version.parse("") + Version() + + Arguments: + version_string (str): The version_string to parse. + + Returns: + Version: Parsed result. + """ + + # Ignore leading ``v``, if any + version_string = version_string.lstrip("v") + + part_list = version_string.split(".", 2) + # Use only parts up to first "Any" indicator + part_list = list(takewhile(lambda p: not cls._PART_ANY.match(p), part_list)) + + if not part_list: + return cls() + + # Strip off and discard any pre-release or build qualifiers at the end. + # We can get away with this, because there is no sane way to represent + # these kinds of version requirements in RPM, and we generally expect + # the distro will only carry proper releases anyway. + try: + part_list[-1] = cls._PART_NUMERIC.match(part_list[-1]).group() + except AttributeError: # no match + part_list.pop() + + # Extend with ``None``s at the end, if necessary + return cls(*part_list) + + def incremented(self): + """Increment the least significant part of the version:: + + >>> Version(1, 2, 3).incremented() + Version(1, 2, 4) + >>> Version(1, 2).incremented() + Version(1, 3) + >>> Version(1).incremented() + Version(2) + >>> Version().incremented() + Version() + + Returns: + Version: New incremented Version. + """ + + if len(self) == 0: + return self.__class__() + else: + args = self[:-1] + (self[-1] + 1,) + return self.__class__(*args) + + +class VersionBoundary(namedtuple("VersionBoundary", ("version", "operator"))): + """Normalized version range boundary.""" + + __slots__ = () + + #: Ordering of primitive operators. + #: Operators not listed here are handled specially; see __compare below. + #: Convention: Lower boundary < 0, Upper boundary > 0 + _OPERATOR_ORDER = {"<": 2, "<=": 1, ">=": -1, ">": -2} + + def __str__(self): + """Pretty-print the boundary""" + + return "{0.operator}{0.version}".format(self) + + def __compare(self, other, operator): + """Compare two boundaries with provided operator. + + Boundaries compare same as (version, operator_order) tuple. + In case the boundary operator is not listed in _OPERATOR_ORDER, + it's order is treated as 0. + + Arguments: + other (VersionBoundary): The other boundary to compare with. + operator (Callable[[VersionBoundary, VersionBoundary], bool]): + Comparison operator to delegate to. + + Returns: + bool: The result of the operator's comparison. + """ + + ORDER = self._OPERATOR_ORDER + + lhs = self.version, ORDER.get(self.operator, 0) + rhs = other.version, ORDER.get(other.operator, 0) + return operator(lhs, rhs) + + def __eq__(self, other): + return self.__compare(other, operator.eq) + + def __lt__(self, other): + return self.__compare(other, operator.lt) + + def __le__(self, other): + return self.__compare(other, operator.le) + + def __gt__(self, other): + return self.__compare(other, operator.gt) + + def __ge__(self, other): + return self.__compare(other, operator.ge) + + @property + def upper(self): + """True if self is upper boundary.""" + return self._OPERATOR_ORDER.get(self.operator, 0) > 0 + + @property + def lower(self): + """True if self is lower boundary.""" + return self._OPERATOR_ORDER.get(self.operator, 0) < 0 + + @classmethod + def equal(cls, version): + """Normalize single samp:`={version}` into equivalent x-range:: + + >>> empty = VersionBoundary.equal(Version()); tuple(map(str, empty)) + () + >>> patch = VersionBoundary.equal(Version(1, 2, 3)); tuple(map(str, patch)) + ('>=1.2.3', '<1.2.4') + >>> minor = VersionBoundary.equal(Version(1, 2)); tuple(map(str, minor)) + ('>=1.2', '<1.3') + >>> major = VersionBoundary.equal(Version(1)); tuple(map(str, major)) + ('>=1', '<2') + + See `X-Ranges `_ + for details. + + Arguments: + version (Version): The version the x-range should be equal to. + + Returns: + (VersionBoundary, VersionBoundary): + Lower and upper bound of the x-range. + (): Empty tuple in case version is empty (any version matches). + """ + + if version: + return ( + cls(version=version, operator=">="), + cls(version=version.incremented(), operator="<"), + ) + else: + return () + + @classmethod + def tilde(cls, version): + """Normalize :samp:`~{version}` into equivalent range. + + Tilde allows patch-level changes if a minor version is specified. + Allows minor-level changes if not:: + + >>> with_minor = VersionBoundary.tilde(Version(1, 2, 3)); tuple(map(str, with_minor)) + ('>=1.2.3', '<1.3') + >>> no_minor = VersionBoundary.tilde(Version(1)); tuple(map(str, no_minor)) + ('>=1', '<2') + + Arguments: + version (Version): The version to tilde-expand. + + Returns: + (VersionBoundary, VersionBoundary): + The lower and upper boundary of the tilde range. + """ + + # Fail on ``~*`` or similar nonsense specifier + assert version.major is not None, "Nonsense '~*' specifier" + + lower_boundary = cls(version=version, operator=">=") + + if version.minor is None: + upper_boundary = cls(version=Version(version.major + 1), operator="<") + else: + upper_boundary = cls( + version=Version(version.major, version.minor + 1), operator="<" + ) + + return lower_boundary, upper_boundary + + @classmethod + def caret(cls, version): + """Normalize :samp:`^{version}` into equivalent range. + + Caret allows changes that do not modify the left-most non-zero digit + in the ``(major, minor, patch)`` tuple. + In other words, this allows + patch and minor updates for versions 1.0.0 and above, + patch updates for versions 0.X >=0.1.0, + and no updates for versions 0.0.X:: + + >>> major = VersionBoundary.caret(Version(1, 2, 3)); tuple(map(str, major)) + ('>=1.2.3', '<2') + >>> minor = VersionBoundary.caret(Version(0, 2, 3)); tuple(map(str, minor)) + ('>=0.2.3', '<0.3') + >>> patch = VersionBoundary.caret(Version(0, 0, 3)); tuple(map(str, patch)) + ('>=0.0.3', '<0.0.4') + + When parsing caret ranges, a missing patch value desugars to the number 0, + but will allow flexibility within that value, + even if the major and minor versions are both 0:: + + >>> rel = VersionBoundary.caret(Version(1, 2)); tuple(map(str, rel)) + ('>=1.2', '<2') + >>> pre = VersionBoundary.caret(Version(0, 0)); tuple(map(str, pre)) + ('>=0.0', '<0.1') + + A missing minor and patch values will desugar to zero, + but also allow flexibility within those values, + even if the major version is zero:: + + >>> rel = VersionBoundary.caret(Version(1)); tuple(map(str, rel)) + ('>=1', '<2') + >>> pre = VersionBoundary.caret(Version(0)); tuple(map(str, pre)) + ('>=0', '<1') + + Arguments: + version (Version): The version to range-expand. + + Returns: + (VersionBoundary, VersionBoundary): + The lower and upper boundary of caret-range. + """ + + # Fail on ^* or similar nonsense specifier + assert len(version) != 0, "Nonsense '^*' specifier" + + lower_boundary = cls(version=version, operator=">=") + + # Increment left-most non-zero part + for idx, part in enumerate(version): + if part != 0: + upper_version = Version(*(version[:idx] + (part + 1,))) + break + else: # No non-zero found; increment last specified part + upper_version = version.incremented() + + upper_boundary = cls(version=upper_version, operator="<") + + return lower_boundary, upper_boundary + + @classmethod + def hyphen(cls, lower_version, upper_version): + """Construct hyphen range (inclusive set):: + + >>> full = VersionBoundary.hyphen(Version(1, 2, 3), Version(2, 3, 4)); tuple(map(str, full)) + ('>=1.2.3', '<=2.3.4') + + If a partial version is provided as the first version in the inclusive range, + then the missing pieces are treated as zeroes:: + + >>> part = VersionBoundary.hyphen(Version(1, 2), Version(2, 3, 4)); tuple(map(str, part)) + ('>=1.2', '<=2.3.4') + + If a partial version is provided as the second version in the inclusive range, + then all versions that start with the supplied parts of the tuple are accepted, + but nothing that would be greater than the provided tuple parts:: + + >>> part = VersionBoundary.hyphen(Version(1, 2, 3), Version(2, 3)); tuple(map(str, part)) + ('>=1.2.3', '<2.4') + >>> part = VersionBoundary.hyphen(Version(1, 2, 3), Version(2)); tuple(map(str, part)) + ('>=1.2.3', '<3') + + Arguments: + lower_version (Version): Version on the lower range boundary. + upper_version (Version): Version on the upper range boundary. + + Returns: + (VersionBoundary, VersionBoundary): + Lower and upper boundaries of the hyphen range. + """ + + lower_boundary = cls(version=lower_version, operator=">=") + + if len(upper_version) < 3: + upper_boundary = cls(version=upper_version.incremented(), operator="<") + else: + upper_boundary = cls(version=upper_version, operator="<=") + + return lower_boundary, upper_boundary + + +def parse_simple_seq(specifier_string): + """Parse all specifiers from a space-separated string:: + + >>> single = parse_simple_seq(">=1.2.3"); list(map(str, single)) + ['>=1.2.3'] + >>> multi = parse_simple_seq("~1.2.0 <1.2.5"); list(map(str, multi)) + ['>=1.2.0', '<1.3', '<1.2.5'] + + This method implements the ``simple (' ' simple)*`` part of the grammar: + https://docs.npmjs.com/misc/semver#range-grammar. + + Arguments: + specifier_string (str): Space-separated string of simple version specifiers. + + Yields: + VersionBoundary: Parsed boundaries. + """ + + # Per-operator dispatch table + # API: Callable[[Version], Iterable[VersionBoundary]] + handler = { + ">": lambda v: [VersionBoundary(version=v, operator=">")], + ">=": lambda v: [VersionBoundary(version=v, operator=">=")], + "<=": lambda v: [VersionBoundary(version=v, operator="<=")], + "<": lambda v: [VersionBoundary(version=v, operator="<")], + "=": VersionBoundary.equal, + "~": VersionBoundary.tilde, + "^": VersionBoundary.caret, + None: VersionBoundary.equal, + } + + for match in RANGE_SPECIFIER_SIMPLE.finditer(specifier_string): + operator, version_string = match.group("operator", "version") + + for boundary in handler[operator](Version.parse(version_string)): + yield boundary + + +def parse_range(range_string): + """Parse full NPM version range specification:: + + >>> empty = parse_range(""); list(map(str, empty)) + [] + >>> simple = parse_range("^1.0"); list(map(str, simple)) + ['>=1.0', '<2'] + >>> hyphen = parse_range("1.0 - 2.0"); list(map(str, hyphen)) + ['>=1.0', '<2.1'] + + This method implements the ``range`` part of the grammar: + https://docs.npmjs.com/misc/semver#range-grammar. + + Arguments: + range_string (str): The range specification to parse. + + Returns: + Iterable[VersionBoundary]: Parsed boundaries. + + Raises: + UnsupportedVersionToken: ``||`` is present in range_string. + """ + + HYPHEN = " - " + + # FIXME: rpm should be able to process OR in dependencies + # This error reporting kept for backward compatibility + if "||" in range_string: + raise UnsupportedVersionToken(range_string) + + if HYPHEN in range_string: + version_pair = map(Version.parse, range_string.split(HYPHEN, 2)) + return VersionBoundary.hyphen(*version_pair) + + elif range_string != "": + return parse_simple_seq(range_string) + + else: + return [] + + +def unify_range(boundary_iter): + """Calculate largest allowed continuous version range from a set of boundaries:: + + >>> unify_range([]) + () + >>> _ = unify_range(parse_range("=1.2.3 <2")); tuple(map(str, _)) + ('>=1.2.3', '<1.2.4') + >>> _ = unify_range(parse_range("~1.2 <1.2.5")); tuple(map(str, _)) + ('>=1.2', '<1.2.5') + + Arguments: + boundary_iter (Iterable[VersionBoundary]): The version boundaries to unify. + + Returns: + (VersionBoundary, VersionBoundary): + Lower and upper boundary of the unified range. + """ + + # Drop boundaries with empty version + boundary_iter = ( + boundary for boundary in boundary_iter if not boundary.version.empty + ) + + # Split input sequence into upper/lower boundaries + lower_list, upper_list = [], [] + for boundary in boundary_iter: + if boundary.lower: + lower_list.append(boundary) + elif boundary.upper: + upper_list.append(boundary) + else: + msg = "Unsupported boundary for unify_range: {0}".format(boundary) + raise ValueError(msg) + + # Select maximum from lower boundaries and minimum from upper boundaries + intermediate = ( + max(lower_list) if lower_list else None, + min(upper_list) if upper_list else None, + ) + + return tuple(filter(None, intermediate)) + + +def rpm_format(requirement, version_spec="*"): + """Format requirement as RPM boolean dependency:: + + >>> rpm_format("nodejs(engine)") + 'nodejs(engine)' + >>> rpm_format("npm(foo)", ">=1.0.0") + 'npm(foo) >= 1.0.0' + >>> rpm_format("npm(bar)", "~1.2") + '(npm(bar) >= 1.2 with npm(bar) < 1.3)' + + Arguments: + requirement (str): The name of the requirement. + version_spec (str): The NPM version specification for the requirement. + + Returns: + str: Formatted requirement. + """ + + TEMPLATE = "{name} {boundary.operator} {boundary.version!s}" + + try: + boundary_tuple = unify_range(parse_range(version_spec)) + + except UnsupportedVersionToken: + # FIXME: Typos and print behavior kept for backward compatibility + warning_lines = [ + "WARNING: The {requirement} dependency contains an OR (||) dependency: '{version_spec}.", + "Please manually include a versioned dependency in your spec file if necessary", + ] + warning = "\n".join(warning_lines).format( + requirement=requirement, version_spec=version_spec + ) + print(warning, end="", file=sys.stderr) + + return requirement + + formatted = [ + TEMPLATE.format(name=requirement, boundary=boundary) + for boundary in boundary_tuple + ] + + if len(formatted) > 1: + return "({0})".format(" with ".join(formatted)) + elif len(formatted) == 1: + return formatted[0] + else: + return requirement + + +def has_only_bundled_dependencies(module_dir_path): + """Determines if the module contains only bundled dependencies. + + Dependencies are considered un-bundled when they are symlinks + pointing outside the root module's tree. + + Arguments: + module_dir_path (str): + Path to the module directory (directory with ``package.json``). + + Returns: + bool: True if all dependencies are bundled, False otherwise. + """ + + module_root_path = os.path.abspath(module_dir_path) + dependency_root_path = os.path.join(module_root_path, "node_modules") + + try: + dependency_path_iter = ( + os.path.join(dependency_root_path, basename) + for basename in os.listdir(dependency_root_path) + ) + 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) + ) + + return any(bundled_dependency_iter) + except OSError: # node_modules does not exist + return False + + +def extract_dependencies(metadata_path, optional=False): + """Extract all dependencies in RPM format from package metadata. + + Arguments: + metadata_path (str): Path to package metadata (``package.json``). + optional (bool): + If True, extract ``optionalDependencies`` + instead of ``dependencies``. + + Yields: + RPM-formatted dependencies. + + Raises: + 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: + metadata = json.load(metadata_file) + except OSError: # Invalid metadata file + return # skip + + # Report required NodeJS version with required dependencies + if not optional: + try: + yield rpm_format("nodejs(engine)", metadata["engines"]["node"]) + except KeyError: # NodeJS engine version unspecified + yield rpm_format("nodejs(engine)") + + # Report listed dependencies + kind = "optionalDependencies" if optional else "dependencies" + container = metadata.get(kind, {}) + + if isinstance(container, dict): + for name, version_spec in container.items(): + yield rpm_format(REQUIREMENT_NAME_TEMPLATE.format(name=name), version_spec) + + elif isinstance(container, list): + for name in container: + yield rpm_format(REQUIREMENT_NAME_TEMPLATE.format(name=name)) + + elif isinstance(container, str): + yield rpm_format(REQUIREMENT_NAME_TEMPLATE.format(name=name)) + + else: + raise TypeError("invalid package.json: dependencies not a valid type") + + +if __name__ == "__main__": + nested = ( + extract_dependencies(path.strip(), optional="--optional" in sys.argv) + for path in sys.stdin + ) + flat = chain.from_iterable(nested) + # Ignore parentheses around the requirements when sorting + ordered = sorted(flat, key=lambda s: s.strip("()")) + + print(*ordered, sep="\n") diff --git a/sources b/sources index a462a2e..52e9e27 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nodejs-packaging-fedora-25.tar.xz) = ba82999a2ac41114f2925be7a8fe9602e9ac17474b4c4b29de888f2eec9f9ca4ec7fad0e830f763426e1c5026b212bd1d2ddc1d19dbad74ac13fb77d36f85b80 +SHA512 (test.tar.gz) = dfbda67b8741f1ca36bf63b2e842f81ba07381b3d92e75fa7e29f8e456543b4cae55e95785902f31a14ae4d0b7e89161ba04c0c10c2fff617b4ae9607c91e599 diff --git a/test/bundled/node_modules/test100/package.json b/test/bundled/node_modules/test100/package.json new file mode 100644 index 0000000..5e1a529 --- /dev/null +++ b/test/bundled/node_modules/test100/package.json @@ -0,0 +1,4 @@ +{ + "name": "test100", + "version": "1.3.5" +} diff --git a/test/bundled/node_modules/test101/package.json b/test/bundled/node_modules/test101/package.json new file mode 100644 index 0000000..f98ae32 --- /dev/null +++ b/test/bundled/node_modules/test101/package.json @@ -0,0 +1,4 @@ +{ + "name": "test101", + "version": "2.1.4" +} diff --git a/test/bundled/nodejs.prov.err.exp b/test/bundled/nodejs.prov.err.exp new file mode 100644 index 0000000..e69de29 diff --git a/test/bundled/nodejs.prov.out.exp b/test/bundled/nodejs.prov.out.exp new file mode 100644 index 0000000..ee0f024 --- /dev/null +++ b/test/bundled/nodejs.prov.out.exp @@ -0,0 +1,3 @@ +bundled(nodejs-test100) = 1.3.5 +bundled(nodejs-test101) = 2.1.4 +npm(test) = 4.5.6 diff --git a/test/bundled/nodejs.req.err.exp b/test/bundled/nodejs.req.err.exp new file mode 100644 index 0000000..e69de29 diff --git a/test/bundled/nodejs.req.out.exp b/test/bundled/nodejs.req.out.exp new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/bundled/nodejs.req.out.exp @@ -0,0 +1 @@ + diff --git a/test/bundled/package.json.in b/test/bundled/package.json.in new file mode 100644 index 0000000..e41f38b --- /dev/null +++ b/test/bundled/package.json.in @@ -0,0 +1,11 @@ +{ + "name": "test", + "version": "4.5.6", + "engines": { + "node": ">=6 <10" + }, + "dependencies": { + "test100": "^1.2.3", + "test101": ">=2.1" + } +} diff --git a/test/run b/test/run new file mode 100755 index 0000000..6afb356 --- /dev/null +++ b/test/run @@ -0,0 +1,18 @@ +#!/bin/sh + +ln -sf nodejs.req nodejs_req.py +"$(command -v python2 || echo :)" -m doctest nodejs_req.py || exit 1 +"$(command -v python3 || echo :)" -m doctest nodejs_req.py || exit 1 + +for test in unbundled bundled +do + sed -e "s|//.*$||" < test/$test/package.json.in > test/$test/package.json + + echo test/$test/package.json | ./nodejs.prov test/$test/package.json > test/$test/nodejs.prov.out 2> test/$test/nodejs.prov.err + diff -uw test/$test/nodejs.prov.err.exp test/$test/nodejs.prov.err || exit 1 + diff -uw test/$test/nodejs.prov.out.exp test/$test/nodejs.prov.out || exit 1 + + echo test/$test/package.json | ./nodejs.req test/$test/package.json > test/$test/nodejs.req.out 2> test/$test/nodejs.req.err + diff -uw test/$test/nodejs.req.err.exp test/$test/nodejs.req.err || exit 1 + diff -uw test/$test/nodejs.req.out.exp test/$test/nodejs.req.out || exit 1 +done diff --git a/test/unbundled/nodejs.prov.err.exp b/test/unbundled/nodejs.prov.err.exp new file mode 100644 index 0000000..e69de29 diff --git a/test/unbundled/nodejs.prov.out.exp b/test/unbundled/nodejs.prov.out.exp new file mode 100644 index 0000000..2ea2883 --- /dev/null +++ b/test/unbundled/nodejs.prov.out.exp @@ -0,0 +1 @@ +npm(test) = 4.5.6 diff --git a/test/unbundled/nodejs.req.err.exp b/test/unbundled/nodejs.req.err.exp new file mode 100644 index 0000000..83bd277 --- /dev/null +++ b/test/unbundled/nodejs.req.err.exp @@ -0,0 +1,2 @@ +WARNING: The npm(test900) dependency contains an OR (||) dependency: '^1.2 || ^2.2. +Please manually include a versioned dependency in your spec file if necessary diff --git a/test/unbundled/nodejs.req.out.exp b/test/unbundled/nodejs.req.out.exp new file mode 100644 index 0000000..08aeab1 --- /dev/null +++ b/test/unbundled/nodejs.req.out.exp @@ -0,0 +1,74 @@ +(nodejs(engine) >= 6 with nodejs(engine) < 10) +(npm(test100) >= 1 with npm(test100) < 2) +(npm(test101) >= 1 with npm(test101) < 2) +(npm(test102) >= 1 with npm(test102) < 2) +(npm(test103) >= 1 with npm(test103) < 2) +(npm(test104) >= 1.2 with npm(test104) < 1.3) +(npm(test105) >= 1.2 with npm(test105) < 1.3) +(npm(test106) >= 1.2 with npm(test106) < 1.3) +(npm(test107) >= 1.2 with npm(test107) < 1.3) +(npm(test108) >= 1.2.3 with npm(test108) < 1.2.4) +(npm(test109) >= 1.2.3 with npm(test109) < 1.2.4) +(npm(test110) >= 1.2.3 with npm(test110) < 1.2.4) +(npm(test111) >= 1.2.3 with npm(test111) < 1.2.4) +npm(test200) > 1 +npm(test201) > 1.2 +npm(test202) > 1.2.3 +npm(test203) >= 1 +npm(test204) >= 1.2 +npm(test205) >= 1.2.3 +npm(test206) < 2 +npm(test207) < 2.3 +npm(test208) < 2.3.4 +npm(test209) <= 2 +npm(test210) <= 2.3 +npm(test211) <= 2.3.4 +(npm(test300) > 1 with npm(test300) < 2) +(npm(test301) > 1.2 with npm(test301) < 2.3) +(npm(test302) > 1.2.3 with npm(test302) < 2.3.4) +(npm(test303) >= 1 with npm(test303) <= 2) +(npm(test304) >= 1.2 with npm(test304) <= 2.3) +(npm(test305) >= 1.2.3 with npm(test305) <= 2.3.4) +(npm(test306) > 1 with npm(test306) < 2) +(npm(test307) > 1.2 with npm(test307) < 2.3) +(npm(test308) > 1.2.3 with npm(test308) < 2.3.4) +(npm(test309) >= 1 with npm(test309) <= 2) +(npm(test310) >= 1.2 with npm(test310) <= 2.3) +(npm(test311) >= 1.2.3 with npm(test311) <= 2.3.4) +(npm(test400) >= 1.2.3 with npm(test400) <= 2.3.4) +(npm(test401) >= 1.2.3 with npm(test401) < 2.4) +(npm(test402) >= 1.2.3 with npm(test402) < 3) +(npm(test403) >= 1.2 with npm(test403) <= 2.3.4) +(npm(test404) >= 1 with npm(test404) <= 2.3.4) +(npm(test405) >= 1.2 with npm(test405) < 2.4) +(npm(test406) >= 1.2 with npm(test406) < 3) +(npm(test407) >= 1 with npm(test407) < 2.4) +(npm(test408) >= 1 with npm(test408) < 3) +(npm(test500) >= 1.2 with npm(test500) < 1.3) +(npm(test501) >= 1.2 with npm(test501) < 1.3) +(npm(test502) >= 1 with npm(test502) < 2) +(npm(test503) >= 1 with npm(test503) < 2) +npm(test504) +npm(test505) +(npm(test600) >= 1.2.3 with npm(test600) < 1.3) +(npm(test601) >= 1.2 with npm(test601) < 1.3) +(npm(test602) >= 1.2 with npm(test602) < 1.3) +(npm(test603) >= 1 with npm(test603) < 2) +(npm(test604) >= 1 with npm(test604) < 2) +(npm(test700) >= 1.2.3 with npm(test700) < 2) +(npm(test701) >= 0.2.3 with npm(test701) < 0.3) +(npm(test702) >= 0.0.3 with npm(test702) < 0.0.4) +(npm(test703) >= 1.2 with npm(test703) < 2) +(npm(test704) >= 1.2 with npm(test704) < 2) +(npm(test705) >= 0.1 with npm(test705) < 0.2) +(npm(test706) >= 0.1 with npm(test706) < 0.2) +(npm(test707) >= 1 with npm(test707) < 2) +(npm(test708) >= 1 with npm(test708) < 2) +npm(test709) < 0.1 +npm(test710) < 0.1 +npm(test711) < 1 +npm(test712) < 1 +npm(test750) >= 0.10 +(npm(test751) >= 0.10 with npm(test751) <= 6) +(npm(test800) > 1.2 with npm(test800) < 1.9) +npm(test900) diff --git a/test/unbundled/package.json.in b/test/unbundled/package.json.in new file mode 100644 index 0000000..4d9624e --- /dev/null +++ b/test/unbundled/package.json.in @@ -0,0 +1,108 @@ +{ + "name": "test", + "version": "4.5.6", + "engines": { + "node": ">=6 <10" + }, + "dependencies": { + // Single version + "test100": "1", + "test101": "=1", + "test102": "v1", + "test103": "=v1", + "test104": "1.2", + "test105": "=1.2", + "test106": "v1.2", + "test107": "=v1.2", + "test108": "1.2.3", + "test109": "=1.2.3", + "test110": "v1.2.3", + "test111": "=v1.2.3", + + // Ranges with one comparator + "test200": ">1", + "test201": ">1.2", + "test202": ">1.2.3", + "test203": ">=1", + "test204": ">=1.2", + "test205": ">=1.2.3", + "test206": "<2", + "test207": "<2.3", + "test208": "<2.3.4", + "test209": "<=2", + "test210": "<=2.3", + "test211": "<=2.3.4", + + // Ranges with two comparators + "test300": ">1 <2", + "test301": ">1.2 <2.3", + "test302": ">1.2.3 <2.3.4", + "test303": ">=1 <=2", + "test304": ">=1.2 <=2.3", + "test305": ">=1.2.3 <=2.3.4", + "test306": "<2 >1", + "test307": "<2.3 >1.2", + "test308": "<2.3.4 >1.2.3", + "test309": "<=2 >=1", + "test310": "<=2.3 >=1.2", + "test311": "<=2.3.4 >=1.2.3", + + // Hyphen ranges + "test400": "1.2.3 - 2.3.4", + "test401": "1.2.3 - 2.3", + "test402": "1.2.3 - 2", + "test403": "1.2 - 2.3.4", + "test404": "1 - 2.3.4", + "test405": "1.2 - 2.3", + "test406": "1.2 - 2", + "test407": "1 - 2.3", + "test408": "1 - 2", + + // X-Ranges + "test500": "1.2.x", + "test501": "1.2.*", + "test502": "1.x", + "test503": "1.*", + "test504": "*", + "test505": "", + + // Tilde ranges + "test600": "~1.2.3", + "test601": "~1.2.x", + "test602": "~1.2", + "test603": "~1.x", + "test604": "~1", + + // Caret ranges + "test700": "^1.2.3", + "test701": "^0.2.3", + "test702": "^0.0.3", + "test703": "^1.2.x", + "test704": "^1.2", + "test705": "^0.1.x", + "test706": "^0.1", + "test707": "^1.x", + "test708": "^1", + "test709": "^0.0.x", + "test710": "^0.0", + "test711": "^0.x", + "test712": "^0", + + // Space after the operator + // (the grammar does not permit this, but it is accepted in practice) + "test750": ">= 0.10", + "test751": ">= 0.10 <= 6", + + // More than two comparators in a set + // (no reason for this to ever appear, but it is permitted) + "test800": ">1.2 <2.0 <1.9", + + // The following cases are not implemented currently... + + // Multiple comparator sets separated by || + "test900": "^1.2 || ^2.2" + + // The whole pre-release stuff: https://docs.npmjs.com/misc/semver//prerelease-tags + // which is not even enumerated here because it is so complex. + } +} From 5b7b3fce5dd9f716aec375a67136670e128e930a Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Wed, 6 Jan 2021 10:13:56 -0800 Subject: [PATCH 25/72] Add nodejs-packaging-bundler file Add nodejs-packaging-bundler subpackage in spec file Update README.md with comments about nodejs-packaging-bundler and an example spec file that uses bundling Signed-off-by: Troy Dawson --- README.md | 81 +++++++++++++++++++++++++++++++++++++++ nodejs-packaging-bundler | 82 ++++++++++++++++++++++++++++++++++++++++ nodejs-packaging.spec | 21 +++++++++- 3 files changed, 183 insertions(+), 1 deletion(-) create mode 100755 nodejs-packaging-bundler diff --git a/README.md b/README.md index 9c45063..f0c2a1a 100644 --- a/README.md +++ b/README.md @@ -135,3 +135,84 @@ 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 +[global library packages](https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/) +is that they are ".. best avoided if not needed." In Fedora, we take the same +stance with our nodejs packages. You can provide a package that uses nodejs, +but you should bundle all the nodejs libraries that are needed. + +We are providing a sample spec file and bundling script here. +For more detailed packaging information go to the +[Fedora Node.js Packaging Guildelines](https://docs.fedoraproject.org/en-US/packaging-guidelines/Node.js/) + +## Bundling Script + +``` +nodejs-packaging-bundler [version] +``` + +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. +It produces four files and puts them in ${HOME}/rpmbuild/SOURCES + + * -.tgz - This is the tarball from npm.org + * --nm-prod.tgz - This is the tarball that contains all the bundled nodejs modules needs to run + * --nm-dev.tgz - This is the tarball that contains all the bundled nodejs modules needs to test + * --bundled-licenses.txt - This lists the bundled licenses in --nm-prod.tgz + +## Sample Spec File + +``` +%global npm_name my_nodejs_application +... +License: and and +... +Source0: http://registry.npmjs.org/%{npm_name}/-/%{npm_name}-%{version}.tgz +Source1: %{npm_name}-%{version}-nm-prod.tgz +Source2: %{npm_name}-%{version}-nm-dev.tgz +Source3: %{npm_name}-%{version}-bundled-licenses.txt +... +BuildRequires: nodejs-devel +... +%prep +%setup -q -n package +cp %{SOURCE3} . +... +%build +# Setup bundled node modules +tar xfz %{SOURCE1} +mkdir -p node_modules +pushd node_modules +ln -s ../node_modules_prod/* . +ln -s ../node_modules_prod/.bin . +popd +... +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name} +cp -pr index.js lib package.json %{buildroot}%{nodejs_sitelib}/%{npm_name} +# Copy over bundled nodejs modules +cp -pr node_modules node_modules_prod %{buildroot}%{nodejs_sitelib}/%{npm_name} +... +%check +%nodejs_symlink_deps --check +# Setup bundled dev node_modules for testing +tar xfz %{SOURCE2} +pushd node_modules +ln -s ../node_modules_dev/* . +popd +pushd node_modules/.bin +ln -s ../../node_modules_dev/.bin/* . +popd +# Example test run using the binary in ./node_modules/.bin/ +./node_modules/.bin/vows --spec --isolate +... +%files +%doc HISTORY.md +%license LICENSE.md %{npm_name}-%{version}-bundled-licenses.txt +%{nodejs_sitelib}/%{npm_name} +``` + diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler new file mode 100755 index 0000000..18be72b --- /dev/null +++ b/nodejs-packaging-bundler @@ -0,0 +1,82 @@ +#!/bin/bash +OUTPUT_DIR="${HOME}/rpmbuild/SOURCES" + +usage() { + echo "Usage `basename $0` [version] " >&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 license list are copied to ${OUTPUT_DIR}" >&2 + echo >&2 + exit 1 +} + +if ! [ -f /usr/bin/npm ]; then + echo >&2 + echo "`basename $0` requires npm to run" >&2 + echo >&2 + echo "Run the following to fix this" >&2 + echo " sudo dnf install npm" >&2 + echo >&2 + exit 2 +fi + +if [ $# -lt 1 ]; then + usage +else + case $1 in + -h | --help ) + usage + ;; + * ) + PACKAGE="$1" + ;; + esac +fi + +if [ $# -ge 2 ]; then + VERSION="$2" +else + VERSION="$(npm view ${PACKAGE} version)" +fi + +TMP_DIR=$(mktemp -d -t ci-XXXXXXXXXX) +mkdir -p ${OUTPUT_DIR} +mkdir -p ${TMP_DIR} +pushd ${TMP_DIR} +npm pack ${PACKAGE} +tar xfz *.tgz +cd package +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 dependences download" + mv node_modules/ node_modules_prod +fi +echo "LICENSES IN BUNDLE:" +find . -name "package.json" -exec jq .license {} \; >> ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt +find . -name "package.json" -exec jq '.licenses[] .type' {} \; >> ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt 2>/dev/null +sort -u -o ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt +echo " Downloading dev dependencies" +npm install --no-optional --only=dev +if [ $? -ge 1 ] ; then + echo " ERROR WILL ROBINSON" +else + echo " Successful dev dependences download" + mv node_modules/ node_modules_dev +fi +if [ -d node_modules_prod ] ; then + tar cfz ../${PACKAGE}-${VERSION}-nm-prod.tgz node_modules_prod +fi +if [ -d node_modules_dev ] ; then + tar cfz ../${PACKAGE}-${VERSION}-nm-dev.tgz node_modules_dev +fi +cd .. +cp -v ${PACKAGE}-${VERSION}* $HOME/rpmbuild/SOURCES +popd > /dev/null +rm -rf ${TMP_DIR} diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 1292b9c..62de0ca 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: 2020.09 +Version: 2021.01 Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch @@ -19,6 +19,7 @@ Source0007: nodejs-symlink-deps Source0008: nodejs.attr Source0009: nodejs.prov Source0010: nodejs.req +Source0011: nodejs-packaging-bundler # Created with `tar cfz test.tar.gz test` Source0101: test.tar.gz @@ -31,6 +32,17 @@ Requires: redhat-rpm-config This package contains RPM macros and other utilities useful for packaging Node.js modules and applications in RPM-based distributions. +%package bundler +Summary: Bundle a node.js application dependencies +Requires: npm +Requires: coreutils, findutils, jq + +%description bundler +nodejs-packaging-bundler bundles a node.js application node_module dependencies +It gathers the application tarball. +It generates a runtime (prod) tarball with runtime node_module dependencies +It generates a testing (dev) tarball with node_module dependencies for testing +It generates a bundled licence file that gets the licenses in the runtime dependency tarball %prep pushd %{_topdir}/BUILD @@ -52,6 +64,7 @@ install -pm0755 nodejs-symlink-deps %{buildroot}%{_rpmconfigdir}/nodejs-symlink- install -pm0755 nodejs-fixdep %{buildroot}%{_rpmconfigdir}/nodejs-fixdep install -pm0755 nodejs-setversion %{buildroot}%{_rpmconfigdir}/nodejs-setversion install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules +install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packaging-bundler %check @@ -65,8 +78,14 @@ install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules %{_rpmconfigdir}/nodejs* %{_datadir}/node/multiver_modules +%files bundler +%{_bindir}/nodejs-packaging-bundler + %changelog +* 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 From 05a9e5899759d414e9bf2291be3366975b9972a7 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Mon, 11 Jan 2021 13:54:15 -0800 Subject: [PATCH 26/72] Fix null when there is no .licenses found. Signed-off-by: Troy Dawson --- nodejs-packaging-bundler | 1 + 1 file changed, 1 insertion(+) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index 18be72b..0dd61d7 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -61,6 +61,7 @@ fi echo "LICENSES IN BUNDLE:" find . -name "package.json" -exec jq .license {} \; >> ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt find . -name "package.json" -exec jq '.licenses[] .type' {} \; >> ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt 2>/dev/null +sed -i "/^null$/d" ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt sort -u -o ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt echo " Downloading dev dependencies" npm install --no-optional --only=dev From 7d1699cedcb68b3dd7627ce0e968d655ae0682ba Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Sun, 17 Jan 2021 16:22:03 -0800 Subject: [PATCH 27/72] nodejs-packaging-bundler: sanitize package name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The NPM package name might contain invalid characters, e.g. `@bitwarden/cli`. Normalize the generated bundles by converting `/` to `-`. ``` specs/nodejs on  master ❯ ~/src/fedora/pkgs-others/nodejs-packaging/nodejs-packaging-bundler @bitwarden/cli ... Successful dev dependences download '@bitwarden-cli-1.13.3-bundled-licenses.txt' -> '/home/michel/rpmbuild/SOURCES/@bitwarden-cli-1.13.3-bundled-licenses.txt' '@bitwarden-cli-1.13.3-nm-dev.tgz' -> '/home/michel/rpmbuild/SOURCES/@bitwarden-cli-1.13.3-nm-dev.tgz' '@bitwarden-cli-1.13.3-nm-prod.tgz' -> '/home/michel/rpmbuild/SOURCES/@bitwarden-cli-1.13.3-nm-prod.tgz' ``` Signed-off-by: Michel Alexandre Salim --- nodejs-packaging-bundler | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index 0dd61d7..8a1f83c 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -41,7 +41,8 @@ if [ $# -ge 2 ]; then else VERSION="$(npm view ${PACKAGE} version)" fi - +# the package name might contain invalid characters, sanitize first +PACKAGE_SAFE=$(echo $PACKAGE | sed -e 's|/|-|g') TMP_DIR=$(mktemp -d -t ci-XXXXXXXXXX) mkdir -p ${OUTPUT_DIR} mkdir -p ${TMP_DIR} @@ -59,10 +60,10 @@ else mv node_modules/ node_modules_prod fi echo "LICENSES IN BUNDLE:" -find . -name "package.json" -exec jq .license {} \; >> ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt -find . -name "package.json" -exec jq '.licenses[] .type' {} \; >> ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt 2>/dev/null -sed -i "/^null$/d" ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt -sort -u -o ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt ${TMP_DIR}/${PACKAGE}-${VERSION}-bundled-licenses.txt +find . -name "package.json" -exec jq .license {} \; >> ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt +find . -name "package.json" -exec jq '.licenses[] .type' {} \; >> ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt 2>/dev/null +sed -i "/^null$/d" ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt +sort -u -o ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt echo " Downloading dev dependencies" npm install --no-optional --only=dev if [ $? -ge 1 ] ; then @@ -72,12 +73,12 @@ else mv node_modules/ node_modules_dev fi if [ -d node_modules_prod ] ; then - tar cfz ../${PACKAGE}-${VERSION}-nm-prod.tgz node_modules_prod + tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-prod.tgz node_modules_prod fi if [ -d node_modules_dev ] ; then - tar cfz ../${PACKAGE}-${VERSION}-nm-dev.tgz node_modules_dev + tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-dev.tgz node_modules_dev fi cd .. -cp -v ${PACKAGE}-${VERSION}* $HOME/rpmbuild/SOURCES +cp -v ${PACKAGE_SAFE}-${VERSION}* $HOME/rpmbuild/SOURCES popd > /dev/null rm -rf ${TMP_DIR} From a21e3d16f8963cad3009ad9e99edbbafc5ea327d Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 20 Jan 2021 09:19:40 -0500 Subject: [PATCH 28/72] nodejs-packaging-bundler improvements to handle uncommon characters Signed-off-by: Stephen Gallagher --- nodejs-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 62de0ca..a3b0fa4 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 2021.01 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -83,6 +83,9 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog +* 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 From ed5219fd68c9a1d47d5baa090418ba0d522f2422 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 26 Jan 2021 21:36:55 +0000 Subject: [PATCH 29/72] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_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 a3b0fa4..7362081 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 2021.01 -Release: 2%{?dist} +Release: 3%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -83,6 +83,9 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog +* 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 From 9074f546bfa6f900004f31cee4b6e8c7e89d6276 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 20 Apr 2021 19:48:39 +0000 Subject: [PATCH 30/72] Fix incorrect flag for fedpkg scratch-build --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f0c2a1a..cbad903 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Update the RPM spec %changelog appropriately. ## (Preferred) Perform a scratch-build on at least one architecture ``` -fedpkg scratch-build [--arches x86_64] --srpm +fedpkg scratch-build [--arch x86_64] --srpm ``` Verify that it built successfully. From 7aed687bf82aba641702ef87ef91e5b5dfc0b330 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 4 Mar 2021 14:49:35 -0500 Subject: [PATCH 31/72] bundler: Handle deprecated license metadata Adds support for archaic forms of the license metadata in package.json where the license field is an object rather than a string. Also removes the need to post-process the 'null' entries. Resolves: rhbz#1920206 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 8a1f83c..99da6d5 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -60,9 +60,9 @@ else mv node_modules/ node_modules_prod fi echo "LICENSES IN BUNDLE:" -find . -name "package.json" -exec jq .license {} \; >> ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt +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 find . -name "package.json" -exec jq '.licenses[] .type' {} \; >> ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt 2>/dev/null -sed -i "/^null$/d" ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt sort -u -o ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt echo " Downloading dev dependencies" npm install --no-optional --only=dev From e7b09b6fec593bc1aaa2620977dccfa02de79d66 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 4 Mar 2021 15:15:36 -0500 Subject: [PATCH 32/72] bundler: Add warning for deps missing license tag Resolves: rhbz#1920223 Signed-off-by: Stephen Gallagher --- nodejs-packaging-bundler | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index 99da6d5..e0b2c47 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -64,6 +64,17 @@ find . -name "package.json" -exec jq '.license | strings' {} \; >> ${TMP_DIR}/${ find . -name "package.json" -exec jq '.license | objects | .type' {} \; >> ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt 2>/dev/null find . -name "package.json" -exec jq '.licenses[] .type' {} \; >> ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt 2>/dev/null sort -u -o ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt ${TMP_DIR}/${PACKAGE_SAFE}-${VERSION}-bundled-licenses.txt + +# Locate any dependencies without a provided license +find . -type f -name package.json -execdir jq 'if .license==null and .licenses==null then .name else null end' '{}' '+' | grep -vE '^null$' | sort -u > ${TMP_DIR}/nolicense.txt + +if [ -s ${TMP_DIR}/nolicense.txt ]; then + echo -e "\e[5m\e[41mSome dependencies do not list a license. Manual verification required!\e[0m" + cat ${TMP_DIR}/nolicense.txt + echo -e "\e[5m\e[41m======================================================================\e[0m" +fi + + echo " Downloading dev dependencies" npm install --no-optional --only=dev if [ $? -ge 1 ] ; then From 2ab3684dd6fdacfc47e1aa1de5650a085e602646 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 4 Mar 2021 15:46:23 -0500 Subject: [PATCH 33/72] Spec: fix line-length for rpmlint Signed-off-by: Stephen Gallagher --- nodejs-packaging.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 7362081..87c7533 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -42,7 +42,8 @@ nodejs-packaging-bundler bundles a node.js application node_module dependencies It gathers the application tarball. It generates a runtime (prod) tarball with runtime node_module dependencies It generates a testing (dev) tarball with node_module dependencies for testing -It generates a bundled licence file that gets the licenses in the runtime dependency tarball +It generates a bundled license file that gets the licenses in the runtime +dependency tarball %prep pushd %{_topdir}/BUILD From bef475468ad69a9bff03e1db5da331344c2a1b02 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 2 Jun 2021 14:20:49 -0400 Subject: [PATCH 34/72] Update to 2021.06 bundler: Handle archaic license metadata bundler: Warn about bundled dependencies with no license metadata Signed-off-by: Stephen Gallagher --- nodejs-packaging.spec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 87c7533..1c08266 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.01 -Release: 3%{?dist} +Version: 2021.06 +Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -84,6 +84,11 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog +* 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 From 5385bed9507ac1e019c71170ee396506c62e74e0 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Tue, 22 Jun 2021 07:50:42 -0400 Subject: [PATCH 35/72] Actually use the value of OUTPUT_DIR when copying bundled sources in nodejs-packaging-bundler --- nodejs-packaging-bundler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index e0b2c47..8deecf6 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -90,6 +90,6 @@ if [ -d node_modules_dev ] ; then tar cfz ../${PACKAGE_SAFE}-${VERSION}-nm-dev.tgz node_modules_dev fi cd .. -cp -v ${PACKAGE_SAFE}-${VERSION}* $HOME/rpmbuild/SOURCES +cp -v ${PACKAGE_SAFE}-${VERSION}* "${OUTPUT_DIR}" popd > /dev/null rm -rf ${TMP_DIR} From fb332bd0eafdd5bc8aad8d93e4e3f62366f089a8 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Tue, 22 Jun 2021 07:52:34 -0400 Subject: [PATCH 36/72] In nodejs-packaging-bundler, use %{_sourcedir} for output Fixes RHBZ#1974709 --- nodejs-packaging-bundler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index 8deecf6..e18e7b2 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -1,5 +1,5 @@ #!/bin/bash -OUTPUT_DIR="${HOME}/rpmbuild/SOURCES" +OUTPUT_DIR="$(rpm -E '%{_sourcedir}')" usage() { echo "Usage `basename $0` [version] " >&2 From abab55a3635976034229bbe080557b767dc76e5c Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 22 Jun 2021 12:28:17 -0400 Subject: [PATCH 37/72] Fix hard-coded output directory in the bundler Signed-off-by: Stephen Gallagher --- nodejs-packaging.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 1c08266..9d3696c 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 2021.06 -Release: 1%{?dist} +Release: 2%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -39,7 +39,7 @@ Requires: coreutils, findutils, jq %description bundler nodejs-packaging-bundler bundles a node.js application node_module dependencies -It gathers the application tarball. +It gathers the application tarball. It generates a runtime (prod) tarball with runtime node_module dependencies It generates a testing (dev) tarball with node_module dependencies for testing It generates a bundled license file that gets the licenses in the runtime @@ -84,6 +84,9 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog +* 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 From d814f7439e41325eb0a31562446994ce16ad451a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 22 Jul 2021 16:13:42 +0000 Subject: [PATCH 38/72] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_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 9d3696c..a8ebf51 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 2021.06 -Release: 2%{?dist} +Release: 3%{?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 +* 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 From b1c10eec414f47dd3af80131d7f6b4d898fa570a Mon Sep 17 00:00:00 2001 From: josef radinger Date: Sun, 2 Jan 2022 19:51:00 +0000 Subject: [PATCH 39/72] fix typos --- nodejs-packaging-bundler | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nodejs-packaging-bundler b/nodejs-packaging-bundler index e18e7b2..5be05e1 100755 --- a/nodejs-packaging-bundler +++ b/nodejs-packaging-bundler @@ -8,7 +8,7 @@ usage() { 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 license list are copied to ${OUTPUT_DIR}" >&2 + echo " All three tarballs and the license list are copied to ${OUTPUT_DIR}" >&2 echo >&2 exit 1 } @@ -56,7 +56,7 @@ if [ $? -ge 1 ] ; then echo " ERROR WILL ROBINSON" rm -rf node_modules else - echo " Successful prod dependences download" + echo " Successful prod dependencies download" mv node_modules/ node_modules_prod fi echo "LICENSES IN BUNDLE:" @@ -80,7 +80,7 @@ npm install --no-optional --only=dev if [ $? -ge 1 ] ; then echo " ERROR WILL ROBINSON" else - echo " Successful dev dependences download" + echo " Successful dev dependencies download" mv node_modules/ node_modules_dev fi if [ -d node_modules_prod ] ; then From e24e7dff07b8b49949d102efaa6a6708c1c70f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Tue, 7 Dec 2021 16:22:49 +0100 Subject: [PATCH 40/72] nodejs.prov: find namespaced bundled dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous behaviour assumed that in a bundled package path, there is always `node_modules` directory on each other spot – i.e.: npm/node_modules//node_modules/ ^ ^ With namespaced bundled packages, this is no longer necessary the truth: npm/node_modules/@nmcli//node_modules/… ^ ! – expected node_modules --- The previous implementation considered any directory not named `node_modules` as a package directory, and tried to process it as such. Among other things, it pruned the list of subdirectories to be processed to just another `node_modules` subdir, if that existed. With namespaced packages, this pruning in essence happened too soon, and so they were skipped altogether. With this patch applied, only directories that directly contain the `package.json` file are processed as package directories, meaning that the walk should correctly descend into namespaces (even nested ones, if they appear). Resolves: rhbz#2029904 --- nodejs.prov | 6 +++--- .../node_modules/@nmcli/test201/package.json | 4 ++++ .../node_modules/test200/package.json | 4 ++++ test/bundled_namespace/nodejs.prov.err.exp | 0 test/bundled_namespace/nodejs.prov.out.exp | 3 +++ test/bundled_namespace/nodejs.req.err.exp | 0 test/bundled_namespace/nodejs.req.out.exp | 1 + test/bundled_namespace/package.json.in | 11 +++++++++++ test/run | 2 +- 9 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 test/bundled_namespace/node_modules/@nmcli/test201/package.json create mode 100644 test/bundled_namespace/node_modules/test200/package.json create mode 100644 test/bundled_namespace/nodejs.prov.err.exp create mode 100644 test/bundled_namespace/nodejs.prov.out.exp create mode 100644 test/bundled_namespace/nodejs.req.err.exp create mode 100644 test/bundled_namespace/nodejs.req.out.exp create mode 100644 test/bundled_namespace/package.json.in diff --git a/nodejs.prov b/nodejs.prov index 663d3d9..56a9bf1 100755 --- a/nodejs.prov +++ b/nodejs.prov @@ -93,9 +93,9 @@ def generate_dependencies(module_path, module_dir_set=NODE_MODULES): else: # Invalid metadata path raise ValueError("Invalid module path '%s'" % module_path) - for dir_path, subdir_list, __ in os.walk(root_dir): - # Currently in node_modules (or similar), continue to subdirs - if os.path.basename(dir_path) in module_dir_set: + for dir_path, subdir_list, file_list in os.walk(root_dir): + # We are only interested in directories that contain package.json + if "package.json" not in file_list: continue # Read and format metadata diff --git a/test/bundled_namespace/node_modules/@nmcli/test201/package.json b/test/bundled_namespace/node_modules/@nmcli/test201/package.json new file mode 100644 index 0000000..4618046 --- /dev/null +++ b/test/bundled_namespace/node_modules/@nmcli/test201/package.json @@ -0,0 +1,4 @@ +{ + "name": "@nmcli/test201", + "version": "2.1.4" +} diff --git a/test/bundled_namespace/node_modules/test200/package.json b/test/bundled_namespace/node_modules/test200/package.json new file mode 100644 index 0000000..92ab4ba --- /dev/null +++ b/test/bundled_namespace/node_modules/test200/package.json @@ -0,0 +1,4 @@ +{ + "name": "test200", + "version": "1.3.5" +} diff --git a/test/bundled_namespace/nodejs.prov.err.exp b/test/bundled_namespace/nodejs.prov.err.exp new file mode 100644 index 0000000..e69de29 diff --git a/test/bundled_namespace/nodejs.prov.out.exp b/test/bundled_namespace/nodejs.prov.out.exp new file mode 100644 index 0000000..cf9c17f --- /dev/null +++ b/test/bundled_namespace/nodejs.prov.out.exp @@ -0,0 +1,3 @@ +bundled(nodejs-@nmcli/test201) = 2.1.4 +bundled(nodejs-test200) = 1.3.5 +npm(test) = 4.5.6 diff --git a/test/bundled_namespace/nodejs.req.err.exp b/test/bundled_namespace/nodejs.req.err.exp new file mode 100644 index 0000000..e69de29 diff --git a/test/bundled_namespace/nodejs.req.out.exp b/test/bundled_namespace/nodejs.req.out.exp new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/bundled_namespace/nodejs.req.out.exp @@ -0,0 +1 @@ + diff --git a/test/bundled_namespace/package.json.in b/test/bundled_namespace/package.json.in new file mode 100644 index 0000000..e41f38b --- /dev/null +++ b/test/bundled_namespace/package.json.in @@ -0,0 +1,11 @@ +{ + "name": "test", + "version": "4.5.6", + "engines": { + "node": ">=6 <10" + }, + "dependencies": { + "test100": "^1.2.3", + "test101": ">=2.1" + } +} diff --git a/test/run b/test/run index 6afb356..7897b24 100755 --- a/test/run +++ b/test/run @@ -4,7 +4,7 @@ ln -sf nodejs.req nodejs_req.py "$(command -v python2 || echo :)" -m doctest nodejs_req.py || exit 1 "$(command -v python3 || echo :)" -m doctest nodejs_req.py || exit 1 -for test in unbundled bundled +for test in unbundled bundled bundled_namespace do sed -e "s|//.*$||" < test/$test/package.json.in > test/$test/package.json From 4847810bc1dc9d09811d991ac5bf39134e7df5ff Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 20 Jan 2022 08:08:17 -0500 Subject: [PATCH 41/72] NPM bundler: also find namespaced bundled dependencies Signed-off-by: Stephen Gallagher --- nodejs-packaging.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index a8ebf51..f3d843e 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -2,7 +2,7 @@ Name: nodejs-packaging Version: 2021.06 -Release: 3%{?dist} +Release: 4%{?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 +* 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 From 1e45404676929d80290c4218db442ab5f04e1295 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Sun, 1 May 2022 08:42:30 -0700 Subject: [PATCH 42/72] 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 43/72] 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 44/72] 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 45/72] 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 46/72] 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 47/72] 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 48/72] 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 49/72] 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 50/72] 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 51/72] 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 52/72] 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 53/72] 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 54/72] 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 55/72] 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 56/72] 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 57/72] 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 58/72] 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 59/72] 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 60/72] 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 61/72] 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 62/72] 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 63/72] 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 64/72] 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 65/72] 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 66/72] 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 67/72] 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 68/72] 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 69/72] 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 70/72] 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 71/72] 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 72/72] Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild