There are situration when the user have the 'patchdir' defined
as a parameter on SRC_URI. However he doesn't know with this,
the patch is applied relatively to the receipe source dir 'S'.

When user have 'patchdir' defined check if this directory exist.
If the patch fails show addition info to the user:
 * Import: show the striplevel
 * Resolver: show the expanded 'patchdir' to the user.

On the next example, the patch is applied on ${WORKDIR}/contrib.

S = "${WORKDIR}/git"
SRCREV_FORMAT = "opencv_contrib"
SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \
           
git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib \
           file://0001-sfm-link-with-Glog_LIBS.patch;patchdir=../contrib \
           "

But if the user specifies a path on 'patchdir' that don't exist,
(patchdir=../no-found-on-file-system) the patch will fail and there
are no message that indicates the real cause.

Signed-off-by: Jose Quaresma <[email protected]>
---
 meta/classes/patch.bbclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 388773a237..30753dc65b 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -131,6 +131,9 @@ python patch_do_patch() {
             patchdir = parm["patchdir"]
             if not os.path.isabs(patchdir):
                 patchdir = os.path.join(s, patchdir)
+            if not os.path.isdir(patchdir):
+                bb.fatal("Patch target source directory '%s' not found, 
'patchdir' is incorrect in '%s'" %
+                    (patchdir, parm['patchname']))
         else:
             patchdir = s
 
@@ -147,11 +150,13 @@ python patch_do_patch() {
             patchset.Import({"file":local, "strippath": parm['striplevel']}, 
True)
         except Exception as exc:
             bb.utils.remove(process_tmpdir, True)
+            bb.fatal("Import patch '%s' with striplevel '%s'" % 
(parm['patchname'], parm['striplevel']))
             bb.fatal(str(exc))
         try:
             resolver.Resolve()
         except bb.BBHandledException as e:
             bb.utils.remove(process_tmpdir, True)
+            bb.fatal("Resolve patch '%s' on target directory '%s'" % 
(parm['patchname'], patchdir))
             bb.fatal(str(e))
 
     bb.utils.remove(process_tmpdir, True)
-- 
2.33.0

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

Reply via email to