summaryrefslogtreecommitdiffstats
path: root/meta/classes/sanity.bbclass
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-07-07 11:17:40 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-16 15:08:40 +0100
commitc101201b3aa7378e4c65a879040fe6f509e7cdcd (patch)
tree55fee91aeb31719ddf13f4b0b20ede705dcda9fe /meta/classes/sanity.bbclass
parentd48233cb1fd84f1061a8ba3c15bacc180e93934c (diff)
downloadopenembedded-core-contrib-c101201b3aa7378e4c65a879040fe6f509e7cdcd.tar.gz
openembedded-core-contrib-c101201b3aa7378e4c65a879040fe6f509e7cdcd.tar.bz2
openembedded-core-contrib-c101201b3aa7378e4c65a879040fe6f509e7cdcd.zip
sanity.bbclass: Check if /tmp is writable
Used mkstemp instead of raw open file call. Also added the exception message to the output of the sanity check. [YOCTO #7922] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes/sanity.bbclass')
-rw-r--r--meta/classes/sanity.bbclass13
1 files changed, 7 insertions, 6 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 7a580da755..125cc4c8a0 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -707,15 +707,16 @@ def check_sanity_everybuild(status, d):
# Check if /tmp is writable
from string import ascii_letters
from random import choice
- filename = "bb_writetest.%s" % os.getpid()
- testfile = os.path.join("/tmp", filename)
+ from tempfile import mkstemp
+ tmpfd, tmppath = mkstemp()
try:
- f = open(testfile, "w")
+ f = os.fdopen(tmpfd, "wt")
f.write("".join(choice(ascii_letters) for x in range(1024)))
f.close()
- os.remove(testfile)
- except:
- status.addresult("Failed to write into /tmp. Please verify your filesystem.")
+ except Exception as err:
+ status.addresult("Failed to write into /tmp; %s. Please verify your filesystem." % err)
+ finally:
+ os.remove(tmppath)
# Check that the DISTRO is valid, if set
# need to take into account DISTRO renaming DISTRO