summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oe/path.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 1e24d0586b..c09eda5c42 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -90,7 +90,7 @@ def copytree(src, dst):
90 subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) 90 subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
91 91
92def copyhardlinktree(src, dst): 92def copyhardlinktree(src, dst):
93 """ Make the hard link when possible, otherwise copy. """ 93 """Make a tree of hard links when possible, otherwise copy."""
94 bb.utils.mkdirhier(dst) 94 bb.utils.mkdirhier(dst)
95 if os.path.isdir(src) and not len(os.listdir(src)): 95 if os.path.isdir(src) and not len(os.listdir(src)):
96 return 96 return
@@ -114,6 +114,17 @@ def copyhardlinktree(src, dst):
114 else: 114 else:
115 copytree(src, dst) 115 copytree(src, dst)
116 116
117def copyhardlink(src, dst):
118 """Make a hard link when possible, otherwise copy."""
119
120 # We need to stat the destination directory as the destination file probably
121 # doesn't exist yet.
122 dstdir = os.path.dirname(dst)
123 if os.stat(src).st_dev == os.stat(dstdir).st_dev:
124 os.link(src, dst)
125 else:
126 shutil.copy(src, dst)
127
117def remove(path, recurse=True): 128def remove(path, recurse=True):
118 """ 129 """
119 Equivalent to rm -f or rm -rf 130 Equivalent to rm -f or rm -rf