From: Richard Purdie Date: Sun, 7 Jan 2007 17:22:23 +0000 (+0000) Subject: build.py: Add del_stamp function to remove existing stamps (factoring common function... X-Git-Tag: 1.8.0~30 X-Git-Url: http://code.vuplus.com/gitweb/?a=commitdiff_plain;h=1a678c62b504b2cf8b20c6fdfbf2de2c634f5d7b;hp=bf53f26d286e73eb5097b9fe54fd785fa5c82cd2;p=vuplus_bitbake build.py: Add del_stamp function to remove existing stamps (factoring common functionality into a shared function). --- diff --git a/lib/bb/build.py b/lib/bb/build.py index af3dbb7..b1736ca 100644 --- a/lib/bb/build.py +++ b/lib/bb/build.py @@ -295,7 +295,7 @@ def exec_task(task, d): # make stamp, or cause event and raise exception if not data.getVarFlag(task, 'nostamp', d): - mkstamp(task, d) + make_stamp(task, d) def extract_stamp_data(d, fn): """ @@ -310,6 +310,15 @@ def extract_stamp_data(d, fn): data.setVar('_task_graph', task_graph, d) return (task_graph, data.getVar('STAMP', d, 1), None) +def extract_stamp(d, fn): + """ + Extracts stamp format which is either a data dictonary (fn unset) + or a dataCache entry (fn set). + """ + if fn: + return d.stamp[fn] + return data.getVar('STAMP', d, 1) + def stamp_is_current(task, d, file_name = None, checkdeps = 1): """ Check status of a given task's stamp. @@ -342,7 +351,7 @@ def stamp_is_current(task, d, file_name = None, checkdeps = 1): if data.getVarFlag(task, 'nostamp', d): return 1 - if not stamp_is_current(task, d, file_name, 0): + if not stamp_is_current(task, d, file_name, 0 ): return 0 depfile = "%s.%s" % (stampfn, task) @@ -353,19 +362,40 @@ def stamp_is_current(task, d, file_name = None, checkdeps = 1): return task_graph.walkdown(task, checkStamp) -def mkstamp(task, d): - """Creates/updates a stamp for a given task""" - stamp = data.getVar('STAMP', d) +def stamp_internal(task, d, file_name): + """ + Internal stamp helper function + Removes any stamp for the given task + Makes sure the stamp directory exists + Returns the stamp path+filename + """ + stamp = extract_stamp(d, file_name) if not stamp: return - stamp = "%s.%s" % (data.expand(stamp, d), task) + stamp = "%s.%s" % (stamp, task) mkdirhier(os.path.dirname(stamp)) # Remove the file and recreate to force timestamp # change on broken NFS filesystems if os.access(stamp, os.F_OK): os.remove(stamp) - f = open(stamp, "w") - f.close() + return stamp + +def make_stamp(task, d, file_name = None): + """ + Creates/updates a stamp for a given task + (d can be a data dict or dataCache) + """ + stamp = stamp_internal(task, d, file_name) + if stamp: + f = open(stamp, "w") + f.close() + +def del_stamp(task, d, file_name = None): + """ + Removes a stamp for a given task + (d can be a data dict or dataCache) + """ + stamp_internal(task, d, file_name) def add_task(task, deps, d): task_graph = data.getVar('_task_graph', d)