mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
bitbake: bitbake: reset build mtime cache before the build
Introduced build mtime cache structure. Reset it before the build to prevent bitbake from crashing when build/tmp/stamps hierarchy is removed. [YOCTO: #7562] (Bitbake rev: f8590547a198a78334debdf14bf40acb50c22ecc) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
4eeae70a45
commit
db409697db
+16
-1
@@ -31,6 +31,7 @@ import logging
|
|||||||
import shlex
|
import shlex
|
||||||
import glob
|
import glob
|
||||||
import time
|
import time
|
||||||
|
import stat
|
||||||
import bb
|
import bb
|
||||||
import bb.msg
|
import bb.msg
|
||||||
import bb.process
|
import bb.process
|
||||||
@@ -42,6 +43,20 @@ logger = logging.getLogger('BitBake.Build')
|
|||||||
|
|
||||||
NULL = open(os.devnull, 'r+')
|
NULL = open(os.devnull, 'r+')
|
||||||
|
|
||||||
|
__mtime_cache = {}
|
||||||
|
|
||||||
|
def cached_mtime_noerror(f):
|
||||||
|
if f not in __mtime_cache:
|
||||||
|
try:
|
||||||
|
__mtime_cache[f] = os.stat(f)[stat.ST_MTIME]
|
||||||
|
except OSError:
|
||||||
|
return 0
|
||||||
|
return __mtime_cache[f]
|
||||||
|
|
||||||
|
def reset_cache():
|
||||||
|
global __mtime_cache
|
||||||
|
__mtime_cache = {}
|
||||||
|
|
||||||
# When we execute a Python function, we'd like certain things
|
# When we execute a Python function, we'd like certain things
|
||||||
# in all namespaces, hence we add them to __builtins__.
|
# in all namespaces, hence we add them to __builtins__.
|
||||||
# If we do not do this and use the exec globals, they will
|
# If we do not do this and use the exec globals, they will
|
||||||
@@ -535,7 +550,7 @@ def stamp_internal(taskname, d, file_name, baseonly=False):
|
|||||||
stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname, extrainfo)
|
stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname, extrainfo)
|
||||||
|
|
||||||
stampdir = os.path.dirname(stamp)
|
stampdir = os.path.dirname(stamp)
|
||||||
if bb.parse.cached_mtime_noerror(stampdir) == 0:
|
if cached_mtime_noerror(stampdir) == 0:
|
||||||
bb.utils.mkdirhier(stampdir)
|
bb.utils.mkdirhier(stampdir)
|
||||||
|
|
||||||
return stamp
|
return stamp
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ from contextlib import closing
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import bb, bb.exceptions, bb.command
|
import bb, bb.exceptions, bb.command
|
||||||
from bb import utils, data, parse, event, cache, providers, taskdata, runqueue
|
from bb import utils, data, parse, event, cache, providers, taskdata, runqueue, build
|
||||||
import Queue
|
import Queue
|
||||||
import signal
|
import signal
|
||||||
import prserv.serv
|
import prserv.serv
|
||||||
@@ -1343,6 +1343,7 @@ class BBCooker:
|
|||||||
return True
|
return True
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
|
build.reset_cache()
|
||||||
self.buildSetVars()
|
self.buildSetVars()
|
||||||
|
|
||||||
taskdata, runlist, fulltargetlist = self.buildTaskData(targets, task, self.configuration.abort)
|
taskdata, runlist, fulltargetlist = self.buildTaskData(targets, task, self.configuration.abort)
|
||||||
|
|||||||
Reference in New Issue
Block a user