summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2015-04-30 12:16:07 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-16 22:31:50 +0100
commit89fb8c58c19f72d2751ede475075819c412f4fcf (patch)
tree45786b18c130a59e0a9d8f4a65c6313c457b08e4 /scripts
parent4faa0cdd45270ae0100423cca7c1bce953213f3a (diff)
downloadpoky-89fb8c58c19f72d2751ede475075819c412f4fcf.tar.gz
devtool: extract: remove patches when S=WORKDIR
Before this change, all files from the recipe (SRC_URI), including patches, were added to to srctree repository when S==WORKDIR. The patch files are useless as they are automatically applied on top of the srctree by devtool. This change causes devtool extract to not commit these unnecessary (and possibly confusing) patch file(s) into srctree repository. [YOCTO #7602] (From OE-Core rev: 3e0ffff619e49b1f0c13e5f6a663455be3ed26af) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/standard.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 81a44d4513..3bc84c7418 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -177,6 +177,16 @@ def _parse_recipe(config, tinfoil, pn, appends):
177 return oe.recipeutils.parse_recipe(recipefile, append_files, 177 return oe.recipeutils.parse_recipe(recipefile, append_files,
178 tinfoil.config_data) 178 tinfoil.config_data)
179 179
180
181def _ls_tree(directory):
182 """Recursive listing of files in a directory"""
183 ret = []
184 for root, dirs, files in os.walk(directory):
185 ret.extend([os.path.relpath(os.path.join(root, fname), directory) for
186 fname in files])
187 return ret
188
189
180def extract(args, config, basepath, workspace): 190def extract(args, config, basepath, workspace):
181 import bb 191 import bb
182 192
@@ -196,6 +206,7 @@ def extract(args, config, basepath, workspace):
196 206
197def _extract_source(srctree, keep_temp, devbranch, d): 207def _extract_source(srctree, keep_temp, devbranch, d):
198 import bb.event 208 import bb.event
209 import oe.recipeutils
199 210
200 def eventfilter(name, handler, event, d): 211 def eventfilter(name, handler, event, d):
201 if name == 'base_eventhandler': 212 if name == 'base_eventhandler':
@@ -264,7 +275,21 @@ def _extract_source(srctree, keep_temp, devbranch, d):
264 logger.info('Unpacking...') 275 logger.info('Unpacking...')
265 exec_task_func('do_unpack', False) 276 exec_task_func('do_unpack', False)
266 srcsubdir = crd.getVar('S', True) 277 srcsubdir = crd.getVar('S', True)
267 if srcsubdir != workdir and os.path.dirname(srcsubdir) != workdir: 278 if srcsubdir == workdir:
279 # Find non-patch sources that were "unpacked" to srctree directory
280 recipe_patches = [os.path.basename(patch) for patch in
281 oe.recipeutils.get_recipe_patches(crd)]
282 src_files = [fname for fname in _ls_tree(workdir) if
283 os.path.basename(fname) not in recipe_patches]
284 # Force separate S so that patch files can be left out from srctree
285 srcsubdir = tempfile.mkdtemp(dir=workdir)
286 crd.setVar('S', srcsubdir)
287 # Move source files to S
288 for path in src_files:
289 tgt_dir = os.path.join(srcsubdir, os.path.dirname(path))
290 bb.utils.mkdirhier(tgt_dir)
291 shutil.move(os.path.join(workdir, path), tgt_dir)
292 elif os.path.dirname(srcsubdir) != workdir:
268 # Handle if S is set to a subdirectory of the source 293 # Handle if S is set to a subdirectory of the source
269 srcsubdir = os.path.join(workdir, os.path.relpath(srcsubdir, workdir).split(os.sep)[0]) 294 srcsubdir = os.path.join(workdir, os.path.relpath(srcsubdir, workdir).split(os.sep)[0])
270 295