Message ID | 20220228160600.42164-1-quaresma.jose@gmail.com |
---|---|
State | Accepted, archived |
Commit | 97bc2168da7dbacdfbf79cd70db674363ab84f6b |
Headers | show |
Series | buildhistory.bbclass: create the buildhistory directory when needed | expand |
On Mon, Feb 28, 2022 at 8:06 AM Jose Quaresma <quaresma.jose@gmail.com> wrote: > > When the BUILDHISTORY_RESET is enabled we need to move the > content from BUILDHISTORY_DIR to BUILDHISTORY_OLD_DIR but > when we start a clean build in the first run we don't have the > BUILDHISTORY_DIR so the move of files will fail. > > | ERROR: Command execution failed: Traceback (most recent call last): > | File "/xxx/poky/bitbake/lib/bb/command.py", line 110, in runAsyncCommand > | commandmethod(self.cmds_async, self, options) > | File "/xxx/poky/bitbake/lib/bb/command.py", line 564, in buildTargets > | command.cooker.buildTargets(pkgs_to_build, task) > | File "/xxx/poky/bitbake/lib/bb/cooker.py", line 1481, in buildTargets > | bb.event.fire(bb.event.BuildStarted(buildname, ntargets), self.databuilder.mcdata[mc]) > | File "/xxx/home/builder/src/base/poky/bitbake/lib/bb/event.py", line 214, in fire > | fire_class_handlers(event, d) > | File "/xxx/poky/bitbake/lib/bb/event.py", line 121, in fire_class_handlers > | execute_handler(name, handler, event, d) > | File "/xxx/poky/bitbake/lib/bb/event.py", line 93, in execute_handler > | ret = handler(event) > | File "/xxx/poky/meta/classes/buildhistory.bbclass", line 919, in buildhistory_eventhandler > | entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') ] > | FileNotFoundError: [Errno 2] No such file or directory: '/xxx/buildhistory' > > Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> > --- > meta/classes/buildhistory.bbclass | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass > index 49797a6701..d416512f6d 100644 > --- a/meta/classes/buildhistory.bbclass > +++ b/meta/classes/buildhistory.bbclass > @@ -896,6 +896,8 @@ python buildhistory_eventhandler() { > if os.path.isdir(olddir): > shutil.rmtree(olddir) > rootdir = e.data.getVar("BUILDHISTORY_DIR") > + if not os.path.exists(rootdir): > + bb.utils.mkdirhier(rootdir) I wonder if the check is needed. Is there any downside if we did not check for it pre-existing ? > entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') ] > bb.utils.mkdirhier(olddir) > for entry in entries: > -- > 2.35.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#162508): https://lists.openembedded.org/g/openembedded-core/message/162508 > Mute This Topic: https://lists.openembedded.org/mt/89453662/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
Khem Raj <raj.khem@gmail.com> escreveu no dia segunda, 28/02/2022 à(s) 17:12: > On Mon, Feb 28, 2022 at 8:06 AM Jose Quaresma <quaresma.jose@gmail.com> > wrote: > > > > When the BUILDHISTORY_RESET is enabled we need to move the > > content from BUILDHISTORY_DIR to BUILDHISTORY_OLD_DIR but > > when we start a clean build in the first run we don't have the > > BUILDHISTORY_DIR so the move of files will fail. > > > > | ERROR: Command execution failed: Traceback (most recent call last): > > | File "/xxx/poky/bitbake/lib/bb/command.py", line 110, in > runAsyncCommand > > | commandmethod(self.cmds_async, self, options) > > | File "/xxx/poky/bitbake/lib/bb/command.py", line 564, in buildTargets > > | command.cooker.buildTargets(pkgs_to_build, task) > > | File "/xxx/poky/bitbake/lib/bb/cooker.py", line 1481, in buildTargets > > | bb.event.fire(bb.event.BuildStarted(buildname, ntargets), > self.databuilder.mcdata[mc]) > > | File "/xxx/home/builder/src/base/poky/bitbake/lib/bb/event.py", line > 214, in fire > > | fire_class_handlers(event, d) > > | File "/xxx/poky/bitbake/lib/bb/event.py", line 121, in > fire_class_handlers > > | execute_handler(name, handler, event, d) > > | File "/xxx/poky/bitbake/lib/bb/event.py", line 93, in execute_handler > > | ret = handler(event) > > | File "/xxx/poky/meta/classes/buildhistory.bbclass", line 919, in > buildhistory_eventhandler > > | entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') > ] > > | FileNotFoundError: [Errno 2] No such file or directory: > '/xxx/buildhistory' > > > > Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> > > --- > > meta/classes/buildhistory.bbclass | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/meta/classes/buildhistory.bbclass > b/meta/classes/buildhistory.bbclass > > index 49797a6701..d416512f6d 100644 > > --- a/meta/classes/buildhistory.bbclass > > +++ b/meta/classes/buildhistory.bbclass > > @@ -896,6 +896,8 @@ python buildhistory_eventhandler() { > > if os.path.isdir(olddir): > > shutil.rmtree(olddir) > > rootdir = e.data.getVar("BUILDHISTORY_DIR") > > + if not os.path.exists(rootdir): > > + bb.utils.mkdirhier(rootdir) > > I wonder if the check is needed. Is there any downside if we did not > check for it pre-existing ? > > The mkdirhier uses the python os.makedirs so it works like 'mkdir -p' but there are more places in the class that check if the directory exists before creating it. Use the os.path.exists is more consistent with what exists in class but I can send a v2 without the check. Jose > entries = [ x for x in os.listdir(rootdir) if not > x.startswith('.') ] > > bb.utils.mkdirhier(olddir) > > for entry in entries: > > -- > > 2.35.1 > > > > > > -=-=-=-=-=-=-=-=-=-=-=- > > Links: You receive all messages sent to this group. > > View/Reply Online (#162508): > https://lists.openembedded.org/g/openembedded-core/message/162508 > > Mute This Topic: https://lists.openembedded.org/mt/89453662/1997914 > > Group Owner: openembedded-core+owner@lists.openembedded.org > > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > raj.khem@gmail.com] > > -=-=-=-=-=-=-=-=-=-=-=- > > >
On Mon, Feb 28, 2022 at 10:06 AM Jose Quaresma <quaresma.jose@gmail.com> wrote: > > > > Khem Raj <raj.khem@gmail.com> escreveu no dia segunda, 28/02/2022 à(s) 17:12: >> >> On Mon, Feb 28, 2022 at 8:06 AM Jose Quaresma <quaresma.jose@gmail.com> wrote: >> > >> > When the BUILDHISTORY_RESET is enabled we need to move the >> > content from BUILDHISTORY_DIR to BUILDHISTORY_OLD_DIR but >> > when we start a clean build in the first run we don't have the >> > BUILDHISTORY_DIR so the move of files will fail. >> > >> > | ERROR: Command execution failed: Traceback (most recent call last): >> > | File "/xxx/poky/bitbake/lib/bb/command.py", line 110, in runAsyncCommand >> > | commandmethod(self.cmds_async, self, options) >> > | File "/xxx/poky/bitbake/lib/bb/command.py", line 564, in buildTargets >> > | command.cooker.buildTargets(pkgs_to_build, task) >> > | File "/xxx/poky/bitbake/lib/bb/cooker.py", line 1481, in buildTargets >> > | bb.event.fire(bb.event.BuildStarted(buildname, ntargets), self.databuilder.mcdata[mc]) >> > | File "/xxx/home/builder/src/base/poky/bitbake/lib/bb/event.py", line 214, in fire >> > | fire_class_handlers(event, d) >> > | File "/xxx/poky/bitbake/lib/bb/event.py", line 121, in fire_class_handlers >> > | execute_handler(name, handler, event, d) >> > | File "/xxx/poky/bitbake/lib/bb/event.py", line 93, in execute_handler >> > | ret = handler(event) >> > | File "/xxx/poky/meta/classes/buildhistory.bbclass", line 919, in buildhistory_eventhandler >> > | entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') ] >> > | FileNotFoundError: [Errno 2] No such file or directory: '/xxx/buildhistory' >> > >> > Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> >> > --- >> > meta/classes/buildhistory.bbclass | 2 ++ >> > 1 file changed, 2 insertions(+) >> > >> > diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass >> > index 49797a6701..d416512f6d 100644 >> > --- a/meta/classes/buildhistory.bbclass >> > +++ b/meta/classes/buildhistory.bbclass >> > @@ -896,6 +896,8 @@ python buildhistory_eventhandler() { >> > if os.path.isdir(olddir): >> > shutil.rmtree(olddir) >> > rootdir = e.data.getVar("BUILDHISTORY_DIR") >> > + if not os.path.exists(rootdir): >> > + bb.utils.mkdirhier(rootdir) >> >> I wonder if the check is needed. Is there any downside if we did not >> check for it pre-existing ? >> > > The mkdirhier uses the python os.makedirs so it works like 'mkdir -p' > but there are more places in the class that check if the directory exists > before creating it. > Use the os.path.exists is more consistent with what exists in class but > I can send a v2 without the check. yeah, I am not sure if there is advantage of checking before creating here. > > Jose > >> > entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') ] >> > bb.utils.mkdirhier(olddir) >> > for entry in entries: >> > -- >> > 2.35.1 >> > >> > >> > -=-=-=-=-=-=-=-=-=-=-=- >> > Links: You receive all messages sent to this group. >> > View/Reply Online (#162508): https://lists.openembedded.org/g/openembedded-core/message/162508 >> > Mute This Topic: https://lists.openembedded.org/mt/89453662/1997914 >> > Group Owner: openembedded-core+owner@lists.openembedded.org >> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] >> > -=-=-=-=-=-=-=-=-=-=-=- >> > > > > > -- > Best regards, > > José Quaresma
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 49797a6701..d416512f6d 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -896,6 +896,8 @@ python buildhistory_eventhandler() { if os.path.isdir(olddir): shutil.rmtree(olddir) rootdir = e.data.getVar("BUILDHISTORY_DIR") + if not os.path.exists(rootdir): + bb.utils.mkdirhier(rootdir) entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') ] bb.utils.mkdirhier(olddir) for entry in entries:
When the BUILDHISTORY_RESET is enabled we need to move the content from BUILDHISTORY_DIR to BUILDHISTORY_OLD_DIR but when we start a clean build in the first run we don't have the BUILDHISTORY_DIR so the move of files will fail. | ERROR: Command execution failed: Traceback (most recent call last): | File "/xxx/poky/bitbake/lib/bb/command.py", line 110, in runAsyncCommand | commandmethod(self.cmds_async, self, options) | File "/xxx/poky/bitbake/lib/bb/command.py", line 564, in buildTargets | command.cooker.buildTargets(pkgs_to_build, task) | File "/xxx/poky/bitbake/lib/bb/cooker.py", line 1481, in buildTargets | bb.event.fire(bb.event.BuildStarted(buildname, ntargets), self.databuilder.mcdata[mc]) | File "/xxx/home/builder/src/base/poky/bitbake/lib/bb/event.py", line 214, in fire | fire_class_handlers(event, d) | File "/xxx/poky/bitbake/lib/bb/event.py", line 121, in fire_class_handlers | execute_handler(name, handler, event, d) | File "/xxx/poky/bitbake/lib/bb/event.py", line 93, in execute_handler | ret = handler(event) | File "/xxx/poky/meta/classes/buildhistory.bbclass", line 919, in buildhistory_eventhandler | entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') ] | FileNotFoundError: [Errno 2] No such file or directory: '/xxx/buildhistory' Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> --- meta/classes/buildhistory.bbclass | 2 ++ 1 file changed, 2 insertions(+)