On Mon, Dec 18, 2023 at 12:39 PM Etienne Cordonnier <[email protected]> wrote: > > Hi Bruce, > can you please clarify? Are you saying that you prefer the version of the > patch which I pasted with shutil.copytree? > > The condition to trigger the issue is not that rare, e.g. anybody updating > from kirkstone 4.0.12 to 4.0.13 and doing an incremental build will get a > build failure if S doesn't have the default value (in my case the BSP layer > overrides S). In the same way, if we merge the version with shutil.copytree, > people will need to perform a manual clean, or they may get build failures.
For my rarity comment, I meant that it isn't within a typical flow of bitbaking an image, forcing a task, and bitbaking again. If someone is doing a meta-layer update, and re-using their build (I have quite literally 7 year old directories like this) then they will run into some issues from time to time (and folks doing this, normally know how to get themselves out of trouble). Taking that into consideration, I just mean that I'd be ok with a copy of the files, as it is really an update to "the latest structure" and if you are doing it on an existing build, that's one of the consequences. Bruce > > Etienne > > On Mon, Dec 18, 2023 at 3:25 PM Bruce Ashfield <[email protected]> > wrote: >> >> On Mon, Dec 18, 2023 at 6:45 AM Etienne Cordonnier via >> lists.openembedded.org <[email protected]> >> wrote: >> > >> > My thinking was that in my local build I was updating from a build without >> > https://github.com/yoctoproject/poky/commit/3b8d0acca30c806fb69fc3096d41593cc76ed22c >> > to a build containing this commit, so the behavior of do_symlink_kernsrc >> > got modified, but my incremental build is not executing the new version of >> > the code since it detects that the symlink already exists and then the >> > rest of the function gets skipped, so I thought this justified a warning. >> > >> > I'll lower the warning to info, but then this assumes that we will never >> > modify do_symlink_kernsrc in a way which is not backwards-compatible. >> > >> > @Richard: the reason I didn't go for the copy to "orig" is that I don't >> > see a way to add this without breaking incremental builds (where s is a >> > symlink to kernsrc which is potentially modified already by do_patch >> > etc.). However I think it would be a cleaner solution than simply skipping >> > the code like I did: >> >> If the only way to trigger the issue is through really rare pre-<some >> commit> to post >> that commit that happens to modify the detection/manipulation/other of S and >> the >> symlink, then it is rare enough to just drop an info message breadcrumb and >> keep >> moving. >> >> But if it really is a rare situation like you ran into, or some sort >> of forced execution >> of the task, I don't think that a copy would be an unexpected thing to >> happen. >> >> Bruce >> >> > >> > - if d.getVar("EXTERNALSRC"): >> > + if d.getVar("EXTERNALSRC") and not os.path.islink(s): >> > # With EXTERNALSRC S will not be wiped so we can symlink to it >> > os.symlink(s, kernsrc) >> > else: >> > import shutil >> > + s_copy = s + ".orig" >> > + if not os.path.isdir(s_copy): >> > + shutil.copytree(s, s_copy) >> > + bb.utils.remove(s, recurse=True) >> > + shutil.copytree(s_copy, s) >> > >> > Etienne >> > >> > >> > On Sun, Dec 17, 2023 at 8:52 PM Richard Purdie >> > <[email protected]> wrote: >> >> >> >> On Sat, 2023-12-16 at 14:53 +0100, Etienne Cordonnier via >> >> lists.openembedded.org wrote: >> >> > From: Etienne Cordonnier <[email protected]> >> >> > >> >> > The function do_symlink_kernsrc is not reentrant in the case where S is >> >> > defined >> >> > to a non-default value. This causes build-failures e.g. when building >> >> > linux-yocto, then updating >> >> > poky to a commit which modifies kernel.bbclass, and then building >> >> > linux-yocto again. >> >> > >> >> > Bugzilla: >> >> > https://urldefense.proofpoint.com/v2/url?u=https-3A__bugzilla.yoctoproject.org_show-5Fbug.cgi-3Fid-3D15325&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=qcRut2Wm9dH26YP_YovPl6QVczLOYUxs1xfzA75ZJBiHj4dWwxbAS-2JjGPlyiyS&s=_WTBsDroHfmiIIyCOXRV2CAId9PmKZ4sN3bRO3EOcyU&e= >> >> > >> >> > Signed-off-by: Etienne Cordonnier <[email protected]> >> >> > --- >> >> > meta/classes-recipe/kernel.bbclass | 5 +++++ >> >> > 1 file changed, 5 insertions(+) >> >> > >> >> > diff --git a/meta/classes-recipe/kernel.bbclass >> >> > b/meta/classes-recipe/kernel.bbclass >> >> > index 9ff37f5c38..130bedd901 100644 >> >> > --- a/meta/classes-recipe/kernel.bbclass >> >> > +++ b/meta/classes-recipe/kernel.bbclass >> >> > @@ -194,6 +194,11 @@ python do_symlink_kernsrc () { >> >> > os.symlink(s, kernsrc) >> >> > else: >> >> > import shutil >> >> > + if os.path.islink(s): >> >> > + # this happens for instance when a poky update forces >> >> > symlink_kernsrc to run again >> >> > + # after s was already moved to kernsrc >> >> > + bb.warn("%s is already a symlink! Not symlinking >> >> > kernel sources" % s) >> >> > + return 0 >> >> > shutil.move(s, kernsrc) >> >> > os.symlink(kernsrc, s) >> >> > } >> >> >> >> Usually what we recommend is that the first pass does something if "if >> >> not exists X.org; cp X X.orig; fi", then you can always copy from >> >> X.orig. >> >> >> >> As Bruce says, it definitely shouldn't be a warning, this can happen >> >> quite normally. >> >> >> >> Cheers, >> >> >> >> Richard >> > >> > >> > >> > >> >> >> -- >> - Thou shalt not follow the NULL pointer, for chaos and madness await >> thee at its end >> - "Use the force Harry" - Gandalf, Star Trek II -- - Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#192676): https://lists.openembedded.org/g/openembedded-core/message/192676 Mute This Topic: https://lists.openembedded.org/mt/103208527/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
