sanity.bbclass: Check if /tmp is writable

If /tmp can't be written, bitbake gaves an unrelated error.
This checks if /tmp can be written in every build.

[YOCTO #7922]

(From OE-Core rev: 10c7cf0683494ea1bf2cc6de9b121abf2a04b253)

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>
This commit is contained in:
Mariano Lopez 2015-06-29 07:20:10 +00:00 committed by Richard Purdie
parent 38d8f2eb9f
commit cea20425a3
1 changed files with 13 additions and 0 deletions

View File

@ -704,6 +704,19 @@ def check_sanity_everybuild(status, d):
if "." in paths or "./" in paths or "" in paths:
status.addresult("PATH contains '.', './' or '' (empty element), which will break the build, please remove this.\nParsed PATH is " + str(paths) + "\n")
# 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)
try:
f = open(testfile, "w")
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.")
# Check that the DISTRO is valid, if set
# need to take into account DISTRO renaming DISTRO
distro = d.getVar('DISTRO', True)