summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-09-29 15:26:22 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-11 12:14:27 +0000
commit1d31cee42d7fdd0f7881a44447492efc2db3c95a (patch)
tree3c7b8415aa1b343f69a3abee3320704e9143ca22 /scripts/lib
parent7bab0de6cb9c973a96b9bd8ab55b8f50a1087f34 (diff)
downloadpoky-1d31cee42d7fdd0f7881a44447492efc2db3c95a.tar.gz
devtool: fix handling of oe-local-files when source is in a subdirectory
If S points to a subdirectory of the source rather than the "base" of the source tree then we weren't handling the oe-local-files directory properly - it got extracted to the base of the tree but devtool update-recipe and devtool finish assumed it would be under S which would be the subdirectory, thus it would be missing and devtool would assume the files had been deleted and remove them from the recipe. Record the base of the source tree in the bbappend and read it into the in-memory workspace so we can use that to find out where oe-local-files should be found. (From OE-Core rev: 30d2ea67b2c4727e23d06a35745b1afa64b130cc) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/devtool/standard.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index beea0d4c27..8e4c7f7b13 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -734,6 +734,9 @@ def modify(args, config, basepath, workspace):
734 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) 734 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree)
735 initial_rev = stdout.rstrip() 735 initial_rev = stdout.rstrip()
736 736
737 # Need to grab this here in case the source is within a subdirectory
738 srctreebase = srctree
739
737 # Check that recipe isn't using a shared workdir 740 # Check that recipe isn't using a shared workdir
738 s = os.path.abspath(rd.getVar('S')) 741 s = os.path.abspath(rd.getVar('S'))
739 workdir = os.path.abspath(rd.getVar('WORKDIR')) 742 workdir = os.path.abspath(rd.getVar('WORKDIR'))
@@ -748,7 +751,8 @@ def modify(args, config, basepath, workspace):
748 # Local files can be modified/tracked in separate subdir under srctree 751 # Local files can be modified/tracked in separate subdir under srctree
749 # Mostly useful for packages with S != WORKDIR 752 # Mostly useful for packages with S != WORKDIR
750 f.write('FILESPATH_prepend := "%s:"\n' % 753 f.write('FILESPATH_prepend := "%s:"\n' %
751 os.path.join(srctree, 'oe-local-files')) 754 os.path.join(srctreebase, 'oe-local-files'))
755 f.write('# srctreebase: %s\n' % srctreebase)
752 756
753 f.write('\ninherit externalsrc\n') 757 f.write('\ninherit externalsrc\n')
754 f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND\n') 758 f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND\n')
@@ -1166,7 +1170,7 @@ def _create_kconfig_diff(srctree, rd, outfile):
1166 return False 1170 return False
1167 1171
1168 1172
1169def _export_local_files(srctree, rd, destdir): 1173def _export_local_files(srctree, rd, destdir, srctreebase):
1170 """Copy local files from srctree to given location. 1174 """Copy local files from srctree to given location.
1171 Returns three-tuple of dicts: 1175 Returns three-tuple of dicts:
1172 1. updated - files that already exist in SRCURI 1176 1. updated - files that already exist in SRCURI
@@ -1186,7 +1190,7 @@ def _export_local_files(srctree, rd, destdir):
1186 updated = OrderedDict() 1190 updated = OrderedDict()
1187 added = OrderedDict() 1191 added = OrderedDict()
1188 removed = OrderedDict() 1192 removed = OrderedDict()
1189 local_files_dir = os.path.join(srctree, 'oe-local-files') 1193 local_files_dir = os.path.join(srctreebase, 'oe-local-files')
1190 git_files = _git_ls_tree(srctree) 1194 git_files = _git_ls_tree(srctree)
1191 if 'oe-local-files' in git_files: 1195 if 'oe-local-files' in git_files:
1192 # If tracked by Git, take the files from srctree HEAD. First get 1196 # If tracked by Git, take the files from srctree HEAD. First get
@@ -1199,9 +1203,9 @@ def _export_local_files(srctree, rd, destdir):
1199 new_set = list(_git_ls_tree(srctree, tree, True).keys()) 1203 new_set = list(_git_ls_tree(srctree, tree, True).keys())
1200 elif os.path.isdir(local_files_dir): 1204 elif os.path.isdir(local_files_dir):
1201 # If not tracked by Git, just copy from working copy 1205 # If not tracked by Git, just copy from working copy
1202 new_set = _ls_tree(os.path.join(srctree, 'oe-local-files')) 1206 new_set = _ls_tree(local_files_dir)
1203 bb.process.run(['cp', '-ax', 1207 bb.process.run(['cp', '-ax',
1204 os.path.join(srctree, 'oe-local-files', '.'), destdir]) 1208 os.path.join(local_files_dir, '.'), destdir])
1205 else: 1209 else:
1206 new_set = [] 1210 new_set = []
1207 1211
@@ -1266,7 +1270,7 @@ def _determine_files_dir(rd):
1266 return os.path.join(recipedir, rd.getVar('BPN')) 1270 return os.path.join(recipedir, rd.getVar('BPN'))
1267 1271
1268 1272
1269def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remove): 1273def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove):
1270 """Implement the 'srcrev' mode of update-recipe""" 1274 """Implement the 'srcrev' mode of update-recipe"""
1271 import bb 1275 import bb
1272 import oe.recipeutils 1276 import oe.recipeutils
@@ -1294,7 +1298,8 @@ def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remo
1294 update_srcuri = False 1298 update_srcuri = False
1295 try: 1299 try:
1296 local_files_dir = tempfile.mkdtemp(dir=tempdir) 1300 local_files_dir = tempfile.mkdtemp(dir=tempdir)
1297 upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir) 1301 srctreebase = workspace[recipename]['srctreebase']
1302 upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase)
1298 if not no_remove: 1303 if not no_remove:
1299 # Find list of existing patches in recipe file 1304 # Find list of existing patches in recipe file
1300 patches_dir = tempfile.mkdtemp(dir=tempdir) 1305 patches_dir = tempfile.mkdtemp(dir=tempdir)
@@ -1372,7 +1377,8 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
1372 tempdir = tempfile.mkdtemp(prefix='devtool') 1377 tempdir = tempfile.mkdtemp(prefix='devtool')
1373 try: 1378 try:
1374 local_files_dir = tempfile.mkdtemp(dir=tempdir) 1379 local_files_dir = tempfile.mkdtemp(dir=tempdir)
1375 upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir) 1380 srctreebase = workspace[recipename]['srctreebase']
1381 upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase)
1376 1382
1377 remove_files = [] 1383 remove_files = []
1378 if not no_remove: 1384 if not no_remove:
@@ -1495,7 +1501,7 @@ def _update_recipe(recipename, workspace, rd, mode, appendlayerdir, wildcard_ver
1495 mode = _guess_recipe_update_mode(srctree, rd) 1501 mode = _guess_recipe_update_mode(srctree, rd)
1496 1502
1497 if mode == 'srcrev': 1503 if mode == 'srcrev':
1498 updated = _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remove) 1504 updated = _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove)
1499 elif mode == 'patch': 1505 elif mode == 'patch':
1500 updated = _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove, initial_rev) 1506 updated = _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove, initial_rev)
1501 else: 1507 else: