bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] npmsw fetcher: Avoid instantiating Fetch class if url list is empty
@ 2023-04-17 21:12 Svend Meyland Nicolaisen
  2023-04-18 10:24 ` [bitbake-devel] " Luca Ceresoli
  0 siblings, 1 reply; 6+ messages in thread
From: Svend Meyland Nicolaisen @ 2023-04-17 21:12 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Svend Meyland Nicolaisen

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(-)

diff --git a/lib/bb/fetch2/npmsw.py b/lib/bb/fetch2/npmsw.py
index 36fcbfba..cc81100b 100644
--- a/lib/bb/fetch2/npmsw.py
+++ b/lib/bb/fetch2/npmsw.py
@@ -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
-- 
2.39.2.windows.1



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

* Re: [bitbake-devel] [PATCH] npmsw fetcher: Avoid instantiating Fetch class if url list is empty
  2023-04-17 21:12 [PATCH] npmsw fetcher: Avoid instantiating Fetch class if url list is empty Svend Meyland Nicolaisen
@ 2023-04-18 10:24 ` Luca Ceresoli
  2023-04-18 20:56   ` Svend Meyland Nicolaisen
  0 siblings, 1 reply; 6+ messages in thread
From: Luca Ceresoli @ 2023-04-18 10:24 UTC (permalink / raw)
  To: Svend Meyland Nicolaisen; +Cc: bitbake-devel

Hello Svend,

On Mon, 17 Apr 2023 23:12:28 +0200
"Svend Meyland Nicolaisen" <public@smn.dk> wrote:

> 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.

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

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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

* Re: [PATCH] npmsw fetcher: Avoid instantiating Fetch class if url list is empty
  2023-04-18 10:24 ` [bitbake-devel] " Luca Ceresoli
@ 2023-04-18 20:56   ` Svend Meyland Nicolaisen
  2023-04-19  7:46     ` [bitbake-devel] " Luca Ceresoli
  0 siblings, 1 reply; 6+ messages in thread
From: Svend Meyland Nicolaisen @ 2023-04-18 20:56 UTC (permalink / raw)
  To: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 439 bytes --]

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

* Re: [bitbake-devel] [PATCH] npmsw fetcher: Avoid instantiating Fetch class if url list is empty
  2023-04-18 20:56   ` Svend Meyland Nicolaisen
@ 2023-04-19  7:46     ` Luca Ceresoli
  0 siblings, 0 replies; 6+ messages in thread
From: Luca Ceresoli @ 2023-04-19  7:46 UTC (permalink / raw)
  To: Svend Meyland Nicolaisen; +Cc: bitbake-devel

Hi Svend,

On Tue, 18 Apr 2023 13:56:19 -0700
"Svend Meyland Nicolaisen" <public@smn.dk> wrote:

> 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

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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

* Re: [PATCH] npmsw fetcher: Avoid instantiating Fetch class if url list is empty
  2023-04-17  9:26 Michael Opdenacker
@ 2023-04-17 21:18 ` Svend Meyland Nicolaisen
  0 siblings, 0 replies; 6+ messages in thread
From: Svend Meyland Nicolaisen @ 2023-04-17 21:18 UTC (permalink / raw)
  To: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

Thank you for your replies. I had a hassle getting SMTP to work using gmail.com. Now I have sent the patch using "my own" smtp server, wonder why I didn't do that on the first attempts.....

Anyway the patch sent using git send-email ended up in this thread. Is that OK?

Kind regards,
Svend

[-- Attachment #2: Type: text/html, Size: 318 bytes --]

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

* [PATCH] npmsw fetcher: Avoid instantiating Fetch class if url list is empty
@ 2023-04-16 20:07 public
  0 siblings, 0 replies; 6+ messages in thread
From: public @ 2023-04-16 20:07 UTC (permalink / raw)
  To: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]

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
still 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.

Signed-off-by: Svend Meyland Nicolaisen <public@smn.dk>
---
lib/bb/fetch2/npmsw.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/npmsw.py b/lib/bb/fetch2/npmsw.py
index 36fcbfba..cc81100b 100644
--- a/lib/bb/fetch2/npmsw.py
+++ b/lib/bb/fetch2/npmsw.py
@@ -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
--
2.39.2.windows.1

[-- Attachment #2: Type: text/html, Size: 2072 bytes --]

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

end of thread, other threads:[~2023-04-19  7:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-17 21:12 [PATCH] npmsw fetcher: Avoid instantiating Fetch class if url list is empty Svend Meyland Nicolaisen
2023-04-18 10:24 ` [bitbake-devel] " Luca Ceresoli
2023-04-18 20:56   ` Svend Meyland Nicolaisen
2023-04-19  7:46     ` [bitbake-devel] " Luca Ceresoli
  -- strict thread matches above, loose matches on Subject: below --
2023-04-17  9:26 Michael Opdenacker
2023-04-17 21:18 ` Svend Meyland Nicolaisen
2023-04-16 20:07 public

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).