patch.bbclass: show to the user where the patch is applied
PATCH 1/1 patch.bbclass: show to the user where the patch is applied
- 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 'S'.
* On the next example, the patch is applied on ${WORKDIR}/contrib. But if the user specifies a path on 'patchdir' that don't exist, the patch will fail and there are no message that indicates the real cause. So showing the source path where the patch is applied can be useful.
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 \
"--- meta/classes/patch.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/patch.bbclass +1 -1
@@ -142,7 +142,7 @@ python patch_do_patch() { else: patchset, resolver = classes[patchdir] - bb.note("Applying patch '%s' (%s)" % (parm['patchname'], oe.path.format_display(local, d))) + bb.note("Applying patch '%s' (%s) on '%s'" % (parm['patchname'], oe.path.format_display(local, d), patchdir)) try: patchset.Import({"file":local, "strippath": parm['striplevel']}, True) except Exception as exc:
Signature · 1 line
2.33.0
Hi Jose,
Quoted 9 lines · Jose Quaresma
- 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 'S'.* On the next example, the patch is applied on ${WORKDIR}/contrib. But if the user specifies a path on 'patchdir' that don't exist, the patch will fail and there are no message that indicates the real cause. So showing the source path where the patch is applied can be useful.
Quoted 7 lines
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 \ "
This shouldn't be done. You do not patch files in WORKDIR, you override them with SRC_URI and bbappends.
This breaks devtool.
The patch is fine for me, just complaining about the example :)
Are bb.note printed in the log.do_task files, I don't remember? If not (or maybe whatever the answer since it could be a bring a better user experience), would it be possible to print this path again when it fails? So that it's clear from the default loglevel output of bitbake that the patch failed and it was attempted to be applied to "this" path?
Thanks!
Quentin
Quoted 18 lines
Signed-off-by Jose Quaresma <[email protected]>---
meta/classes/patch.bbclass | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)meta/classes/patch.bbclass +1
-1@@ -142,7 +142,7 @@ python patch_do_patch() { else: patchset, resolver = classes[patchdir] - bb.note("Applying patch '%s' (%s)" % (parm['patchname'], oe.path.format_display(local, d))) + bb.note("Applying patch '%s' (%s) on '%s'" % (parm['patchname'], oe.path.format_display(local, d), patchdir)) try: patchset.Import({"file":local, "strippath": parm['striplevel']}, True) except Exception as exc:
Hi Quentin,
Quentin Schulz <[email protected]> escreveu no dia quinta, 19/08/2021 à(s) 08:20:
Quoted 21 lines
Hi Jose,
Quoted 9 lines · Jose Quaresma
- 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 'S'.* On the next example, the patch is applied on ${WORKDIR}/contrib. But if the user specifies a path on 'patchdir' that don't exist, the patch will fail and there are no message that indicates the real cause. So showing the source path where the patch is applied can be useful.
Quoted 7 lines
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 \ "
Quoted 7 lines
This shouldn't be done. You do not patch files in WORKDIR, you override them with
SRC_URIand bbappends.This breaks devtool.
The patch is fine for me, just complaining about the example :)
Are bb.note printed in the log.do_task files, I don't remember? If not (or maybe whatever the answer since it could be a bring a better user experience), would it be possible to print this path again when it fails? So that it's clear from the default loglevel output of bitbake that the patch failed and it was attempted to be applied to "this" path?
When I made this patch I think about that but I don't understand where is applied the patch:
try:
patchset.Import({"file":local, "strippath":
parm['striplevel']}, True)
except Exception as exc:
bb.utils.remove(process_tmpdir, True) bb.fatal(str(exc))
try:
resolver.Resolve()
except bb.BBHandledException as e:
bb.utils.remove(process_tmpdir, True) bb.fatal(str(e))
Is the patch applied on resolver.Resolve() ? I am not sure
Quoted 24 lines
Reviewed-by Quentin Schulz <[email protected]>Thanks!
QuentinQuoted 18 lines
Signed-off-by Jose Quaresma <[email protected]>---
meta/classes/patch.bbclass | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)meta/classes/patch.bbclass +1
-1@@ -142,7 +142,7 @@ python patch_do_patch() { else: patchset, resolver = classes[patchdir] - bb.note("Applying patch '%s' (%s)" % (parm['patchname'], oe.path.format_display(local, d))) + bb.note("Applying patch '%s' (%s) on '%s'" % (parm['patchname'], oe.path.format_display(local, d), patchdir)) try: patchset.Import({"file":local, "strippath": parm['striplevel']}, True) except Exception as exc:
Signature · 3 lines
Best regards, José Quaresma
A message that is not in the archive (sent off-list or not yet received): [email protected]
I will send a v2 that only check if the patchdir path exist before patching the sources
Jose Quaresma via lists.openembedded.org <[email protected]> escreveu no dia quinta, 19/08/2021 à(s) 08:36:
Quoted 84 lines
Hi Quentin,
Quentin Schulz <[email protected]> escreveu no dia quinta, 19/08/2021 à(s) 08:20:
Quoted 21 lines
Hi Jose,
Quoted 9 lines · Jose Quaresma
- 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 'S'.* On the next example, the patch is applied on ${WORKDIR}/contrib. But if the user specifies a path on 'patchdir' that don't exist, the patch will fail and there are no message that indicates the real cause. So showing the source path where the patch is applied can be useful.
Quoted 7 lines
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 \ "Quoted 7 lines
This shouldn't be done. You do not patch files in WORKDIR, you override them with
SRC_URIand bbappends.This breaks devtool.
The patch is fine for me, just complaining about the example :)
Are bb.note printed in the log.do_task files, I don't remember? If not (or maybe whatever the answer since it could be a bring a better user experience), would it be possible to print this path again when it fails? So that it's clear from the default loglevel output of bitbake that the patch failed and it was attempted to be applied to "this" path?
When I made this patch I think about that but I don't understand where is applied the patch:
try:
patchset.Import({"file":local, "strippath":
parm['striplevel']}, True)
except Exception as exc:
bb.utils.remove(process_tmpdir, True)bb.fatal(str(exc))
try:
resolver.Resolve()
except bb.BBHandledException as e:
bb.utils.remove(process_tmpdir, True)bb.fatal(str(e))Is the patch applied on
resolver.Resolve()? I am not sureQuoted 19 lines
Reviewed-by Quentin Schulz <[email protected]>Thanks!
QuentinQuoted 13 lines
Signed-off-by Jose Quaresma <[email protected]>---
meta/classes/patch.bbclass | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)meta/classes/patch.bbclass +0
-0@@ -142,7 +142,7 @@ python patch_do_patch() { else: patchset, resolver = classes[patchdir]Quoted 5 lines
meta/classes/patch.bbclass python patch_do_patch() { · line 148
Quoted 5 lines
meta/classes/patch.bbclass +1
-1- bb.note("Applying patch '%s' (%s)" % (parm['patchname'], oe.path.format_display(local, d))) + bb.note("Applying patch '%s' (%s) on '%s'" % (parm['patchname'], oe.path.format_display(local, d), patchdir)) try: patchset.Import({"file":local, "strippath": parm['striplevel']}, True) except Exception as exc:--
Best regards,José Quaresma
Signature · 3 lines
Best regards, José Quaresma