npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json from remote location


TRO <thomas.roos@...>
 

Hi,
bitbake fetcher for npmsw - npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json
wondering if it is possible to download npm-shrinkwrap.json from remote before evaluating it's dependencies.
For instance - https, git.
Any ideas how to deal with that problem?
cheers Thomas


TRO <thomas.roos@...>
 

i did this:
addtask getsw after do_fetch before do_compile

python do_getsw() {
    import os
    bb.debug("downloading shrinkwrap file")
    os.system ("git archive --remote=ssh://git@... HEAD frontend/npm-shrinkwrap.json | tar -xO > /tmp/npm-shrinkwrap.json_dwnl")
    src_uri_sw = {'npmsw:///tmp/npm-shrinkwrap.json_dwnl;dev=True'}
    
    try:
        fetcher = bb.fetch2.Fetch(src_uri_sw, d)
        fetcher.download()
    except bb.fetch2.BBFetchException as e:
        bb.fatal(str(e))

    try:        
        fetcher.unpack(d.getVar('WORKDIR'))
    except bb.fetch2.BBFetchException as e:
        bb.fatal(str(e))
                
    bb.debug("src_uri: " + str(src_uri_sw))
}