Commit graph

3 commits

Author SHA1 Message Date
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
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
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