npmsw fetcher: Avoid instantiating Fetch class if url list is empty
PATCH 1/1 npmsw fetcher: Avoid instantiating Fetch class if url list is empty
Recipes containing both git and npmsw sources in the SRC_URI fail during fetch from the shrinkwrap. It seems that when the fetcher is fetching from the shrinkwrap, the SRCREV variable has been deleted but it till ends up fetching from the git source resulting in an error because SRCREV is undefined. The root cause of this is that the Fetch class defaults to urls from the SRC_URI when the urls parameter contains an empty list. This patch will ensure that Fetch is not instantiated if the urls list is empty.
--- lib/bb/fetch2/npmsw.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/bb/fetch2/npmsw.py +3 -1
@@ -205,7 +205,9 @@ class NpmShrinkWrap(FetchMethod): # This fetcher resolves multiple URIs from a shrinkwrap file and then # forwards it to a proxy fetcher. The management of the donestamp file, # the lockfile and the checksums are forwarded to the proxy fetcher. - ud.proxy = Fetch([dep["url"] for dep in ud.deps if dep["url"]], data) + shrinkwrap_urls = [dep["url"] for dep in ud.deps if dep["url"]] + if shrinkwrap_urls: + ud.proxy = Fetch(shrinkwrap_urls, data) ud.needdonestamp = False @staticmethod
Signature · 1 line
2.39.2.windows.1
Hello Svend,
Quoted 7 lines · On Mon, 17 Apr 2023 23:12:28 +0200 "Svend Meyland Nicolaisen" <[email protected]>…
Recipes containing both git and npmsw sources in the
SRC_URIfail during fetch from the shrinkwrap. It seems that when the fetcher is fetching from the shrinkwrap, the SRCREV variable has been deleted but it till ends up fetching from the git source resulting in an error because SRCREV is undefined. The root cause of this is that the Fetch class defaults to urls from theSRC_URIwhen the urls parameter contains an empty list. This patch will ensure that Fetch is not instantiated if the urls list is empty.
Thank you, looks much better now! I have sent the e-mail in appropriate ASCII so it can be applied with 'git am' here as Michael told you, and you fixed the commit title.
There are still a couple things you should improve (good news: those are easier).
From
https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded:
* All commit messages must include Signed-off-by (git commit -s)
* Please substitute "PATCH" with "PATCH v2" if you are submitting a revised version after addressing feedback (or v3, v4 etc.) (git commit -v<NUMBER>)
Can you resend with those fixed please?
Best regards,
Luca
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Hi Luca,
Thank you for your mail. I am sorry that I forgot the sign-off option the second time around. I have now sent the patch again including sign-off and tagged as PATCH v2.
I could however not get the -v option on git commit to work. As far as I can see the -v option means verbose. I used --subject-prefix on git send-email instead. I hope everything is OK now.
Kind regards,
Svend
Hi Svend,
Quoted 5 lines · On Tue, 18 Apr 2023 13:56:19 -0700 "Svend Meyland Nicolaisen" <[email protected]>…
Hi Luca,
Thank you for your mail. I am sorry that I forgot the sign-off option the second time around. I have now sent the patch again including sign-off and tagged as PATCH v2.
I could however not get the -v option on git commit to work. As far as I can see the -v option means verbose. I used --subject-prefix on git send-email instead. I hope everything is OK now.
Ah, sure, my mistake: the -v<N> option is for git format-patch, not git commit. Apologies.
Best regards,
Luca
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com