sanity.bbclass: Check if /tmp is writable
PATCH 1/1 sanity.bbclass: Check if /tmp is writable
In reply to a message not in the archiveFrom: Mariano Lopez <[email protected]>
If /tmp can't be written, bitbake gaves an unrelated error. This checks if /tmp can be written in every build.
[YOCTO #7922]
Signed-off-by Mariano Lopez <[email protected]>
--- meta/classes/sanity.bbclass | 13 +++++++++++++ 1 file changed, 13 insertions(+)
meta/classes/sanity.bbclass +13 -0
@@ -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)
Signature · 1 line
1.8.4.5
meta/classes/sanity.bbclass def check_sanity_everybuild(status, d): · line 711
Quoted 6 lines · On 29 June 2015 at 08:20, <[email protected]> wrote:
meta/classes/sanity.bbclass +5
-0+ # 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)
Use tempfile.mkstemp() here, we'll get proper unique names and it will use the same temporary directory as gcc etc.
Quoted 9 lines
meta/classes/sanity.bbclass +7
-0+ 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 yourfilesystem.")
The error should include the message from the exception to help root-cause the problem.
Ross