Skip to contentSkip to conversation

buildhistory: use bb.utils.mkdirhier instead of os.makedirs

PATCH New Martin Jansa 1 participant 1 message Aug 6, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildhistory: use bb.utils.mkdirhier instead of os.makedirs

From: Martin Jansa <[email protected]>

* Multiple do_fetch[prefunc] can happen at the same time and if not os.path.exists(pkghistdir):
os.makedirs(pkghistdir)
isn't safe
* Use bb.utils.mkdirhier which doesn't raise error when directory exists

---
 meta/classes/buildhistory.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/classes/buildhistory.bbclass +3 -3
index 7be442e..33b670d 100644
@@ -169,7 +169,7 @@ python buildhistory_emit_pkghistory() {
 
     packagelist = packages.split()
     if not os.path.exists(pkghistdir):
-        os.makedirs(pkghistdir)
+        bb.utils.mkdirhier(pkghistdir)
     else:
         # Remove files for packages that no longer exist
         for item in os.listdir(pkghistdir):
@@ -268,7 +268,7 @@ def write_pkghistory(pkginfo, d):
 
     pkgpath = os.path.join(pkghistdir, pkginfo.name)
     if not os.path.exists(pkgpath):
-        os.makedirs(pkgpath)
+        bb.utils.mkdirhier(pkgpath)
 
     infofile = os.path.join(pkgpath, "latest")
     with open(infofile, "w") as f:
@@ -580,7 +580,7 @@ python write_srcrev() {
     srcrevs, tag_srcrevs = _get_srcrev_values(d)
     if srcrevs:
         if not os.path.exists(pkghistdir):
-            os.makedirs(pkghistdir)
+            bb.utils.mkdirhier(pkghistdir)
         old_tag_srcrevs = {}
         if os.path.exists(srcrevfile):
             with open(srcrevfile) as f:
Signature · 1 line
1.8.3.2