Fix npm to use https rather than http
PATCH 1/1 Fix npm to use https rather than http
Hit this error while building nlf-native recently:
{
"error": {
"summary": "URI malformed",
"detail": ""
}
}
Some poking about led me to discover that:
1) The npm.py tool replaces npm:// with http://, not https://
2) Some versions of the npm tool don't handle 301 redirects properly, choosing to display the above error instead when using the default nodejs registry
It would be good to go fix npm to handle the redirect properly, but it seems like it would also be good to assume secure http when contacting a registry, hence, this patch
--- bitbake/lib/bb/fetch2/npm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/npm.py +1 -1
@@ -156,7 +156,7 @@ class Npm(FetchMethod): raise ParameterError("Invalid 'version' parameter", ud.url) # Extract the 'registry' part of the url - ud.registry = re.sub(r"^npm://", "http://", ud.url.split(";")[0]) + ud.registry = re.sub(r"^npm://", "https://", ud.url.split(";")[0]) # Using the 'downloadfilename' parameter as local filename # or the npm package name.
Signature · 1 line
2.37.2
Hello Neil,
thank you for your patch.
bitbake/lib/bb/fetch2/npm.py
Quoted 24 lines · On Thu, 25 Aug 2022 16:42:50 -0400 "Neil Horman" <[email protected]> wrote:
Hit this error while building nlf-native recently:
{
"error": {
"summary": "URI malformed",
"detail": ""
}
}Some poking about led me to discover that:
1) Thenpm.pytool replaces npm:// with http://, not https://
2) Some versions of the npm tool don't handle 301 redirects properly, choosing to display the above error instead when using the default nodejs registryIt would be good to go fix npm to handle the redirect properly, but it seems like it would also be good to assume secure http when contacting a registry, hence, this patch
Signed-off-by Neil Horman <[email protected]>--- bitbake/lib/bb/fetch2/npm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bitbake/lib/bb/fetch2/npm.py +0
-0
Apparently you prepared this patch within the poky git repository. You shouldn't do that, poky is an integration layer and should not be used for bitbake development.
Since you want to patch bitbake, you should:
- clone the bitbake repository
- make your commit there
- send it to the bitbake mailing list.
Look at the README.md in the poky root directory for more info.
Thanks!
Best regards,
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 7 lines · Luca Ceresoli via lists.openembedded.org
Apparently you prepared this patch within the poky git repository. You shouldn't do that, poky is an integration layer and should not be used for bitbake development.
Quoted 6 lines
Since you want to patch bitbake, you should:
- clone the bitbake repository
- make your commit there
- send it to the bitbake mailing list.Look at the README.md in the poky root directory for more info.
FWIW, git is typically clever enough to handle this case. Feel free to post the patch you have against the poky repository directly to the bitbake mailing list.
Thanks,
Ross
Copy that, thanks!
Quoted 21 lines · Ross Burton
Quoted 2 lines
On 26 Aug 2022, at 11:43, Luca Ceresoli via lists.openembedded.org
Quoted 11 lines · <[email protected]> wrote:
Apparently you prepared this patch within the poky git repository. You shouldn't do that, poky is an integration layer and should not be used for bitbake development.
Since you want to patch bitbake, you should:
- clone the bitbake repository
- make your commit there
- send it to the bitbake mailing list.Look at the README.md in the poky root directory for more info.
FWIW, git is typically clever enough to handle this case. Feel free to post the patch you have against the poky repository directly to the bitbake mailing list.
Thanks,
Ross