Bug 11028 - devtool: source and object files are packaged when building npm gyp project
Summary: devtool: source and object files are packaged when building npm gyp project
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 2.2
Hardware: x86 Multiple
: Medium normal
Target Milestone: Future
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks: 10653
  Show dependency tree
 
Reported: 2017-02-08 01:25 UTC by Henry Bruce
Modified: 2020-05-17 05:04 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Bruce 2017-02-08 01:25:28 UTC
gyp is used to build platform specific components of node.js projects. NPM will download and build native code, which is then unnecessarily packaged.

Steps to re-create
------------------
$ git clone -b morty git://git.yoctoproject.org/poky
$ git clone -b morty git://git.openembedded.org/meta-openembedded
$ source poky/oe-init-build-env
$ bitbake-layers add-layer ../meta-openembedded/meta-oe
$ devtool add 'npm://registry.npmjs.org;name=mraa;version=1.5.1'
$ devtool build mraa

Observe that entire source and build directories are packaged


Expected behavior
-----------------
Only required files are packages (e.g. package.json, native node.js files etc.)
Comment 1 Jean-Marie Lemetayer 2020-05-17 05:04:18 UTC
This is fixed in the master. Now all the generated files (object, static libraries) are removed. Only the generated *.node file is kept.

As there is no way to know if a file in the package (ie not generated) is actually needed or not, source files and other unneeded files (like binding.gyp) are still packaged.

If this is a real issue, I suggest to create a do_install_append() to remove them as this is package specific.

% devtool add 'npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=latest'
% devtool build savoirfairelinux-node-server-example
% tree tmp/work/core2-64-poky-linux/savoirfairelinux-node-server-example/1.0.1-r0/image/
tmp/work/core2-64-poky-linux/savoirfairelinux-node-server-example/1.0.1-r0/image/
└── usr
    ├── bin
    │   └── node-server-example -> ../lib/node_modules/@savoirfairelinux/node-server-example/index.js
    └── lib
        ├── node -> node_modules
        └── node_modules
            └── @savoirfairelinux
                └── node-server-example
                    ├── binding.gyp
                    ├── build
                    │   └── Release
                    │       └── hello.node
                    ├── hello.c
                    ├── index.js
                    ├── LICENSE
                    ├── ...