Skip to contentSkip to conversation

fetch2: try_mirror_url(): Skip invalid local url

PATCH Superseded [email protected] 1 participant 3 messages Aug 11, 2025 – Aug 12, 2025

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover fetch2: try_mirror_url(): Skip invalid local url

From: Robert Yang <[email protected]>

* V2
- Move the code to try_mirror_url() as Alex suggested
- Add more commit messages.

* V1
- Initial version

// Robert

The following changes since commit 3b2f9c31dc17c3ba5f6a9971413afed3d450d826:

poky.yaml.in: increase required disk space to 140G (2025-08-08 23:41:11 +0100)

are available in the Git repository at:

https://github.com/robertlinux/bitbake rbt/mirror
https://github.com/robertlinux/bitbake/tree/rbt/mirror

Robert Yang (1):
fetch2: try_mirror_url(): Skip invalid local url

 bitbake/lib/bb/fetch2/__init__.py | 4 ++++
 1 file changed, 4 insertions(+)
Signature · 1 line
2.49.0
#1 lore raw

PATCH v2 1/1 fetch2: try_mirror_url(): Skip invalid local url

From: Robert Yang <[email protected]>

There can be multiple PREMIRRORs each PREMIRROR contains specifics sources for each layer, each recipe will try the PREMIRRORs one by one until succeed, but the trying would be failed if the PREMIRROR doesn't contain the required sources, so return it immediately to make log.do_fetch clean, and tt also can fix a warning when BB_GIT_SHALLOW and is enabled and failed to fetch the source from the PREMIRROR:

Fast shallow clone failed, try to skip fast mode now.

---
 bitbake/lib/bb/fetch2/__init__.py | 4 ++++
 1 file changed, 4 insertions(+)
bitbake/lib/bb/fetch2/__init__.py +4 -0
index 0ad987c596..1bab8f7f57 100644
@@ -1067,6 +1067,10 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
     # Return of None or a value means we're finished
     # False means try another url
 
+    # Skip fetching it when the local url's path doesn't exist
+    if ud.parm.get('protocol', '') == 'file' and not os.path.exists(ud.path):
+        return False
+
     if ud.lockfile and ud.lockfile != origud.lockfile:
         lf = bb.utils.lockfile(ud.lockfile)
 
Signature · 1 line
2.49.0
#2 lore raw
Quoted 21 lines · Robert Yang via lists.openembedded.org

From: Robert Yang <[email protected]>

There can be multiple PREMIRRORs each PREMIRROR contains specifics sources for each layer, each recipe will try the PREMIRRORs one by one until succeed, but the trying would be failed if the PREMIRROR doesn't contain the required sources, so return it immediately to make log.do_fetch clean, and tt also can fix a warning when BB_GIT_SHALLOW and is enabled and failed to fetch the source from the PREMIRROR:

Fast shallow clone failed, try to skip fast mode now.

---
  bitbake/lib/bb/fetch2/__init__.py | 4 ++++
  1 file changed, 4 insertions(+)
bitbake/lib/bb/fetch2/__init__.py +0 -0
index 0ad987c596..1bab8f7f57 100644

bitbake/lib/bb/fetch2/__init__.py def try_mirror_url(fetch, origud, ud, ld, check = False): · line 1071

Quoted 5 lines
bitbake/lib/bb/fetch2/__init__.py +2 -0
@@ -1067,6 +1067,10 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
      # Return of None or a value means we're finished
      # False means try another url
 
+    # Skip fetching it when the local url's path doesn't exist
+    if ud.parm.get('protocol', '') == 'file' and not os.path.exists(ud.path):

Sorry, this patch is incorrect, I need check repo and repo.git because git works with or without .git suffix. Will send a V3 for it.

// Robert

Quoted 15 lines
bitbake/lib/bb/fetch2/__init__.py +2 -1
+        return False
+>       if ud.lockfile and ud.lockfile != origud.lockfile:
          lf = bb.utils.lockfile(ud.lockfile)
 
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#17861): https://lists.openembedded.org/g/bitbake-devel/message/17861
Mute This Topic: https://lists.openembedded.org/mt/114649737/7304958
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-