[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    [OE-core] [PATCH 1/1] sanity.bbclass: Check if /tmp is writable
From:       ross.burton () intel ! com (Burton, Ross)
Date:       2015-06-30 11:28:04
Message-ID: CAJTo0Lagc1WxOA40u4j5Gfu7vLbG-onEpLZ7-u4RPnpv06dTrw () mail ! gmail ! com
[Download RAW message or body]

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.html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic