[oe-commits] [openembedded-core] 09/69: devtool: add: delete externalsrc files on npm recipe do_install

git at git.openembedded.org git at git.openembedded.org
Wed Mar 23 14:25:57 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 766845e06db9d7d595e836ea1364c16fa132a413
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Mon Mar 21 18:14:04 2016 +1300

    devtool: add: delete externalsrc files on npm recipe do_install
    
    The npm class just installs whatever is in ${S}; if you're using
    externalsrc in conjunction with it the symlinks (oe-workdir and oe-logs
    by default) plus singletask.lock will end up in the final package, which
    isn't really right. Introduce a variable so we know the path the files
    will be installed into within npm.bbclass, and append to do_install
    within the workspace bbappend to delete the files.
    
    Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/npm.bbclass        |  6 ++++--
 scripts/lib/devtool/standard.py | 11 +++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index b5db99d..33ff5e3 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -1,6 +1,8 @@
 DEPENDS_prepend = "nodejs-native "
 S = "${WORKDIR}/npmpkg"
 
+NPM_INSTALLDIR = "${D}${libdir}/node_modules/${PN}"
+
 npm_do_compile() {
 	# changing the home directory to the working directory, the .npmrc will
 	# be created in this directory
@@ -14,8 +16,8 @@ npm_do_compile() {
 }
 
 npm_do_install() {
-	mkdir -p ${D}${libdir}/node_modules/${PN}/
-	cp -a ${S}/* ${D}${libdir}/node_modules/${PN}/ --no-preserve=ownership
+	mkdir -p ${NPM_INSTALLDIR}/
+	cp -a ${S}/* ${NPM_INSTALLDIR}/ --no-preserve=ownership
 }
 
 python populate_packages_prepend () {
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 7600a8f..9ac2ad5 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -238,6 +238,17 @@ def add(args, config, basepath, workspace):
             f.write('    rm -f ${D}/singletask.lock\n')
             f.write('}\n')
 
+        if bb.data.inherits_class('npm', rd):
+            f.write('do_install_append() {\n')
+            f.write('    # Remove files added to source dir by devtool/externalsrc\n')
+            f.write('    rm -f ${NPM_INSTALLDIR}/singletask.lock\n')
+            f.write('    rm -rf ${NPM_INSTALLDIR}/.git\n')
+            f.write('    rm -rf ${NPM_INSTALLDIR}/oe-local-files\n')
+            f.write('    for symlink in ${EXTERNALSRC_SYMLINKS} ; do\n')
+            f.write('        rm -f ${NPM_INSTALLDIR}/${symlink%%:*}\n')
+            f.write('    done\n')
+            f.write('}\n')
+
     _add_md5(config, recipename, appendfile)
 
     logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list