Konrad Weihmann <[email protected]> escreveu no dia domingo, 3/10/2021
à(s) 12:54:

>
>
> On 03.10.21 13:14, Jose Quaresma wrote:
> > 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.
>
> Nice patch, that will turn really helpful, thanks for that one
>
> >
> > 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))
>
> I'm not a 100% sure about consecutive bb.fatal calls. To my
> understanding each of the calls will raise a BBHandledException, which
> is caught at toplevel and leading to sys.exit - so a bb.fatal after a
> bb.fatal is likely dead code, as it will be never called.
>

Thanks, good catch.
Does not make sense to call bb.fatal one after the other.
I will send a V5.


> But I might be wrong here - looking for more insights from the bitbake
> experts
>
>
> >           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)
> >
> >
> >
> > 
> >
>


-- 
Best regards,

José Quaresma
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#156559): 
https://lists.openembedded.org/g/openembedded-core/message/156559
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