Skip to contentSkip to conversation

meta/oe/lib/path.py - check mount points, not device

PATCH Superseded Jason Plum 2 participants 6 messages Jan 20, 2014 – Feb 21, 2014

lore
Share & tools
lore

Jason Plum

author
#0 lore raw

PATCH v3 1/1 meta/oe/lib/path.py - check mount points, not device

---
 meta/lib/oe/path.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta/lib/oe/path.py +12 -1
index 46783f8..dab20fc 100644
@@ -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
Signature · 1 line
1.8.5.3
author
#1 lore raw

PATCH v3 1/1 meta/oe/lib/path.py - check mount points, not device

---
 meta/lib/oe/path.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta/lib/oe/path.py +12 -1
index 46783f8..dab20fc 100644
@@ -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
Signature · 1 line
1.8.5.3
#2 lore raw
In reply to Jason Plum
Quoted 5 lines · Jason Plum
---
  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!

Quoted 30 lines
meta/lib/oe/path.py +12 -1
index 46783f8..dab20fc 100644
@@ -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
author
#3 lore raw
Quoted 6 lines · Saul Wold
Quoted 5 lines · Jason Plum
---
   meta/lib/oe/path.py | 13 ++++++++++++-
   1 file changed, 12 insertions(+), 1 deletion(-)
Quoted 7 lines

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.

Quoted 30 lines
Quoted 30 lines
meta/lib/oe/path.py +12 -1
index 46783f8..dab20fc 100644
@@ -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
Signature · 3 lines
Jason Plum
Sr. Software Engineer
Devon IT
#4 lore raw
Quoted 15 lines · Jason Plum
Quoted 6 lines · Saul Wold
Quoted 5 lines · Jason Plum
---
   meta/lib/oe/path.py | 13 ++++++++++++-
   1 file changed, 12 insertions(+), 1 deletion(-)
Quoted 7 lines

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!

Quoted 8 lines

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.

Can you describe how much "quite minimal" really is, Richard is still concerned with the impact this might has (see his comment to my Consolidated Pull request).

Sau!

Quoted 36 lines
Quoted 35 lines
Quoted 35 lines
meta/lib/oe/path.py +1 -1
index 46783f8..dab20fc 100644
@@ -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)
meta/lib/oe/path.py +3 -0
@@ -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

meta/lib/oe/path.py +7 -0
+    """
+    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
#5 lore raw
Quoted 22 lines · Saul Wold
Quoted 21 lines · Jason Plum
Quoted 6 lines · Saul Wold
Quoted 5 lines · Jason Plum
---
   meta/lib/oe/path.py | 13 ++++++++++++-
   1 file changed, 12 insertions(+), 1 deletion(-)
Quoted 7 lines

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

Quoted 7 lines
Quoted 2 lines

The performance difference should be quite minimal, but I have not extensively tested with timing metrics in place.

Can you describe how much "quite minimal" really is, Richard is still concerned with the impact this might has (see his comment to my Consolidated Pull request).

Jason,

As mentioned before, there is some concern about this patch, if you could run before and after performance tests with the profile (-P) option and review the results, that would help us feel better about this patch. Also an expanded commit messages explaining more about why this patch is needed would help.

Thanks

Sau!

Quoted 44 lines

Sau!

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
meta/lib/oe/path.py +1 -1
index 46783f8..dab20fc 100644
@@ -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)
meta/lib/oe/path.py +0 -0
@@ -257,3 +257,14 @@ def realpath(file, root, use_physdir = True,
 loop_cnt = 100, assume_dir = False)
           raise
 
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
meta/lib/oe/path.py +3 -0
       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
+ """

Quoted 8 lines

meta/lib/oe/path.py def realpath(file, root, use_physdir = True, loop_cnt = 100, assume_dir = False) · line 270

Quoted 8 lines
meta/lib/oe/path.py +6 -0
+    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

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core