mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00
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>
This commit is contained in:
parent
e73119966a
commit
c9c2b6b613
|
@ -0,0 +1 @@
|
|||
The third file.
|
|
@ -7,9 +7,12 @@ SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/syslinux-${PV}.tar.x
|
|||
file://file1 \
|
||||
file://file2"
|
||||
|
||||
SRC_URI:append:class-native = " file://file3"
|
||||
|
||||
SRC_URI[md5sum] = "92a253df9211e9c20172796ecf388f13"
|
||||
SRC_URI[sha256sum] = "26d3986d2bea109d5dc0e4f8c4822a459276cf021125e8c9f23c3cca5d8c850e"
|
||||
|
||||
S = "${WORKDIR}/syslinux-${PV}"
|
||||
|
||||
EXCLUDE_FROM_WORLD = "1"
|
||||
BBCLASSEXTEND = "native"
|
||||
|
|
|
@ -4,4 +4,7 @@ INHIBIT_DEFAULT_DEPS = "1"
|
|||
SRC_URI = "file://file1 \
|
||||
file://file2"
|
||||
|
||||
SRC_URI:append:class-native = " file://file3"
|
||||
|
||||
EXCLUDE_FROM_WORLD = "1"
|
||||
BBCLASSEXTEND = "native"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
The third file.
|
|
@ -1409,6 +1409,18 @@ def _export_local_files(srctree, rd, destdir, srctreebase):
|
|||
updated = OrderedDict()
|
||||
added = OrderedDict()
|
||||
removed = OrderedDict()
|
||||
|
||||
# Get current branch and return early with empty lists
|
||||
# if on one of the override branches
|
||||
# (local files are provided only for the main branch and processing
|
||||
# them against lists from recipe overrides will result in mismatches
|
||||
# and broken modifications to recipes).
|
||||
stdout, _ = bb.process.run('git rev-parse --abbrev-ref HEAD',
|
||||
cwd=srctree)
|
||||
branchname = stdout.rstrip()
|
||||
if branchname.startswith(override_branch_prefix):
|
||||
return (updated, added, removed)
|
||||
|
||||
local_files_dir = os.path.join(srctreebase, 'oe-local-files')
|
||||
git_files = _git_ls_tree(srctree)
|
||||
if 'oe-local-files' in git_files:
|
||||
|
@ -1638,31 +1650,25 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
|
|||
tempdir = tempfile.mkdtemp(prefix='devtool')
|
||||
try:
|
||||
local_files_dir = tempfile.mkdtemp(dir=tempdir)
|
||||
if filter_patches:
|
||||
upd_f = {}
|
||||
new_f = {}
|
||||
del_f = {}
|
||||
else:
|
||||
upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase)
|
||||
|
||||
remove_files = []
|
||||
if not no_remove:
|
||||
# Get all patches from source tree and check if any should be removed
|
||||
all_patches_dir = tempfile.mkdtemp(dir=tempdir)
|
||||
_, _, del_p = _export_patches(srctree, rd, initial_rev,
|
||||
all_patches_dir)
|
||||
# Remove deleted local files and patches
|
||||
remove_files = list(del_f.values()) + list(del_p.values())
|
||||
upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase)
|
||||
|
||||
# Get updated patches from source tree
|
||||
patches_dir = tempfile.mkdtemp(dir=tempdir)
|
||||
upd_p, new_p, _ = _export_patches(srctree, rd, update_rev,
|
||||
patches_dir, changed_revs)
|
||||
# Get all patches from source tree and check if any should be removed
|
||||
all_patches_dir = tempfile.mkdtemp(dir=tempdir)
|
||||
_, _, del_p = _export_patches(srctree, rd, initial_rev,
|
||||
all_patches_dir)
|
||||
logger.debug('Pre-filtering: update: %s, new: %s' % (dict(upd_p), dict(new_p)))
|
||||
if filter_patches:
|
||||
new_p = OrderedDict()
|
||||
upd_p = OrderedDict((k,v) for k,v in upd_p.items() if k in filter_patches)
|
||||
remove_files = [f for f in remove_files if f in filter_patches]
|
||||
del_p = OrderedDict((k,v) for k,v in del_p.items() if k in filter_patches)
|
||||
remove_files = []
|
||||
if not no_remove:
|
||||
# Remove deleted local files and patches
|
||||
remove_files = list(del_f.values()) + list(del_p.values())
|
||||
updatefiles = False
|
||||
updaterecipe = False
|
||||
destpath = None
|
||||
|
|
Loading…
Reference in New Issue
Block a user