Skip to contentSkip to conversation

bitbake: fetch2/npmsw: Check if there are dependencies before trying to fetch them

PATCH New [email protected] 1 participant 1 message Jul 20, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake: fetch2/npmsw: Check if there are dependencies before trying to fetch them

From: BELOUARGA Mohamed <[email protected]>

When there are no dependencies, _foreach_proxy_method does not verify that there are dependencies to fetch before fetching them.

---
 lib/bb/fetch2/npmsw.py | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
lib/bb/fetch2/npmsw.py +9 -7
index 971ccc9050..4ff2c8ffc3 100644
@@ -225,13 +225,15 @@ class NpmShrinkWrap(FetchMethod):
     @staticmethod
     def _foreach_proxy_method(ud, handle):
         returns = []
-        for proxy_url in ud.proxy.urls:
-            proxy_ud = ud.proxy.ud[proxy_url]
-            proxy_d = ud.proxy.d
-            proxy_ud.setup_localpath(proxy_d)
-            lf = lockfile(proxy_ud.lockfile)
-            returns.append(handle(proxy_ud.method, proxy_ud, proxy_d))
-            unlockfile(lf)
+        #Check if there are dependencies before try to fetch them
+        if len(ud.deps) > 0:
+            for proxy_url in ud.proxy.urls:
+                proxy_ud = ud.proxy.ud[proxy_url]
+                proxy_d = ud.proxy.d
+                proxy_ud.setup_localpath(proxy_d)
+                lf = lockfile(proxy_ud.lockfile)
+                returns.append(handle(proxy_ud.method, proxy_ud, proxy_d))
+                unlockfile(lf)
         return returns
 
     def verify_donestamp(self, ud, d):
Signature · 1 line
2.25.1