[OE-core] [PATCH 1/1] sanity.bbclass: Check if /tmp is writable

Burton, Ross ross.burton at intel.com
Tue Jun 30 11:28:04 UTC 2015


On 29 June 2015 at 08:20, <mariano.lopez at linux.intel.com> wrote:

> +    # 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.


> +    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.")
>

The error should include the message from the exception to help root-cause
the problem.

Ross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20150630/bda13b0f/attachment-0002.html>


More information about the Openembedded-core mailing list