Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] buildhistory: use bb.utils.mkdirhier instead of os.makedirs
Date: Wed,  7 Aug 2013 00:09:49 +0200	[thread overview]
Message-ID: <1375826989-15923-1-git-send-email-Martin.Jansa@gmail.com> (raw)

From: Martin Jansa <martin.jansa@gmail.com>

* 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

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/classes/buildhistory.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 7be442e..33b670d 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -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:
-- 
1.8.3.2



                 reply	other threads:[~2013-08-06 22:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375826989-15923-1-git-send-email-Martin.Jansa@gmail.com \
    --to=martin.jansa@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox