[OE-core] [PATCH] sanity.bbclass: check SSTATE_DIR, DL_DIR and *MIRROR for broken symlinks

Mike Looijmans mike.looijmans at topic.nl
Mon Aug 10 09:10:58 UTC 2015


On 10-08-15 10:18, Mikko.Rapeli at bmw.de wrote:
> On Fri, Jul 31, 2015 at 12:00:15PM +0300, Mikko Rapeli wrote:
...
>> +# Check that path isn't a broken symlink
>> +def check_symlink(lnk):
>> +    if os.path.islink(lnk) and not os.path.exists(lnk):
>> +       return False
>> +    return True

- Bad coding style "if (x) return false".
- Naming a method "check..." suggests to me that it will raise an exception on 
failure.

alternatives:

def is_broken_symlink(lnk):
     return os.path.islink(lnk) and not os.path.exists(lnk)

def check_symlink(lnk, data):
     if os.path.islink(lnk) and not os.path.exists(lnk):
	raise_sanity_error("%s is a broken symlink." % lnk, data)


Kind regards,

Mike Looijmans
System Expert

TOPIC Embedded Products
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
Telefax: +31 (0) 499 33 69 70
E-mail: mike.looijmans at topicproducts.com
Website: www.topicproducts.com

Please consider the environment before printing this e-mail








More information about the Openembedded-core mailing list