diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-12-30 19:38:50 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-31 17:10:21 +0000 |
commit | c9c2b6b613bbaf7133d9c3435f3aef3fe4e38f59 (patch) | |
tree | 192a40663b054399ad5f7bf1f30203f9070b6bb1 | |
parent | e73119966a0a20c0e380d9f7f5b5ea48feaf7dbb (diff) | |
download | poky-c9c2b6b613bbaf7133d9c3435f3aef3fe4e38f59.tar.gz |
devtool: process local files only for the main branch
devtool modify/upgrade are not currently equipped to handle conditional local files
in SRC_URI, and provide only the main no-override set in a workspace under
source/component/oe-local-files/ (this is done via meta/classes/devtool-source.bbclass).
On the other hand, updating the changes from workspace into a recipe
is run iteratively against all overrides; this works for patches (as they
all are directed into their own override branches in the workspace
git source tree), but breaks down when trying to match local files
in a workspace against local files in overridden SRC_URI lists, resulting in
bad recipe breakage.
(there's an additional twist here: existing code has a guard against this
but the guard relies on metadata in workspace .bbappend that is only there
in modify operations, but not upgrades. This commit replaces the guard
with a general check that will work everywhere).
Implementing multiple sets of local files is significant work; let's for now
simply not touch local files in recipes except when on the no-override variant.
Also, adjust the selftest cases to include conditional local files in sample
recipes, so the situation is covered by the tests.
(From OE-Core rev: 3a8654b860fa98f94e80c3c3fff359ffed14bbe7)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
5 files changed, 30 insertions, 16 deletions
diff --git a/meta-selftest/recipes-test/devtool/devtool-test-local/file3 b/meta-selftest/recipes-test/devtool/devtool-test-local/file3 new file mode 100644 index 0000000000..0f30e9eec4 --- /dev/null +++ b/meta-selftest/recipes-test/devtool/devtool-test-local/file3 | |||
@@ -0,0 +1 @@ | |||
The third file. | |||
diff --git a/meta-selftest/recipes-test/devtool/devtool-test-local_6.03.bb b/meta-selftest/recipes-test/devtool/devtool-test-local_6.03.bb index 463cfe0a7a..d0fd697978 100644 --- a/meta-selftest/recipes-test/devtool/devtool-test-local_6.03.bb +++ b/meta-selftest/recipes-test/devtool/devtool-test-local_6.03.bb | |||
@@ -7,9 +7,12 @@ SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/syslinux-${PV}.tar.x | |||
7 | file://file1 \ | 7 | file://file1 \ |
8 | file://file2" | 8 | file://file2" |
9 | 9 | ||
10 | SRC_URI:append:class-native = " file://file3" | ||
11 | |||
10 | SRC_URI[md5sum] = "92a253df9211e9c20172796ecf388f13" | 12 | SRC_URI[md5sum] = "92a253df9211e9c20172796ecf388f13" |
11 | SRC_URI[sha256sum] = "26d3986d2bea109d5dc0e4f8c4822a459276cf021125e8c9f23c3cca5d8c850e" | 13 | SRC_URI[sha256sum] = "26d3986d2bea109d5dc0e4f8c4822a459276cf021125e8c9f23c3cca5d8c850e" |
12 | 14 | ||
13 | S = "${WORKDIR}/syslinux-${PV}" | 15 | S = "${WORKDIR}/syslinux-${PV}" |
14 | 16 | ||
15 | EXCLUDE_FROM_WORLD = "1" | 17 | EXCLUDE_FROM_WORLD = "1" |
18 | BBCLASSEXTEND = "native" | ||
diff --git a/meta-selftest/recipes-test/devtool/devtool-test-localonly.bb b/meta-selftest/recipes-test/devtool/devtool-test-localonly.bb index 3f7123cda0..e767619879 100644 --- a/meta-selftest/recipes-test/devtool/devtool-test-localonly.bb +++ b/meta-selftest/recipes-test/devtool/devtool-test-localonly.bb | |||
@@ -4,4 +4,7 @@ INHIBIT_DEFAULT_DEPS = "1" | |||
4 | SRC_URI = "file://file1 \ | 4 | SRC_URI = "file://file1 \ |
5 | file://file2" | 5 | file://file2" |
6 | 6 | ||
7 | SRC_URI:append:class-native = " file://file3" | ||
8 | |||
7 | EXCLUDE_FROM_WORLD = "1" | 9 | EXCLUDE_FROM_WORLD = "1" |
10 | BBCLASSEXTEND = "native" | ||
diff --git a/meta-selftest/recipes-test/devtool/devtool-test-localonly/file3 b/meta-selftest/recipes-test/devtool/devtool-test-localonly/file3 new file mode 100644 index 0000000000..0f30e9eec4 --- /dev/null +++ b/meta-selftest/recipes-test/devtool/devtool-test-localonly/file3 | |||
@@ -0,0 +1 @@ | |||
The third file. | |||
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index f46ce34ad1..d64e18e179 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -1409,6 +1409,18 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1409 | updated = OrderedDict() | 1409 | updated = OrderedDict() |
1410 | added = OrderedDict() | 1410 | added = OrderedDict() |
1411 | removed = OrderedDict() | 1411 | removed = OrderedDict() |
1412 | |||
1413 | # Get current branch and return early with empty lists | ||
1414 | # if on one of the override branches | ||
1415 | # (local files are provided only for the main branch and processing | ||
1416 | # them against lists from recipe overrides will result in mismatches | ||
1417 | # and broken modifications to recipes). | ||
1418 | stdout, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', | ||
1419 | cwd=srctree) | ||
1420 | branchname = stdout.rstrip() | ||
1421 | if branchname.startswith(override_branch_prefix): | ||
1422 | return (updated, added, removed) | ||
1423 | |||
1412 | local_files_dir = os.path.join(srctreebase, 'oe-local-files') | 1424 | local_files_dir = os.path.join(srctreebase, 'oe-local-files') |
1413 | git_files = _git_ls_tree(srctree) | 1425 | git_files = _git_ls_tree(srctree) |
1414 | if 'oe-local-files' in git_files: | 1426 | if 'oe-local-files' in git_files: |
@@ -1638,31 +1650,25 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1638 | tempdir = tempfile.mkdtemp(prefix='devtool') | 1650 | tempdir = tempfile.mkdtemp(prefix='devtool') |
1639 | try: | 1651 | try: |
1640 | local_files_dir = tempfile.mkdtemp(dir=tempdir) | 1652 | local_files_dir = tempfile.mkdtemp(dir=tempdir) |
1641 | if filter_patches: | 1653 | upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase) |
1642 | upd_f = {} | ||
1643 | new_f = {} | ||
1644 | del_f = {} | ||
1645 | else: | ||
1646 | upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase) | ||
1647 | |||
1648 | remove_files = [] | ||
1649 | if not no_remove: | ||
1650 | # Get all patches from source tree and check if any should be removed | ||
1651 | all_patches_dir = tempfile.mkdtemp(dir=tempdir) | ||
1652 | _, _, del_p = _export_patches(srctree, rd, initial_rev, | ||
1653 | all_patches_dir) | ||
1654 | # Remove deleted local files and patches | ||
1655 | remove_files = list(del_f.values()) + list(del_p.values()) | ||
1656 | 1654 | ||
1657 | # Get updated patches from source tree | 1655 | # Get updated patches from source tree |
1658 | patches_dir = tempfile.mkdtemp(dir=tempdir) | 1656 | patches_dir = tempfile.mkdtemp(dir=tempdir) |
1659 | upd_p, new_p, _ = _export_patches(srctree, rd, update_rev, | 1657 | upd_p, new_p, _ = _export_patches(srctree, rd, update_rev, |
1660 | patches_dir, changed_revs) | 1658 | patches_dir, changed_revs) |
1659 | # Get all patches from source tree and check if any should be removed | ||
1660 | all_patches_dir = tempfile.mkdtemp(dir=tempdir) | ||
1661 | _, _, del_p = _export_patches(srctree, rd, initial_rev, | ||
1662 | all_patches_dir) | ||
1661 | logger.debug('Pre-filtering: update: %s, new: %s' % (dict(upd_p), dict(new_p))) | 1663 | logger.debug('Pre-filtering: update: %s, new: %s' % (dict(upd_p), dict(new_p))) |
1662 | if filter_patches: | 1664 | if filter_patches: |
1663 | new_p = OrderedDict() | 1665 | new_p = OrderedDict() |
1664 | upd_p = OrderedDict((k,v) for k,v in upd_p.items() if k in filter_patches) | 1666 | upd_p = OrderedDict((k,v) for k,v in upd_p.items() if k in filter_patches) |
1665 | remove_files = [f for f in remove_files if f in filter_patches] | 1667 | del_p = OrderedDict((k,v) for k,v in del_p.items() if k in filter_patches) |
1668 | remove_files = [] | ||
1669 | if not no_remove: | ||
1670 | # Remove deleted local files and patches | ||
1671 | remove_files = list(del_f.values()) + list(del_p.values()) | ||
1666 | updatefiles = False | 1672 | updatefiles = False |
1667 | updaterecipe = False | 1673 | updaterecipe = False |
1668 | destpath = None | 1674 | destpath = None |