Commit graph

89 commits

Author SHA1 Message Date
Fedora Release Engineering
769c465c78 Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild 2026-07-16 09:39:21 +00:00
Jan Staněk
d5492bc305
Update tests from git 2026-02-04 14:42:48 +01:00
Daniel P. Berrangé
8c93ed1606 Always report the nodejs engine dep
The "has only bundled deps" check was short-circuiting logic too
early, causing the "nodejs(engine) == <ver>" dep to be missed,
which is still relevant even when bundling.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2026-02-04 13:40:50 +00:00
Daniel P. Berrangé
b786cecdf9 Honour package version when no tarball is given
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2026-02-03 15:57:41 +00:00
Daniel P. Berrangé
0a0c95bab7 Use --sort=name when creating tarballs
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é <berrange@redhat.com>
2026-02-03 15:57:41 +00:00
Daniel P. Berrangé
fdd68fbe2d Fix indentation mistakes in nodejs-packaging-bundler
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2026-02-03 15:57:41 +00:00
Fedora Release Engineering
aac86e3646 Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild 2026-01-16 22:12:26 +00:00
tjuhasz
4e33741bc9 Change %{nodejs_sitelib} to nonversion/shared path (rhbz#2404685) 2025-10-23 12:58:35 +02:00
Evgeni Golov
cd097f083d 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:
    <https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries>
    
It is generally reccomended to remove the entire "node_modules" directory in
%prep when it exists. For more information, see:
    <https://fedoraproject.org/wiki/Packaging:Node.js#Removing_bundled_modules>
    
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.
2025-09-02 11:43:02 +00:00
Ewoud Kohl van Wijngaarden
36224631ac 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.
2025-09-02 11:40:00 +00:00
Jan Staněk
64a93f15aa
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
2025-08-20 13:57:00 +02:00
Fedora Release Engineering
bbd74d8e40 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 22:53:57 +00:00
Jan Staněk
15aac7eeb8
Use %autochangelog macro
Fixup: 5c3231171a
2025-02-25 12:37:58 +01:00
Fedora Release Engineering
792f09d75d Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-17 20:15:35 +00:00
Fedora Release Engineering
d504fbf5e5 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-18 19:38:12 +00:00
Yaakov Selkowitz
4299cf9076 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
2024-06-21 15:18:06 -04:00
Fedora Release Engineering
72cb54ec6a Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-25 09:10:06 +00:00
Fedora Release Engineering
945b0837ce Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-21 09:48:26 +00:00
Stephen Gallagher
9b4f2a673f Restrict autoprovides and requires to top-level
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2023-10-26 10:04:04 -04:00
Stephen Gallagher
7e46ce796e Get autoprovides from any package.json
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2023-10-24 08:35:12 -04:00
Fedora Release Engineering
53bdaf5b75 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-20 16:47:03 +00:00
Stephen Gallagher
aacfe2f12b
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 <sgallagh@redhat.com>
2023-04-27 11:44:13 -04:00
Stephen Gallagher
5c3231171a
Update version and switch to rpmautospec
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2023-03-10 10:57:08 -05:00
Stephen Gallagher
1998d72b1a
Set correct %nodejs_sitelib path
Resolves: rhbz#2177117

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2023-03-10 10:37:32 -05:00
Stephen Gallagher
0cd3fed400
The Node.js ABI version is now represented by the NODE_MODULE_VERSION
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2023-03-10 10:09:57 -05:00
Stephen Gallagher
5079b893be
Bundler: Update to modern npm arguments
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2023-03-10 09:44:24 -05:00
Fedora Release Engineering
abc52b1e7b Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 21:42:02 +00:00
Stephen Gallagher
2a08691cf3
Move native module building tools here from Node.js
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2022-10-20 10:00:18 -04:00
53057fc311 nodejs-packaging-bundler: recursively bundle modules for all packages found 2022-10-18 19:54:26 -07:00
Fedora Release Engineering
3c8da6aa4e Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-22 00:41:14 +00:00
1e45404676 nodejs-packaging-bundler: optionally use a local tarball instead of npm 2022-07-02 09:08:17 -07:00
Stephen Gallagher
4847810bc1
NPM bundler: also find namespaced bundled dependencies
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2022-01-20 08:09:32 -05:00
Jan Staněk
e24e7dff07
nodejs.prov: find namespaced bundled dependencies
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/<dep1>/node_modules/<subdep>
    ^                   ^

With namespaced bundled packages, this is no longer necessary the truth:

npm/node_modules/@nmcli/<dep1>/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
2022-01-20 12:24:09 +01:00
josef radinger
b1c10eec41 fix typos 2022-01-02 19:51:00 +00:00
Fedora Release Engineering
d814f7439e - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-22 16:13:42 +00:00
Stephen Gallagher
abab55a363
Fix hard-coded output directory in the bundler
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2021-06-22 12:28:17 -04:00
Benjamin A. Beasley
fb332bd0ea In nodejs-packaging-bundler, use %{_sourcedir} for output
Fixes RHBZ#1974709
2021-06-22 07:52:40 -04:00
Benjamin A. Beasley
5385bed950 Actually use the value of OUTPUT_DIR when copying bundled sources in nodejs-packaging-bundler 2021-06-22 07:50:42 -04:00
Stephen Gallagher
bef475468a
Update to 2021.06
bundler: Handle archaic license metadata
bundler: Warn about bundled dependencies with no license metadata

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2021-06-02 14:21:55 -04:00
Stephen Gallagher
2ab3684dd6 Spec: fix line-length for rpmlint
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2021-06-02 18:17:12 +00:00
Stephen Gallagher
e7b09b6fec bundler: Add warning for deps missing license tag
Resolves: rhbz#1920223

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2021-06-02 18:17:12 +00:00
Stephen Gallagher
7aed687bf8 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 <sgallagh@redhat.com>
2021-06-02 18:17:12 +00:00
Stephen Gallagher
9074f546bf Fix incorrect flag for fedpkg scratch-build 2021-04-20 19:48:39 +00:00
Fedora Release Engineering
ed5219fd68 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 21:36:55 +00:00
Stephen Gallagher
a21e3d16f8
nodejs-packaging-bundler improvements to handle uncommon characters
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2021-01-20 09:19:40 -05:00
Michel Alexandre Salim
7d1699cedc
nodejs-packaging-bundler: sanitize package name
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 <michel@michel-slm.name>
2021-01-18 09:39:00 -08:00
Troy Dawson
05a9e58997 Fix null when there is no .licenses found.
Signed-off-by: Troy Dawson <tdawson@redhat.com>
2021-01-11 13:54:15 -08:00
Troy Dawson
5b7b3fce5d 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 <tdawson@redhat.com>
2021-01-08 09:39:42 -08:00
Stephen Gallagher
8de3f914f4 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 <sgallagh@redhat.com>
2020-09-18 15:50:14 -04:00
Stephen Gallagher
c68c968e27
Fix incorrect bundled library detection for Requires
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2020-09-02 10:52:07 -04:00