diff options
author | Paul Eggleton <paul.eggleton@microsoft.com> | 2022-07-12 18:41:24 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-07-14 23:22:09 +0100 |
commit | da71c928cd0e3dceae47993e7edbf4a35292e5de (patch) | |
tree | fb70dbca92e842b3dc444d73923fefd19240fdf0 /scripts/lib | |
parent | 3a2a5847371fe59efd2e430c69f03f3fe4dc873d (diff) | |
download | poky-da71c928cd0e3dceae47993e7edbf4a35292e5de.tar.gz |
devtool: finish: handle patching when S points to subdir of a git repo
If devtool finish needs to create a patch and have it applied to the
sources for a recipe where S points to a subdirectory of the sources,
then the patch needs to be applied at the root of the repo i.e. we need
to add a patchdir= parameter to the SRC_URI entry.
(From OE-Core rev: ad3736d9ca14cac14a7da22c1cfdeda219665e6f)
Signed-off-by: Paul Eggleton <paul.eggleton@microsoft.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/devtool/standard.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index e53569c5cc..c98bfe8195 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -1606,6 +1606,19 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1606 | if not os.path.exists(append): | 1606 | if not os.path.exists(append): |
1607 | raise DevtoolError('unable to find workspace bbappend for recipe %s' % | 1607 | raise DevtoolError('unable to find workspace bbappend for recipe %s' % |
1608 | recipename) | 1608 | recipename) |
1609 | srctreebase = workspace[recipename]['srctreebase'] | ||
1610 | relpatchdir = os.path.relpath(srctreebase, srctree) | ||
1611 | if relpatchdir == '.': | ||
1612 | patchdir_params = {} | ||
1613 | else: | ||
1614 | patchdir_params = {'patchdir': relpatchdir} | ||
1615 | |||
1616 | def srcuri_entry(fname): | ||
1617 | if patchdir_params: | ||
1618 | paramstr = ';' + ';'.join('%s=%s' % (k,v) for k,v in patchdir_params.items()) | ||
1619 | else: | ||
1620 | paramstr = '' | ||
1621 | return 'file://%s%s' % (basepath, paramstr) | ||
1609 | 1622 | ||
1610 | initial_rev, update_rev, changed_revs, filter_patches = _get_patchset_revs(srctree, append, initial_rev, force_patch_refresh) | 1623 | initial_rev, update_rev, changed_revs, filter_patches = _get_patchset_revs(srctree, append, initial_rev, force_patch_refresh) |
1611 | if not initial_rev: | 1624 | if not initial_rev: |
@@ -1627,7 +1640,6 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1627 | new_f = {} | 1640 | new_f = {} |
1628 | del_f = {} | 1641 | del_f = {} |
1629 | else: | 1642 | else: |
1630 | srctreebase = workspace[recipename]['srctreebase'] | ||
1631 | upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase) | 1643 | upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase) |
1632 | 1644 | ||
1633 | remove_files = [] | 1645 | remove_files = [] |
@@ -1663,14 +1675,15 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1663 | removedentries, remaining = _remove_file_entries( | 1675 | removedentries, remaining = _remove_file_entries( |
1664 | srcuri, remove_files) | 1676 | srcuri, remove_files) |
1665 | if removedentries or remaining: | 1677 | if removedentries or remaining: |
1666 | remaining = ['file://' + os.path.basename(item) for | 1678 | remaining = [srcuri_entry(os.path.basename(item)) for |
1667 | item in remaining] | 1679 | item in remaining] |
1668 | removevalues = {'SRC_URI': removedentries + remaining} | 1680 | removevalues = {'SRC_URI': removedentries + remaining} |
1669 | appendfile, destpath = oe.recipeutils.bbappend_recipe( | 1681 | appendfile, destpath = oe.recipeutils.bbappend_recipe( |
1670 | rd, appendlayerdir, files, | 1682 | rd, appendlayerdir, files, |
1671 | wildcardver=wildcard_version, | 1683 | wildcardver=wildcard_version, |
1672 | removevalues=removevalues, | 1684 | removevalues=removevalues, |
1673 | redirect_output=dry_run_outdir) | 1685 | redirect_output=dry_run_outdir, |
1686 | params=[patchdir_params] * len(files)) | ||
1674 | else: | 1687 | else: |
1675 | logger.info('No patches or local source files needed updating') | 1688 | logger.info('No patches or local source files needed updating') |
1676 | else: | 1689 | else: |
@@ -1694,7 +1707,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1694 | # replace the entry in SRC_URI with our local version | 1707 | # replace the entry in SRC_URI with our local version |
1695 | logger.info('Replacing remote patch %s with updated local version' % basepath) | 1708 | logger.info('Replacing remote patch %s with updated local version' % basepath) |
1696 | path = os.path.join(files_dir, basepath) | 1709 | path = os.path.join(files_dir, basepath) |
1697 | _replace_srcuri_entry(srcuri, basepath, 'file://%s' % basepath) | 1710 | _replace_srcuri_entry(srcuri, basepath, srcuri_entry(basepath)) |
1698 | updaterecipe = True | 1711 | updaterecipe = True |
1699 | else: | 1712 | else: |
1700 | logger.info('Updating patch %s%s' % (basepath, dry_run_suffix)) | 1713 | logger.info('Updating patch %s%s' % (basepath, dry_run_suffix)) |
@@ -1708,7 +1721,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1708 | os.path.join(files_dir, basepath), | 1721 | os.path.join(files_dir, basepath), |
1709 | dry_run_outdir=dry_run_outdir, | 1722 | dry_run_outdir=dry_run_outdir, |
1710 | base_outdir=recipedir) | 1723 | base_outdir=recipedir) |
1711 | srcuri.append('file://%s' % basepath) | 1724 | srcuri.append(srcuri_entry(basepath)) |
1712 | updaterecipe = True | 1725 | updaterecipe = True |
1713 | for basepath, path in new_p.items(): | 1726 | for basepath, path in new_p.items(): |
1714 | logger.info('Adding new patch %s%s' % (basepath, dry_run_suffix)) | 1727 | logger.info('Adding new patch %s%s' % (basepath, dry_run_suffix)) |
@@ -1716,7 +1729,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1716 | os.path.join(files_dir, basepath), | 1729 | os.path.join(files_dir, basepath), |
1717 | dry_run_outdir=dry_run_outdir, | 1730 | dry_run_outdir=dry_run_outdir, |
1718 | base_outdir=recipedir) | 1731 | base_outdir=recipedir) |
1719 | srcuri.append('file://%s' % basepath) | 1732 | srcuri.append(srcuri_entry(basepath)) |
1720 | updaterecipe = True | 1733 | updaterecipe = True |
1721 | # Update recipe, if needed | 1734 | # Update recipe, if needed |
1722 | if _remove_file_entries(srcuri, remove_files)[0]: | 1735 | if _remove_file_entries(srcuri, remove_files)[0]: |