patch.py: add check for existing localpath
PATCH 1/1 patch.py: add check for existing localpath
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')
--- meta/lib/oe/patch.py | 2 ++ 1 file changed, 2 insertions(+)
meta/lib/oe/patch.py +2 -0
@@ -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))
Signature · 1 line
2.35.6
meta/lib/oe/patch.py def patch_path(url, fetch, unpackdir, expand=True): · line 893
Quoted 11 lines · Oleksiy Obitotskyy via lists.openembedded.org
Error example for this URL:
git://github.com/pkg/diff;name=diff;\
destsuffix=build/vendor/src/github.com/pkg/diff;branch=main;protocol=httpsmeta/lib/oe/patch.py +2
-0@@ -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