<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>11028</bug_id>
          
          <creation_ts>2017-02-08 01:25:28 +0000</creation_ts>
          <short_desc>devtool: source and object files are packaged when building npm gyp project</short_desc>
          <delta_ts>2020-05-17 05:04:18 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>2.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Future</target_milestone>
          
          <blocked>10653</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Henry Bruce">henry.bruce</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>bluelightning</cc>
    
    <cc>jeanmarie.lemetayer</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>70522</commentid>
    <comment_count>0</comment_count>
    <who name="Henry Bruce">henry.bruce</who>
    <bug_when>2017-02-08 01:25:28 +0000</bug_when>
    <thetext>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 &apos;npm://registry.npmjs.org;name=mraa;version=1.5.1&apos;
$ 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.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87224</commentid>
    <comment_count>1</comment_count>
    <who name="Jean-Marie Lemetayer">jeanmarie.lemetayer</who>
    <bug_when>2020-05-17 05:04:18 +0000</bug_when>
    <thetext>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 &apos;npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=latest&apos;
% 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 -&gt; ../lib/node_modules/@savoirfairelinux/node-server-example/index.js
    └── lib
        ├── node -&gt; node_modules
        └── node_modules
            └── @savoirfairelinux
                └── node-server-example
                    ├── binding.gyp
                    ├── build
                    │   └── Release
                    │       └── hello.node
                    ├── hello.c
                    ├── index.js
                    ├── LICENSE
                    ├── ...</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>