diff mbox series

patch.py: add check for existing localpath

Message ID 20260113101532.1505036-1-oobitots@cisco.com
State New
Headers show
Series patch.py: add check for existing localpath | expand

Commit Message

Oleksiy Obitotskyy Jan. 13, 2026, 10:15 a.m. UTC
All URLs from SRC checked to be a patch.
In some rare cases, when we have "diff" or
"patch" into URL it is treated as a patch not
like proper resource (e.g. repository).

In this specific case, the problem fixed with
git fetcher which behaves differently in case of
using mirrors. Without pre-downloaded repository
archive we have directory into downloads and exit
from patch_path. As a workaround, we check if the
patch file exists.

Error example for this URL:
git://github.com/pkg/diff;name=diff;\
destsuffix=build/vendor/src/github.com/pkg/diff;branch=main;protocol=https

ERROR: nativesdk-yq-4.30.8+gitdd6cf3df146f3e2c0f8c765a6ef9e35780ad8cc1-r0 do_patch: \
Importing patch 'github.com.pkg.diff' with striplevel '1'
FileNotFoundError(2, 'No such file or directory')

Signed-off-by: Oleksiy Obitotskyy <oobitots@cisco.com>
---
 meta/lib/oe/patch.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alexander Kanavin Jan. 13, 2026, 11:44 a.m. UTC | #1
On Tue, 13 Jan 2026 at 11:16, Oleksiy Obitotskyy via
lists.openembedded.org <oobitots=cisco.com@lists.openembedded.org>
wrote:
> Error example for this URL:
> git://github.com/pkg/diff;name=diff;\
> destsuffix=build/vendor/src/github.com/pkg/diff;branch=main;protocol=https
> --- a/meta/lib/oe/patch.py
> +++ b/meta/lib/oe/patch.py
> @@ -889,6 +889,8 @@ def patch_path(url, fetch, unpackdir, expand=True):
>      """Return the local path of a patch, or return nothing if this isn't a patch"""
>
>      local = fetch.localpath(url)
> +    if not os.path.exists(local):
> +        return

This does look like a workaround. Can you look into how the decision
to call patch_path on this URL is made, and if we can tighten the
check for whether it is a patch there? Perhaps change it to only
consider something that has .diff at the end?

Alex
diff mbox series

Patch

diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 246fc6221f..30462ef1ad 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -889,6 +889,8 @@  def patch_path(url, fetch, unpackdir, expand=True):
     """Return the local path of a patch, or return nothing if this isn't a patch"""
 
     local = fetch.localpath(url)
+    if not os.path.exists(local):
+        return
     if os.path.isdir(local):
         return
     base, ext = os.path.splitext(os.path.basename(local))