From fcb84383ce9b555c13772515ec4f1f1f9b34737d Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 30 Oct 2017 17:16:56 +1300 Subject: devtool: upgrade: automatically handle changes to source subdirectory If the directory where the source code extracts to changes (for example, when upgrading iucode-tool from 1.5 to 2.1.1, the subdirectory in the tarball changed from "iucode_tool-${PV}" to "iucode-tool-${PV}") then handle this automatically. Also handle when it changes to match the default S value (i.e. "${WORKDIR}/${BP}") in which case we just drop setting S in the recipe. Fixes [YOCTO #10939]. (From OE-Core rev: d29881a652bf03627d257a1eac5f02ec17315b8b) Signed-off-by: Paul Eggleton Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- scripts/lib/devtool/standard.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scripts/lib/devtool/standard.py') diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 166862f12f..5ac678b3b1 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -409,7 +409,7 @@ def extract(args, config, basepath, workspace): return 1 srctree = os.path.abspath(args.srctree) - initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, config, basepath, workspace, args.fixed_setup, rd, tinfoil) + initial_rev, _ = _extract_source(srctree, args.keep_temp, args.branch, False, config, basepath, workspace, args.fixed_setup, rd, tinfoil) logger.info('Source tree extracted to %s' % srctree) if initial_rev: @@ -433,7 +433,7 @@ def sync(args, config, basepath, workspace): return 1 srctree = os.path.abspath(args.srctree) - initial_rev = _extract_source(srctree, args.keep_temp, args.branch, True, config, basepath, workspace, args.fixed_setup, rd, tinfoil) + initial_rev, _ = _extract_source(srctree, args.keep_temp, args.branch, True, config, basepath, workspace, args.fixed_setup, rd, tinfoil) logger.info('Source tree %s synchronized' % srctree) if initial_rev: @@ -549,6 +549,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works with open(os.path.join(tempdir, 'srcsubdir'), 'r') as f: srcsubdir = f.read() + srcsubdir_rel = os.path.relpath(srcsubdir, os.path.join(tempdir, 'workdir')) tempdir_localdir = os.path.join(tempdir, 'oe-local-files') srctree_localdir = os.path.join(srctree, 'oe-local-files') @@ -615,7 +616,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works logger.info('Preserving temporary directory %s' % tempdir) else: shutil.rmtree(tempdir) - return initial_rev + return initial_rev, srcsubdir_rel def _add_md5(config, recipename, filename): """Record checksum of a file (or recursively for a directory) to the md5-file of the workspace""" @@ -713,7 +714,7 @@ def modify(args, config, basepath, workspace): initial_rev = None commits = [] if not args.no_extract: - initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, config, basepath, workspace, args.fixed_setup, rd, tinfoil) + initial_rev, _ = _extract_source(srctree, args.keep_temp, args.branch, False, config, basepath, workspace, args.fixed_setup, rd, tinfoil) if not initial_rev: return 1 logger.info('Source tree extracted to %s' % srctree) -- cgit v1.2.3-54-g00ecf