diff options
| -rw-r--r-- | meta/lib/oe/recipeutils.py | 12 | ||||
| -rw-r--r-- | scripts/lib/devtool/standard.py | 38 |
2 files changed, 46 insertions, 4 deletions
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py index e7dd8afb08..a0d78dde46 100644 --- a/meta/lib/oe/recipeutils.py +++ b/meta/lib/oe/recipeutils.py | |||
| @@ -400,8 +400,16 @@ def get_recipe_local_files(d, patches=False): | |||
| 400 | bb.utils.exec_flat_python_func('patch_path', uri, fetch, '')): | 400 | bb.utils.exec_flat_python_func('patch_path', uri, fetch, '')): |
| 401 | continue | 401 | continue |
| 402 | # Skip files that are referenced by absolute path | 402 | # Skip files that are referenced by absolute path |
| 403 | if not os.path.isabs(fetch.ud[uri].basepath): | 403 | fname = fetch.ud[uri].basepath |
| 404 | ret[fetch.ud[uri].basepath] = fetch.localpath(uri) | 404 | if os.path.isabs(fname): |
| 405 | continue | ||
| 406 | # Handle subdir= | ||
| 407 | subdir = fetch.ud[uri].parm.get('subdir', '') | ||
| 408 | if subdir: | ||
| 409 | if os.path.isabs(subdir): | ||
| 410 | continue | ||
| 411 | fname = os.path.join(subdir, fname) | ||
| 412 | ret[fname] = fetch.localpath(uri) | ||
| 405 | return ret | 413 | return ret |
| 406 | 414 | ||
| 407 | 415 | ||
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) |
