diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/devtool/standard.py | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 98451da441..baef23e467 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -307,6 +307,13 @@ def _move_file(src, dst): | |||
307 | bb.utils.mkdirhier(dst_d) | 307 | bb.utils.mkdirhier(dst_d) |
308 | shutil.move(src, dst) | 308 | shutil.move(src, dst) |
309 | 309 | ||
310 | def _copy_file(src, dst): | ||
311 | """Copy a file. Creates all the directory components of destination path.""" | ||
312 | dst_d = os.path.dirname(dst) | ||
313 | if dst_d: | ||
314 | bb.utils.mkdirhier(dst_d) | ||
315 | shutil.copy(src, dst) | ||
316 | |||
310 | def _git_ls_tree(repodir, treeish='HEAD', recursive=False): | 317 | def _git_ls_tree(repodir, treeish='HEAD', recursive=False): |
311 | """List contents of a git treeish""" | 318 | """List contents of a git treeish""" |
312 | import bb | 319 | import bb |
@@ -1050,6 +1057,23 @@ def _export_local_files(srctree, rd, destdir): | |||
1050 | elif fname != '.gitignore': | 1057 | elif fname != '.gitignore': |
1051 | added[fname] = None | 1058 | added[fname] = None |
1052 | 1059 | ||
1060 | workdir = rd.getVar('WORKDIR', True) | ||
1061 | s = rd.getVar('S', True) | ||
1062 | if not s.endswith(os.sep): | ||
1063 | s += os.sep | ||
1064 | |||
1065 | if workdir != s: | ||
1066 | # Handle files where subdir= was specified | ||
1067 | for fname in list(existing_files.keys()): | ||
1068 | # FIXME handle both subdir starting with BP and not? | ||
1069 | fworkpath = os.path.join(workdir, fname) | ||
1070 | if fworkpath.startswith(s): | ||
1071 | fpath = os.path.join(srctree, os.path.relpath(fworkpath, s)) | ||
1072 | if os.path.exists(fpath): | ||
1073 | origpath = existing_files.pop(fname) | ||
1074 | if not filecmp.cmp(origpath, fpath): | ||
1075 | updated[fpath] = origpath | ||
1076 | |||
1053 | removed = existing_files | 1077 | removed = existing_files |
1054 | return (updated, added, removed) | 1078 | return (updated, added, removed) |
1055 | 1079 | ||
@@ -1122,7 +1146,12 @@ def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remo | |||
1122 | files_dir = _determine_files_dir(rd) | 1146 | files_dir = _determine_files_dir(rd) |
1123 | for basepath, path in upd_f.items(): | 1147 | for basepath, path in upd_f.items(): |
1124 | logger.info('Updating file %s' % basepath) | 1148 | logger.info('Updating file %s' % basepath) |
1125 | _move_file(os.path.join(local_files_dir, basepath), path) | 1149 | if os.path.isabs(basepath): |
1150 | # Original file (probably with subdir pointing inside source tree) | ||
1151 | # so we do not want to move it, just copy | ||
1152 | _copy_file(basepath, path) | ||
1153 | else: | ||
1154 | _move_file(os.path.join(local_files_dir, basepath), path) | ||
1126 | update_srcuri= True | 1155 | update_srcuri= True |
1127 | for basepath, path in new_f.items(): | 1156 | for basepath, path in new_f.items(): |
1128 | logger.info('Adding new file %s' % basepath) | 1157 | logger.info('Adding new file %s' % basepath) |
@@ -1205,7 +1234,12 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1205 | # Update existing files | 1234 | # Update existing files |
1206 | for basepath, path in upd_f.items(): | 1235 | for basepath, path in upd_f.items(): |
1207 | logger.info('Updating file %s' % basepath) | 1236 | logger.info('Updating file %s' % basepath) |
1208 | _move_file(os.path.join(local_files_dir, basepath), path) | 1237 | if os.path.isabs(basepath): |
1238 | # Original file (probably with subdir pointing inside source tree) | ||
1239 | # so we do not want to move it, just copy | ||
1240 | _copy_file(basepath, path) | ||
1241 | else: | ||
1242 | _move_file(os.path.join(local_files_dir, basepath), path) | ||
1209 | updatefiles = True | 1243 | updatefiles = True |
1210 | for basepath, path in upd_p.items(): | 1244 | for basepath, path in upd_p.items(): |
1211 | patchfn = os.path.join(patches_dir, basepath) | 1245 | patchfn = os.path.join(patches_dir, basepath) |