[OE-core] [PATCH v3] meta/oe/lib/path.py - check mount points, not device

Jason Plum jplum at devonit.com
Wed Jan 29 14:54:49 UTC 2014


On 01/28/14 13:47, Saul Wold wrote:
> On 01/20/2014 11:22 AM, Jason Plum wrote:
>> Signed-off-by: Jason Plum <jplum at devonit.com>
>> ---
>>    meta/lib/oe/path.py | 13 ++++++++++++-
>>    1 file changed, 12 insertions(+), 1 deletion(-)
>>
> This patch is still not applying cleanly to master, I am also still a
> little concerned if this will affect performance since it's used often
> in sstate code.
>
> Have you compared build times with and without this patch?
>
> Sau!
Saul,

I pulled a fresh copy of master when I made this particular send-email 
patch, so it must keep changing from under me. I have the last commit to 
master on this checkout as 9c8d9781794ed0886a79c8ce4544ba98be0ff858

The performance difference should be quite minimal, but I have not 
extensively tested with timing metrics in place.
>> diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
>> index 46783f8..dab20fc 100644
>> --- a/meta/lib/oe/path.py
>> +++ b/meta/lib/oe/path.py
>> @@ -90,7 +90,7 @@ def copyhardlinktree(src, dst):
>>        if os.path.isdir(src) and not len(os.listdir(src)):
>>            return	
>>
>> -    if (os.stat(src).st_dev ==  os.stat(dst).st_dev):
>> +    if (getmount(src) ==  getmount(dst)):
>>            # Need to copy directories only with tar first since cp will error if two
>>            # writers try and create a directory at the same time
>>            cmd = 'cd %s; find . -type d -print | tar -cf - -C %s -p --files-from - --no-recursion | tar -xf - -C %s' % (src, src, dst)
>> @@ -257,3 +257,14 @@ def realpath(file, root, use_physdir = True, loop_cnt = 100, assume_dir = False)
>>            raise
>>
>>        return file
>> +
>> +def getmount(path):
>> +    """ getmount takes a path parameter, uses os.path.realpath with os.path.abspath to
>> +    handle symlink resolution, and returns the path to the mount point of the input path
>> +    """
>> +    path = os.path.realpath(os.path.abspath(path))
>> +    while path != os.path.sep:
>> +        if os.path.ismount(path):
>> +            return path
>> +        path = os.path.abspath(os.path.join(path, os.pardir))
>> +    return path
>> \ No newline at end of file
>>

-- 
Jason Plum
Sr. Software Engineer
Devon IT





More information about the Openembedded-core mailing list