lib/oe/patch.py: Fix applying a directory as a patch

If a SRC_URI content ends with '.patch' bitbake is
trying to apply it as it's a patch file.

It causes that if we use git repository for 'patch' package
the bare clone is extracted to a directory
(i.e. build/downloads/git2/git.mirror.org.patch/) which is considered
to be a patch file, so patch.py tries to apply that directory as a patch
which ends up with a failure.

(From OE-Core rev: 1e38d74a2ca7638b1f54e2bb5617903c2683e484)

Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Tomasz Dziendzielski
2019-01-25 20:55:33 +01:00
committed by Richard Purdie
parent ad38a64a26
commit b73dc9f6f2

View File

@@ -793,6 +793,8 @@ def patch_path(url, fetch, workdir, expand=True):
"""Return the local path of a patch, or return nothing if this isn't a patch"""
local = fetch.localpath(url)
if os.path.isdir(local):
return
base, ext = os.path.splitext(os.path.basename(local))
if ext in ('.gz', '.bz2', '.xz', '.Z'):
if expand: