All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Jonas Andersson <jonaskgandersson@gmail.com>,
	paul eggleton <paul.eggleton@linux.intel.com>,
	Savoir-faire Linux Rennes <rennes@savoirfairelinux.com>,
	OE-core <openembedded-core@lists.openembedded.org>,
	bunk <bunk@stusta.de>
Subject: Re: [PATCH v3 00/17] NPM refactoring
Date: Fri, 22 Nov 2019 06:08:04 -0500 (EST)	[thread overview]
Message-ID: <2010614174.635763.1574420884655.JavaMail.zimbra@savoirfairelinux.com> (raw)
In-Reply-To: <50236bca804ff079db05b696f783c9af7e408c8f.camel@linuxfoundation.org>

Hi Richard,

On Nov 21, 2019, at 9:25 PM, Richard Purdie richard.purdie@linuxfoundation.org wrote:
> On Thu, 2019-11-21 at 14:53 -0500, Jean-Marie LEMETAYER wrote:
>> On Nov 21, 2019, at 7:26 PM, Richard Purdie
>> richard.purdie@linuxfoundation.org wrote:
>> > On Wed, 2019-11-20 at 10:33 +0100, Jean-Marie LEMETAYER wrote:
>> > > The current NPM support have several issues:
>> > >  - The current NPM fetcher downloads the dependency tree but not
>> > > the other
>> > >    fetchers. The 'subdir' parameter was used to fix this issue.
>> > >  - They are multiple issues with package names (uppercase, exotic
>> > > characters,
>> > >    scoped packages) even if they are inside the dependencies.
>> > >  - The lockdown file generation have issues. When a package
>> > > depends on
>> > >    multiple version of the same package (all versions have the
>> > > same checksum).
>> > > 
>> > > This patchset refactors the NPM support in Yocto:
>> > >  - As the NPM algorithm for dependency management is hard to
>> > > handle, the new
>> > >    NPM fetcher downloads only the package source (and not the
>> > > dependencies,
>> > >    like the other fetchers) (patch submitted in the bitbake-devel
>> > > list).
>> > 
>> > I'm a little confused by this item.
>> > 
>> > If the NPM fetcher only downloads a given package's source and it
>> > has
>> > dependencies, where/when are the dependencies downloaded?
>> > 
>> > My worry here is that if the fetcher isn't downloading them, DL_DIR
>> > can't contain all the needed pieces needed to reproduce a build at
>> > a
>> > later date?
>> > 
>> > I suspect I'm missing something obvious...
>> 
>> The magic is in the bbclass, in the do_fetch_append() function:
>> https://github.com/savoirfairelinux/poky/blob/npm-refactoring-v3/meta/classes/npm.bbclass#L51
>> 
>> Which calls:
>> https://github.com/savoirfairelinux/poky/blob/npm-refactoring-v3/bitbake/lib/bb/fetch2/npm.py#L312
>> 
>> Which runs the npm fetcher for each dependencies described in the
>> shrinkwrap file. This is the same behavior for the do_unpack task.
>> 
>> 
>> To be more clear, a recipe like this:
>> 
>> ```
>> SRC_URI = "npm://registry.npmjs.org/;name=my-package;version=1.0.0"
>> S = "${WORKDIR}/npm"
>> ```
>> 
>> Will only fetch/unpack the package source without handling the
>> dependencies.
>> 
>> But a recipe like this:
>> 
>> ```
>> SRC_URI = "npm://registry.npmjs.org/;name=my-package;version=1.0.0"
>> S = "${WORKDIR}/npm"
>> 
>> NPM_SHRINKWRAP = "${THISDIR}/${BPN}/npm-shrinkwrap.json"
>> inherit npm
>> ```
>> 
>> Will fetch/unpack the package and all the dependencies which are
>> described in the shrinkwrap file.
> 
> That does remove some of my worries, thanks for explaining!
> 
> It does make me wonder if we shouldn't have two fetch classes and then
> support a url like:
> 
> SRC_URI = "npm://registry.npmjs.org/;name=my-package;version=1.0.0 \
>           npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json"
> 
> where the "npmsw" handler would handle the shrinkwrap file?
> 
> Basically I don't like the way the current code has to tag the
> shrinkwrap file handling on to the fetcher...

This definitely sounds like a great idea !

I based my work on the current implementation, but I never thought of
refactoring as much. I have however some concerns about the management
of the registry and the development dependencies. I will try to come
back with a v4.

>> Bonus tips: you can have your base package SRC_URI using another
>> fetcher than npm (e.g. git) without breaking anything. The behavior
>> will still be the same.
> 
> That does start to make it clearer why this is advantageous.

Regards,
Jean-Marie


  reply	other threads:[~2019-11-22 11:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20  9:33 [PATCH v3 00/17] NPM refactoring Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 01/17] devtool: npm: update command line options Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 02/17] npm.bbclass: refactor the npm class Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 03/17] recipetool/create_npm.py: refactor the npm recipe creation handler Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 04/17] lib/oe/package.py: remove unneeded npm_split_package_dirs function Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 05/17] devtool/standard.py: npm: update the append file Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 06/17] recipetool/create.py: npm: remove the 'noverify' url parameter Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 07/17] recipetool/create.py: npm: replace the 'latest' keyword Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 08/17] npm.bbclass: split the do_compile task Jean-Marie LEMETAYER
2019-11-25 13:58   ` Ross Burton
2019-11-20  9:33 ` [PATCH v3 09/17] devtool/standard.py: npm: exclude the node_modules directory Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 10/17] recipetool/create_npm.py: handle the licenses of the dependencies Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 11/17] npm.bbclass: restrict the build to be offline Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 12/17] npm.bbclass: use the local node headers Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 13/17] recipetool/create_npm.py: convert the shrinkwrap file Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 14/17] npm.bbclass: force to rebuild the prebuild addons Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 15/17] devtool/standard.py: npm: configure the NPM_CACHE_DIR to be persistent Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 16/17] oeqa/selftest/recipetool: add npm recipe creation test Jean-Marie LEMETAYER
2019-11-20  9:33 ` [PATCH v3 17/17] oeqa/selftest/devtool: add npm recipe build test Jean-Marie LEMETAYER
2019-11-21  6:27 ` [PATCH v3 00/17] NPM refactoring Tim Orling
2019-11-21  6:36   ` Tim Orling
2019-11-21 13:21     ` Jean-Marie LEMETAYER
2019-11-21 14:07     ` André Draszik
2019-11-21 18:26 ` Richard Purdie
2019-11-21 19:53   ` Jean-Marie LEMETAYER
2019-11-21 20:25     ` Richard Purdie
2019-11-22 11:08       ` Jean-Marie LEMETAYER [this message]
2019-11-25 13:55         ` Ross Burton
2019-11-25 15:03           ` Jean-Marie LEMETAYER

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2010614174.635763.1574420884655.JavaMail.zimbra@savoirfairelinux.com \
    --to=jean-marie.lemetayer@savoirfairelinux.com \
    --cc=bunk@stusta.de \
    --cc=jonaskgandersson@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=paul.eggleton@linux.intel.com \
    --cc=rennes@savoirfairelinux.com \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.