diff mbox series

[v2,1/2] bitbake: fetch: Fix BB_FETCH_PREMIRRORONLY for git mirror tarballs

Message ID 20250404121045.1133722-1-jhaller.oss@gmail.com
State Accepted, archived
Commit 1b1321f2b60c0a66159e3f20c6befcb0b3ccc4c7
Headers show
Series [v2,1/2] bitbake: fetch: Fix BB_FETCH_PREMIRRORONLY for git mirror tarballs | expand

Commit Message

Julian Haller April 4, 2025, 12:10 p.m. UTC
From: Julian Haller <julian.haller@philips.com>

When invoking the original git fetcher after downloading a mirror
tarball, BB_FETCH_PREMIRRORONLY is ignored. This leads to git fetch
commands targeting the upstream source being executed silently. Ensure
setting BB_NO_NETWORK before invoking the original fetcher. While this
was only observed for git, setting this in general for all fetcher
types makes sense at this location.
---
 bitbake/lib/bb/fetch2/__init__.py | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index e698fde19c..345b003efc 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1072,6 +1072,10 @@  def try_mirror_url(fetch, origud, ud, ld, check = False):
         # If that tarball is a local file:// we need to provide a symlink to it
         dldir = ld.getVar("DL_DIR")
 
+        if bb.utils.to_boolean(ld.getVar("BB_FETCH_PREMIRRORONLY")):
+            ld = ld.createCopy()
+            ld.setVar("BB_NO_NETWORK", "1")
+
         if origud.mirrortarballs and os.path.basename(ud.localpath) in origud.mirrortarballs and os.path.basename(ud.localpath) != os.path.basename(origud.localpath):
             # Create donestamp in old format to avoid triggering a re-download
             if ud.donestamp: