diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2021-07-14 14:25:46 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-07-16 21:23:43 +0100 |
commit | 59cb4c7c3c6ac505cdf81b58829048bd94815f20 (patch) | |
tree | b23f5021bceaaf4c02e0e4f657754d17d1beb85d /scripts | |
parent | a1ed2c1d8777a1e800e32715f8656fe8fcab7516 (diff) | |
download | poky-59cb4c7c3c6ac505cdf81b58829048bd94815f20.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: fd77e356d4507405fde352c8bba7d3842518bbdd)
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>
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 c6d98299da..da1456a01a 100644 --- a/scripts/lib/devtool/upgrade.py +++ b/scripts/lib/devtool/upgrade.py | |||
@@ -521,6 +521,15 @@ def upgrade(args, config, basepath, workspace): | |||
521 | else: | 521 | else: |
522 | srctree = standard.get_default_srctree(config, pn) | 522 | srctree = standard.get_default_srctree(config, pn) |
523 | 523 | ||
524 | # Check that recipe isn't using a shared workdir | ||
525 | s = os.path.abspath(rd.getVar('S')) | ||
526 | workdir = os.path.abspath(rd.getVar('WORKDIR')) | ||
527 | srctree_s = srctree | ||
528 | if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir: | ||
529 | # Handle if S is set to a subdirectory of the source | ||
530 | srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1] | ||
531 | srctree_s = os.path.join(srctree, srcsubdir) | ||
532 | |||
524 | # try to automatically discover latest version and revision if not provided on command line | 533 | # try to automatically discover latest version and revision if not provided on command line |
525 | if not args.version and not args.srcrev: | 534 | if not args.version and not args.srcrev: |
526 | version_info = oe.recipeutils.get_recipe_upstream_version(rd) | 535 | version_info = oe.recipeutils.get_recipe_upstream_version(rd) |
@@ -550,12 +559,12 @@ def upgrade(args, config, basepath, workspace): | |||
550 | try: | 559 | try: |
551 | logger.info('Extracting current version source...') | 560 | logger.info('Extracting current version source...') |
552 | rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides) | 561 | rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides) |
553 | old_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or "")) | 562 | old_licenses = _extract_licenses(srctree_s, (rd.getVar('LIC_FILES_CHKSUM') or "")) |
554 | logger.info('Extracting upgraded version source...') | 563 | logger.info('Extracting upgraded version source...') |
555 | rev2, md5, sha256, srcbranch, srcsubdir2 = _extract_new_source(args.version, srctree, args.no_patch, | 564 | rev2, md5, sha256, srcbranch, srcsubdir2 = _extract_new_source(args.version, srctree, args.no_patch, |
556 | args.srcrev, args.srcbranch, args.branch, args.keep_temp, | 565 | args.srcrev, args.srcbranch, args.branch, args.keep_temp, |
557 | tinfoil, rd) | 566 | tinfoil, rd) |
558 | new_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or "")) | 567 | new_licenses = _extract_licenses(srctree_s, (rd.getVar('LIC_FILES_CHKSUM') or "")) |
559 | license_diff = _generate_license_diff(old_licenses, new_licenses) | 568 | license_diff = _generate_license_diff(old_licenses, new_licenses) |
560 | 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) | 569 | 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) |
561 | except bb.process.CmdError as e: | 570 | except bb.process.CmdError as e: |
@@ -564,7 +573,7 @@ def upgrade(args, config, basepath, workspace): | |||
564 | _upgrade_error(e, rf, srctree, args.keep_failure) | 573 | _upgrade_error(e, rf, srctree, args.keep_failure) |
565 | standard._add_md5(config, pn, os.path.dirname(rf)) | 574 | standard._add_md5(config, pn, os.path.dirname(rf)) |
566 | 575 | ||
567 | af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2, | 576 | af = _write_append(rf, srctree_s, args.same_dir, args.no_same_dir, rev2, |
568 | copied, config.workspace_path, rd) | 577 | copied, config.workspace_path, rd) |
569 | standard._add_md5(config, pn, af) | 578 | standard._add_md5(config, pn, af) |
570 | 579 | ||