All of lore.kernel.org
 help / color / mirror / Atom feed
* Improving npm(sw) fetcher & integration within Bitbake
@ 2021-11-04 12:29 Jasper Orschulko
  2021-11-04 13:09 ` [bitbake-devel] " Alexander Kanavin
  2021-11-04 23:15 ` Richard Purdie
  0 siblings, 2 replies; 16+ messages in thread
From: Jasper Orschulko @ 2021-11-04 12:29 UTC (permalink / raw)
  To: bitbake-devel; +Cc: martin, Daniel Baumgart

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dear Bitbake developers,

recently we have been looking at the npmsw fetcher and discovered some
challenges regarding the integration into the developer workflow as
well as the build times within Bitbake. We believe that we found a
mechanism which would integrate well into Bitbake's existing project
structure and drastically improve the situation.


But first, what are the issues with the current npmsw fetcher?

1. Let's have a look at a typical npm-based project. You'd typically
have your package-lock.json (aka shrinkwrap file) stored within the git
repository containing your source code. Developers will rely on this
package-lock file on a daily basis during the development cycle.
Unfortunately, the current npmsw fetcher only supports shrinkwrap files
stored within the meta layer or within an npm registry. This is not
ideal, as changes to the file might be made within the project repo,
which then need to be manually applied to the lock file within the meta
repo. An ideal npmsw fetcher therefore would support using the lock
file directly from the source code repo. 

2. The current implementation of the npm class uses multiple shellouts
per npm module in order to add these to the npm cache. This is done, as
the `npm install` command is not called within the do_fetch, but at the
end of the do_configure step. This drastically increases the time
Bitbake spends in the do_configure step for a npm based recipe. In our
case (we have a relatively small project with approx. 600 npm packages
in total, including recursive packages) this takes ~100 minutes to
complete. What makes things worse, every change to the recipe and/or
lock file will cause a complete rerun of the do_configure job.

As a result, the npm fetcher currently is not really usable for
production workloads.


So how can we address these issues?

We plan to implement a "sub-fetcher" for npmsw (a concept which might
also be recyclable for similar use-cases). This would take the
form of e.g.:

SRC_URI = "npmsw+git://git-uri.git;npm-topdir=path_to_npm_project;..."

The idea is, that the npsw fetcher would then call an arbitrary sub-
fetcher (in this case git, however any fetcher will be supported) and
after the sub-fetcher has extracted the source code into the DL_DIR,
the npm fetcher will create a secondary download folder as a copy of
the sub-fetchers download folder. Within this copy, the npm fetcher
will call `npm ci`, effectively downloading the npm packages by doing a
clean-install on the basis of the package.json and the package-
lock.json files within the npmsw download dir. This results in a much
faster build, as it removes the need for seperate handling of the
individual node packages, as well as streamlining the developers
workflow with the build process within Bitbake.

As this fetcher would be implemented separately from the current npmsw
fetcher, this will not cause any breaking changes for existing setups.

Additionally, we plan on writing a separate npmsw.bbclass, which will
parse the package.json for each node module for an automated Bitbake
license manifest generation, which will resolve the current challenge
of having to maintain these manually, as currently described at
https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#npm-using-the-registry-modules-method
.

If this is something you see as a worthwhile goal, we will provide a
set of patch files within the coming weeks.

- -- 
With best regards

Jasper Orschulko
DevOps Engineer

Tel. +49 30 58 58 14 265
Fax +49 30 58 58 14 999
Jasper.Orschulko@iris-sensing.com

• • • • • • • • • • • • • • • • • • • • • • • • • •

iris-GmbH
infrared & intelligent sensors
Schnellerstraße 1-5 | 12439 Berlin

https://iris-sensing.com/




-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE4WyPMIC5Ap4+Ooo1Ygqew07VMNUFAmGD0jsACgkQYgqew07V
MNVa1Qf+MwrlwXeS+FI8JrtHdTJ5CNJ64DkiTe0Tgqb7SQVkawXlm6KPezBYFIZb
HmAruV8vpQpUHkyKXpwuH4X0A2CO3jJ9v20H3sdRfL+33gSCOY9+LDOADlRf1MhT
fkV+OqwYufwG02ZnOpF3YRcTiDfG9UEzM+lzArOzhY6GjMp4FxvQZ/xLjEvdGVJ1
l3h3NPmsedqsJnal022wkPi2gN2ZCQPyIw11EJL929wqwPHudvqj8OX2q1JhDUn5
vjRpN2l4yg6g8bpF1If+5YkT/ZVjrZqcleL9pYPpVOuqk+j/iWbPSTmXjvzsrKDL
1UWqTBtRmWMYH+xkjKxD7Spjz1scRA==
=qjQA
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-11-11  7:51 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 12:29 Improving npm(sw) fetcher & integration within Bitbake Jasper Orschulko
2021-11-04 13:09 ` [bitbake-devel] " Alexander Kanavin
2021-11-06 16:58   ` Mike Crowe
2021-11-08  8:01     ` Stefan Herbrechtsmeier
2021-11-08 12:44       ` Jasper Orschulko
2021-11-11  7:51         ` Stefan Herbrechtsmeier
2021-11-04 23:15 ` Richard Purdie
2021-11-05  9:07   ` Stefan Herbrechtsmeier
2021-11-05 11:24     ` Jean-Marie Lemetayer
2021-11-05 16:02       ` Jasper Orschulko
2021-11-05 17:42         ` Alexander Kanavin
     [not found]         ` <5fb67154d576b74629e4836a86dcb5e479b73e67.camel@linuxfoundation.org>
2021-11-06 10:30           ` Konrad Weihmann
2021-11-08  7:41           ` Stefan Herbrechtsmeier
2021-11-08  7:59             ` Alexander Kanavin
     [not found]     ` <4106f9ef-5b2e-5276-f1bb-c80a989d7fdf@mko.dev>
2021-11-05 11:12       ` Martin Koppehel
2021-11-05 13:16       ` Stefan Herbrechtsmeier

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.