Skip to contentSkip to conversation

build.py: Only execute mkdirhier if stampdir doesn't exist

PATCH New Richard Purdie 1 participant 1 message Aug 15, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build.py: Only execute mkdirhier if stampdir doesn't exist

I noticed this was showing up on profile logs as a sigificant time user in "bitbake bash" when bash was already built. It reduces the time from 5.2 to 4.5 seconds in my test environment.

We make use of the parser's mtime cache as once a directory exists, we can assume it continues to exist and this avoids syscalls.

---

bitbake/lib/bb/build.py +3 -1
index bea2926..d64077e 100644
@@ -464,7 +464,9 @@ def stamp_internal(taskname, d, file_name):
 
     stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname, extrainfo)
 
-    bb.utils.mkdirhier(os.path.dirname(stamp))
+    stampdir = os.path.dirname(stamp)
+    if bb.parse.cached_mtime_noerror == 0:
+        bb.utils.mkdirhier(stampdir)
 
     return stamp