diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2021-07-14 14:25:46 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-06 09:59:14 +0100 |
commit | 4c73242fa1985364841e1be16a33426dac06660d (patch) | |
tree | 8aba587ba53f3ff493bf56a7947688f641db710e /scripts | |
parent | 4f350aa5f6edd170f0a2a38f801449de8d253624 (diff) | |
download | poky-4c73242fa1985364841e1be16a33426dac06660d.tar.gz |
devtool: correctly handle non-standard source tree locations in upgrades
When S is set to a sub-directory of upstream source, the license
checks and the bbappend writing (specifically, setting EXTERNALSRC)
need to operate on that sub-directory.
'devtool modify' already has similar logic, and it was copied from there
and adjusted.
(From OE-Core rev: ddf5a7f3b644915d360f725eca8322187226f171)
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit fd77e356d4507405fde352c8bba7d3842518bbdd)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/devtool/upgrade.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py index 4605355681..a061f26076 100644 --- a/scripts/lib/devtool/upgrade.py +++ b/scripts/lib/devtool/upgrade.py | |||
@@ -520,6 +520,15 @@ def upgrade(args, config, basepath, workspace): | |||
520 | else: | 520 | else: |
521 | srctree = standard.get_default_srctree(config, pn) | 521 | srctree = standard.get_default_srctree(config, pn) |
522 | 522 | ||
523 | # Check that recipe isn't using a shared workdir | ||
524 | s = os.path.abspath(rd.getVar('S')) | ||
525 | workdir = os.path.abspath(rd.getVar('WORKDIR')) | ||
526 | srctree_s = srctree | ||
527 | if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir: | ||
528 | # Handle if S is set to a subdirectory of the source | ||
529 | srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1] | ||
530 | srctree_s = os.path.join(srctree, srcsubdir) | ||
531 | |||
523 | # try to automatically discover latest version and revision if not provided on command line | 532 | # try to automatically discover latest version and revision if not provided on command line |
524 | if not args.version and not args.srcrev: | 533 | if not args.version and not args.srcrev: |
525 | version_info = oe.recipeutils.get_recipe_upstream_version(rd) | 534 | version_info = oe.recipeutils.get_recipe_upstream_version(rd) |
@@ -549,12 +558,12 @@ def upgrade(args, config, basepath, workspace): | |||
549 | try: | 558 | try: |
550 | logger.info('Extracting current version source...') | 559 | logger.info('Extracting current version source...') |
551 | rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides) | 560 | rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides) |
552 | old_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or "")) | 561 | old_licenses = _extract_licenses(srctree_s, (rd.getVar('LIC_FILES_CHKSUM') or "")) |
553 | logger.info('Extracting upgraded version source...') | 562 | logger.info('Extracting upgraded version source...') |
554 | rev2, md5, sha256, srcbranch, srcsubdir2 = _extract_new_source(args.version, srctree, args.no_patch, | 563 | rev2, md5, sha256, srcbranch, srcsubdir2 = _extract_new_source(args.version, srctree, args.no_patch, |
555 | args.srcrev, args.srcbranch, args.branch, args.keep_temp, | 564 | args.srcrev, args.srcbranch, args.branch, args.keep_temp, |
556 | tinfoil, rd) | 565 | tinfoil, rd) |
557 | new_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or "")) | 566 | new_licenses = _extract_licenses(srctree_s, (rd.getVar('LIC_FILES_CHKSUM') or "")) |
558 | license_diff = _generate_license_diff(old_licenses, new_licenses) | 567 | license_diff = _generate_license_diff(old_licenses, new_licenses) |
559 | rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, srcbranch, srcsubdir1, srcsubdir2, config.workspace_path, tinfoil, rd, license_diff, new_licenses, srctree, args.keep_failure) | 568 | rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, srcbranch, srcsubdir1, srcsubdir2, config.workspace_path, tinfoil, rd, license_diff, new_licenses, srctree, args.keep_failure) |
560 | except bb.process.CmdError as e: | 569 | except bb.process.CmdError as e: |
@@ -563,7 +572,7 @@ def upgrade(args, config, basepath, workspace): | |||
563 | _upgrade_error(e, rf, srctree, args.keep_failure) | 572 | _upgrade_error(e, rf, srctree, args.keep_failure) |
564 | standard._add_md5(config, pn, os.path.dirname(rf)) | 573 | standard._add_md5(config, pn, os.path.dirname(rf)) |
565 | 574 | ||
566 | af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2, | 575 | af = _write_append(rf, srctree_s, args.same_dir, args.no_same_dir, rev2, |
567 | copied, config.workspace_path, rd) | 576 | copied, config.workspace_path, rd) |
568 | standard._add_md5(config, pn, af) | 577 | standard._add_md5(config, pn, af) |
569 | 578 | ||