mirror of
https://git.yoctoproject.org/poky
synced 2026-06-10 04:00:28 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
b250b5c7be
commit
45772bab32
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user