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:09:16 +0100
commit45772bab329821ad425b20e630749c2a6c82c235 (patch)
tree273503dac7a6d326798d7fc7791a458815bf3aef /meta/classes/sanity.bbclass
parentb250b5c7bef8fb0700266e0ebc5063d6e643a46f (diff)
downloadpoky-45772bab329821ad425b20e630749c2a6c82c235.tar.gz
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] (From OE-Core rev: c101201b3aa7378e4c65a879040fe6f509e7cdcd) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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):
707 # Check if /tmp is writable 707 # Check if /tmp is writable
708 from string import ascii_letters 708 from string import ascii_letters
709 from random import choice 709 from random import choice
710 filename = "bb_writetest.%s" % os.getpid() 710 from tempfile import mkstemp
711 testfile = os.path.join("/tmp", filename) 711 tmpfd, tmppath = mkstemp()
712 try: 712 try:
713 f = open(testfile, "w") 713 f = os.fdopen(tmpfd, "wt")
714 f.write("".join(choice(ascii_letters) for x in range(1024))) 714 f.write("".join(choice(ascii_letters) for x in range(1024)))
715 f.close() 715 f.close()
716 os.remove(testfile) 716 except Exception as err:
717 except: 717 status.addresult("Failed to write into /tmp; %s. Please verify your filesystem." % err)
718 status.addresult("Failed to write into /tmp. Please verify your filesystem.") 718 finally:
719 os.remove(tmppath)
719 720
720 # Check that the DISTRO is valid, if set 721 # Check that the DISTRO is valid, if set
721 # need to take into account DISTRO renaming DISTRO 722 # need to take into account DISTRO renaming DISTRO