summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/devtool15
-rw-r--r--scripts/lib/devtool/standard.py24
2 files changed, 26 insertions, 13 deletions
diff --git a/scripts/devtool b/scripts/devtool
index 5292f187e5..87bb5c8323 100755
--- a/scripts/devtool
+++ b/scripts/devtool
@@ -113,6 +113,7 @@ def read_workspace():
113 externalsrc_re = re.compile(r'^EXTERNALSRC(_pn-([^ =]+))? *= *"([^"]*)"$') 113 externalsrc_re = re.compile(r'^EXTERNALSRC(_pn-([^ =]+))? *= *"([^"]*)"$')
114 for fn in glob.glob(os.path.join(config.workspace_path, 'appends', '*.bbappend')): 114 for fn in glob.glob(os.path.join(config.workspace_path, 'appends', '*.bbappend')):
115 with open(fn, 'r') as f: 115 with open(fn, 'r') as f:
116 pnvalues = {}
116 for line in f: 117 for line in f:
117 res = externalsrc_re.match(line.rstrip()) 118 res = externalsrc_re.match(line.rstrip())
118 if res: 119 if res:
@@ -125,10 +126,16 @@ def read_workspace():
125 bbfile)) 126 bbfile))
126 if recipefile: 127 if recipefile:
127 recipefile = recipefile[0] 128 recipefile = recipefile[0]
128 workspace[pn] = {'srctree': res.group(3), 129 pnvalues['srctree'] = res.group(3)
129 'bbappend': fn, 130 pnvalues['bbappend'] = fn
130 'recipefile': recipefile} 131 pnvalues['recipefile'] = recipefile
131 logger.debug('Found recipe %s' % workspace[pn]) 132 elif line.startswith('# srctreebase: '):
133 pnvalues['srctreebase'] = line.split(':', 1)[1].strip()
134 if pnvalues:
135 if not pnvalues.get('srctreebase', None):
136 pnvalues['srctreebase'] = pnvalues['srctree']
137 logger.debug('Found recipe %s' % pnvalues)
138 workspace[pn] = pnvalues
132 139
133def create_workspace(args, config, basepath, workspace): 140def create_workspace(args, config, basepath, workspace):
134 if args.layerpath: 141 if args.layerpath:
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: