diff mbox series

nodejs-oe-cache: fix offline install of dependencies

Message ID 20240503094232.2114574-1-martin@geanix.com
State Accepted
Headers show
Series nodejs-oe-cache: fix offline install of dependencies | expand

Commit Message

Martin Hundebøll May 3, 2024, 9:42 a.m. UTC
Apparently, npm has changed its request accept header, so that cache
lookup misses. This causes an ENOTCACHED error when doing the offline
install in do_compile() from npm.bbclass.

Fix it by updating the fake cache entry to match the newest behaviour
from npm.

Note that npm doesn't agree with itself, as it still uses the previous
header value when doing `npm cache add <pkg>`, but the new value when
doing `npm install <pkg>`.

Bug submitted upstream:
https://github.com/npm/cli/issues/7465

Signed-off-by: Martin Hundebøll <martin@geanix.com>
---
 .../recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Hundebøll May 3, 2024, 9:44 a.m. UTC | #1
Sorry, forgot the [meta-oe] prefix.

// Martin

On Fri, 2024-05-03 at 11:42 +0200, Martin Hundebøll wrote:
> Apparently, npm has changed its request accept header, so that cache
> lookup misses. This causes an ENOTCACHED error when doing the offline
> install in do_compile() from npm.bbclass.
> 
> Fix it by updating the fake cache entry to match the newest behaviour
> from npm.
> 
> Note that npm doesn't agree with itself, as it still uses the
> previous
> header value when doing `npm cache add <pkg>`, but the new value when
> doing `npm install <pkg>`.
> 
> Bug submitted upstream:
> https://github.com/npm/cli/issues/7465
> 
> Signed-off-by: Martin Hundebøll <martin@geanix.com>
> ---
>  .../recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache  | 2
> +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-
> 20.12/oe-npm-cache b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-
> 20.12/oe-npm-cache
> index f59620764..eb0f143ea 100755
> --- a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-
> cache
> +++ b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-
> cache
> @@ -30,7 +30,7 @@ const xlate = {
>  		time: Date.now(),
>  		url:  key,
>  		reqHeaders: {
> -		    'accept': 'application/vnd.npm.install-v1+json;
> q=1.0, application/json; q=0.8, */*',
> +		    'accept': 'application/json',
>  		},
>  		resHeaders: {
>  		    "content-type": "application/json",
Martin Jansa May 3, 2024, 9:51 a.m. UTC | #2
Thanks, perfect timing, I've just sent e-mail reply to nodejs upgrade
that npm-10.5.0 upgrade broke this. Will test your change now. Thanks!

On Fri, May 3, 2024 at 11:42 AM Martin Hundeb?ll via
lists.openembedded.org <martin=geanix.com@lists.openembedded.org>
wrote:
>
> Apparently, npm has changed its request accept header, so that cache
> lookup misses. This causes an ENOTCACHED error when doing the offline
> install in do_compile() from npm.bbclass.
>
> Fix it by updating the fake cache entry to match the newest behaviour
> from npm.
>
> Note that npm doesn't agree with itself, as it still uses the previous
> header value when doing `npm cache add <pkg>`, but the new value when
> doing `npm install <pkg>`.
>
> Bug submitted upstream:
> https://github.com/npm/cli/issues/7465
>
> Signed-off-by: Martin Hundebøll <martin@geanix.com>
> ---
>  .../recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache  | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache
> index f59620764..eb0f143ea 100755
> --- a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache
> +++ b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache
> @@ -30,7 +30,7 @@ const xlate = {
>                 time: Date.now(),
>                 url:  key,
>                 reqHeaders: {
> -                   'accept': 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*',
> +                   'accept': 'application/json',
>                 },
>                 resHeaders: {
>                     "content-type": "application/json",
> --
> 2.44.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#110244): https://lists.openembedded.org/g/openembedded-devel/message/110244
> Mute This Topic: https://lists.openembedded.org/mt/105884883/3617156
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Martin Jansa May 3, 2024, 12:43 p.m. UTC | #3
On Fri, May 3, 2024 at 11:52 AM Martin Jansa via
lists.openembedded.org <martin.jansa=gmail.com@lists.openembedded.org>
wrote:
>
> Thanks, perfect timing, I've just sent e-mail reply to nodejs upgrade
> that npm-10.5.0 upgrade broke this. Will test your change now. Thanks!

And it works for me, thanks again.

Cheers,
Martin Hundebøll May 6, 2024, 7:15 a.m. UTC | #4
Hi Khem,

Please pick this patch for scarthgap too.

Thanks,
Martin

On Fri, 2024-05-03 at 11:42 +0200, Martin Hundebøll wrote:
> Apparently, npm has changed its request accept header, so that cache
> lookup misses. This causes an ENOTCACHED error when doing the offline
> install in do_compile() from npm.bbclass.
> 
> Fix it by updating the fake cache entry to match the newest behaviour
> from npm.
> 
> Note that npm doesn't agree with itself, as it still uses the
> previous
> header value when doing `npm cache add <pkg>`, but the new value when
> doing `npm install <pkg>`.
> 
> Bug submitted upstream:
> https://github.com/npm/cli/issues/7465
> 
> Signed-off-by: Martin Hundebøll <martin@geanix.com>
> ---
>  .../recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache  | 2
> +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-
> 20.12/oe-npm-cache b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-
> 20.12/oe-npm-cache
> index f59620764..eb0f143ea 100755
> --- a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-
> cache
> +++ b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-
> cache
> @@ -30,7 +30,7 @@ const xlate = {
>  		time: Date.now(),
>  		url:  key,
>  		reqHeaders: {
> -		    'accept': 'application/vnd.npm.install-v1+json;
> q=1.0, application/json; q=0.8, */*',
> +		    'accept': 'application/json',
>  		},
>  		resHeaders: {
>  		    "content-type": "application/json",
Khem Raj May 6, 2024, 2:37 p.m. UTC | #5
+Armin. as Armin is already preparing first batch of changes for scarthgap.

On Mon, May 6, 2024 at 12:15 AM Martin Hundeb?ll via
lists.openembedded.org <martin=geanix.com@lists.openembedded.org>
wrote:
>
> Hi Khem,
>
> Please pick this patch for scarthgap too.
>
> Thanks,
> Martin
>
> On Fri, 2024-05-03 at 11:42 +0200, Martin Hundebøll wrote:
> > Apparently, npm has changed its request accept header, so that cache
> > lookup misses. This causes an ENOTCACHED error when doing the offline
> > install in do_compile() from npm.bbclass.
> >
> > Fix it by updating the fake cache entry to match the newest behaviour
> > from npm.
> >
> > Note that npm doesn't agree with itself, as it still uses the
> > previous
> > header value when doing `npm cache add <pkg>`, but the new value when
> > doing `npm install <pkg>`.
> >
> > Bug submitted upstream:
> > https://github.com/npm/cli/issues/7465
> >
> > Signed-off-by: Martin Hundebøll <martin@geanix.com>
> > ---
> >  .../recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache  | 2
> > +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-
> > 20.12/oe-npm-cache b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-
> > 20.12/oe-npm-cache
> > index f59620764..eb0f143ea 100755
> > --- a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-
> > cache
> > +++ b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-
> > cache
> > @@ -30,7 +30,7 @@ const xlate = {
> >               time: Date.now(),
> >               url:  key,
> >               reqHeaders: {
> > -                 'accept': 'application/vnd.npm.install-v1+json;
> > q=1.0, application/json; q=0.8, */*',
> > +                 'accept': 'application/json',
> >               },
> >               resHeaders: {
> >                   "content-type": "application/json",
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#110259): https://lists.openembedded.org/g/openembedded-devel/message/110259
> Mute This Topic: https://lists.openembedded.org/mt/105884883/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Geoff Parker May 13, 2024, 6:57 a.m. UTC | #6
When is the expected next update to the scarthgap branch? I've watched the patch move from  master-next  to  master, but there does not seem to be a visible scarthgap-next branch to watch.
Khem Raj May 13, 2024, 4:48 p.m. UTC | #7
On Sun, May 12, 2024 at 11:57 PM Geoff Parker via
lists.openembedded.org <geoffhp=gmail.com@lists.openembedded.org>
wrote:
>
> When is the expected next update to the scarthgap branch? I've watched the patch move from  master-next  to  master, but there does not seem to be a visible scarthgap-next branch to watch.

Usually there is a monthly release update to stable branches that
Armin queues up in contrib repo e.g.

https://git.openembedded.org/meta-openembedded-contrib/log/?h=stable/scarthgap-nut

eventually when this branch is gone through some level of testing, it
is proposed to upstream
branch via scarthgap-next in main repo.

> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#110334): https://lists.openembedded.org/g/openembedded-devel/message/110334
> Mute This Topic: https://lists.openembedded.org/mt/105884883/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Geoff Parker May 14, 2024, 5:39 p.m. UTC | #8
Thanks Khem for the link to openembedded-contrib and information on
how scarthgap updates
are staged. However,  I'm not seeing the nodejs-os-cache commit in the
stable/scarthgap-nut
branch which is needed to fix nodejs builds on scarthgap also. Are
recent fixes in
meta-openembedded master backported also?

cc: Armin

On Mon, May 13, 2024 at 9:48 AM Khem Raj <raj.khem@gmail.com> wrote:
>
> On Sun, May 12, 2024 at 11:57 PM Geoff Parker via
> lists.openembedded.org <geoffhp=gmail.com@lists.openembedded.org>
> wrote:
> >
> > When is the expected next update to the scarthgap branch? I've watched the patch move from  master-next  to  master, but there does not seem to be a visible scarthgap-next branch to watch.
>
> Usually there is a monthly release update to stable branches that
> Armin queues up in contrib repo e.g.
>
> https://git.openembedded.org/meta-openembedded-contrib/log/?h=stable/scarthgap-nut
>
> eventually when this branch is gone through some level of testing, it
> is proposed to upstream
> branch via scarthgap-next in main repo.
>
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#110334): https://lists.openembedded.org/g/openembedded-devel/message/110334
> > Mute This Topic: https://lists.openembedded.org/mt/105884883/1997914
> > Group Owner: openembedded-devel+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache
index f59620764..eb0f143ea 100755
--- a/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache
+++ b/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-20.12/oe-npm-cache
@@ -30,7 +30,7 @@  const xlate = {
 		time: Date.now(),
 		url:  key,
 		reqHeaders: {
-		    'accept': 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*',
+		    'accept': 'application/json',
 		},
 		resHeaders: {
 		    "content-type": "application/json",