On Wed, 2024-05-15 at 17:42 +0000, Peter Kjellerstedt wrote:
> 
> > diff --git a/meta/classes-global/base.bbclass b/meta/classes-
> > global/base.bbclass
> > index 066f3848f7c..cdce0538273 100644
> > --- a/meta/classes-global/base.bbclass
> > +++ b/meta/classes-global/base.bbclass
> > @@ -153,20 +153,35 @@ python base_do_fetch() {
> >  }
> > 
> >  addtask unpack after do_fetch
> > -do_unpack[dirs] = "${UNPACKDIR}"
> > -
> > -do_unpack[cleandirs] = "${@d.getVar('S') if
> > os.path.normpath(d.getVar('S')) !=
> > os.path.normpath(d.getVar('WORKDIR')) else os.path.join('${S}',
> > 'patches')}"
> > +do_unpack[cleandirs] = "${UNPACKDIR}"
> > 
> >  python base_do_unpack() {
> > +    import shutil
> > +
> >      src_uri = (d.getVar('SRC_URI') or "").split()
> >      if not src_uri:
> >          return
> > 
> > +    sourcedir = d.getVar('S')
> > +    basedir = None
> > +    workdir = d.getVar('WORKDIR')
> > +    unpackdir = d.getVar('UNPACKDIR')
> > +    if sourcedir.startswith(workdir) and not
> > sourcedir.startswith(unpackdir):
> > +        basedir = sourcedir.replace(workdir,
> > '').strip("/").split('/')[0]
> > +        bb.utils.remove(sourcedir, True)
> 
> This remove() seems wrong and should not be needed. There are two 
> cases here:
> 
> 1) either ${S} == ${WORKDIR}, in which case the above will remove 
>    ${WORKDIR}, which is sure to lead to problems, or
> 2) ${S} == ${WORKDIR}/foo[/...], in which case the removal of 
>    workdir + '/' + basedir below will also remove ${S} as 
>    basedir == "foo".
> 
> 

I did look into that remove() further and tried to make the removal
unconditional. The challenge is that if S = UNPACKDIR, it will rmdir
the directory and the code assumes UNPACKDIR to be created from the
cleandirs. We don't want an empty S created though for the S !=
UNPACKDIR case.

Making it conditional on sourcedir != unpackdir which was the original
condition for that code block but that does still cause QA warnings for
linux-yocto. I'm now convinced linux-yocto needs more work so I'm
tempted to disable that QA check there for now, letting us improve
base.bbclass.

Cheers,

Richard, running out of patience with hours long test cycles
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#199453): 
https://lists.openembedded.org/g/openembedded-core/message/199453
Mute This Topic: https://lists.openembedded.org/mt/106112374/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to