Bug 13901

Summary: npm build error when the shrinkwrap file has no dependencies
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Jean-Marie Lemetayer <jeanmarie.lemetayer>
Component: coreAssignee: Jean-Marie Lemetayer <jeanmarie.lemetayer>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, randy.macleod, tim.orling
Version: 5.99   
Target Milestone: 3.3 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Jean-Marie Lemetayer 2020-05-17 02:28:29 UTC
Preconditions/Environment
-------------------------
poky master
meta-oe master

Triggering Action/Cause
-----------------------
% devtool add 'npm://registry.npmjs.org;package=typescript;version=latest'
...

INFO: Recipe /home/jmlemetayer/yolo-yocto/build/workspace/recipes/typescript/typescript_3.9.2.bb has been automatically created; further editing may be required to make it fully functional

% devtool build typescript

NOTE: Starting bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)...
Loading cache...done.
Loaded 2300 entries from dependency cache.
Parsing recipes...ERROR: ExpansionError during parsing /home/jmlemetayer/yolo-yocto/build/workspace/recipes/typescript/typescript_3.9.2.bb
Traceback (most recent call last):
  File "/home/jmlemetayer/yolo-yocto/platform/poky/bitbake/lib/bb/data_smart.py", line 416, in DataSmart.expandWithRefs(s='${TUNE_FEATURES_tune-${DEFAULTTUNE}}', varname='TUNE_FEATURES'):
                     tb = sys.exc_info()[2]
    >                raise ExpansionError(varname, s, exc).with_traceback(tb) from exc

  File "/home/jmlemetayer/yolo-yocto/platform/poky/bitbake/lib/bb/data_smart.py", line 401, in DataSmart.expandWithRefs(s='${TUNE_FEATURES_tune-${DEFAULTTUNE}}', varname='TUNE_FEATURES'):
                 try:
    >                s = __expand_var_regexp__.sub(varparse.var_sub, s)
                     try:
  File "/home/jmlemetayer/yolo-yocto/platform/poky/bitbake/lib/bb/data_smart.py", line 97, in VariableParse.var_sub(match=<_sre.SRE_Match object; span=(21, 35), match='${DEFAULTTUNE}'>):
                         raise Exception("variable %s references itself!" % self.varname)
    >            var = self.d.getVarFlag(key, "_content")
                 self.references.add(key)
  File "/home/jmlemetayer/yolo-yocto/platform/poky/bitbake/lib/bb/data_smart.py", line 772, in DataSmart.getVarFlag(var='DEFAULTTUNE', flag='_content', expand=True, noweakdefault=False, parsing=False, retparser=False):
             if expand or retparser:
    >            parser = self.expandWithRefs(value, cachename)
             if expand:
  File "/home/jmlemetayer/yolo-yocto/platform/poky/bitbake/lib/bb/data_smart.py", line 396, in DataSmart.expandWithRefs(s='core2-64', varname='DEFAULTTUNE'):

    >        varparse = VariableParse(varname, self)

bb.data_smart.ExpansionError: Failure expanding variable TUNE_FEATURES, expression was ${TUNE_FEATURES_tune-${DEFAULTTUNE}} which triggered exception RecursionError: maximum recursion depth exceeded while calling a Python object


Summary: There was 1 ERROR message shown, returning a non-zero exit code.
ERROR: Failed to start bitbake environment


Expectation
-----------
The package should be build.

Actual Result
-------------
An error is raised.

This is because the shrinkwrap file has no dependencies. A workaround is to delete the 'npmsw://...' line in the generated .bb file.


Reproducibility
---------------
Always
Comment 1 Randy MacLeod 2021-01-14 16:11:08 UTC
There is a patch bootlin on the mailing list. Moving to M3.
Comment 2 Randy MacLeod 2021-04-29 19:11:06 UTC
Fixed by:
https://git.openembedded.org/openembedded-core/commit/?id=ef153ad36d0299e83a03af8f207686d0d8a238b3

and the test case:
$ devtool add 'npm://registry.npmjs.org;package=typescript;version=latest'
passed for me.
Comment 3 Randy MacLeod 2021-04-29 19:11:24 UTC
As per previous comment.