[oe] [PATCH] packaged-staging.bbclass: use 'os.unlink()' instead of spawning 'rm'

Enrico Scholz enrico.scholz at sigma-chemnitz.de
Wed Mar 17 10:00:57 UTC 2010


Tom Rini <tom_rini at mentor.com> writes:

> On Tue, 2010-03-16 at 13:23 +0100, Enrico Scholz wrote:
>> Doing a '-c clean' operation on a staged package with very much files
>> (e.g. glibc) took several minutes because
>> 
>> * every removed file was reported
>> * an 'rm' instance was spawned for every file
>> 
>> This patch uses the native 'os.unlink()' method for removing files and
>> reports only the removed root directory instead of the single files.
>
> We call os.unlink by itself in other places.  If we don't wrap it, could
> we get an exception, really (that wouldn't otherwise be a bug to fix) ?

os.unlink() throws an exception:

$ python -c 'import os; os.unlink("xxx")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
OSError: [Errno 2] No such file or directory: 'xxx'


When I worked on the patch I got such an exception (at least in one of
the hunks which replace 'rm -f').  I decided to be tolerant on errors
because there is no way to recover when '-c clean' fails.



Enrico




More information about the Openembedded-devel mailing list