mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
3a2a584737
commit
da71c928cd
@@ -666,7 +666,7 @@ def get_bbappend_path(d, destlayerdir, wildcardver=False):
|
|||||||
return (appendpath, pathok)
|
return (appendpath, pathok)
|
||||||
|
|
||||||
|
|
||||||
def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, machine=None, extralines=None, removevalues=None, redirect_output=None):
|
def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, machine=None, extralines=None, removevalues=None, redirect_output=None, params=None):
|
||||||
"""
|
"""
|
||||||
Writes a bbappend file for a recipe
|
Writes a bbappend file for a recipe
|
||||||
Parameters:
|
Parameters:
|
||||||
@@ -696,6 +696,9 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False,
|
|||||||
redirect_output:
|
redirect_output:
|
||||||
If specified, redirects writing the output file to the
|
If specified, redirects writing the output file to the
|
||||||
specified directory (for dry-run purposes)
|
specified directory (for dry-run purposes)
|
||||||
|
params:
|
||||||
|
Parameters to use when adding entries to SRC_URI. If specified,
|
||||||
|
should be a list of dicts with the same length as srcfiles.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not removevalues:
|
if not removevalues:
|
||||||
@@ -762,12 +765,14 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False,
|
|||||||
copyfiles = {}
|
copyfiles = {}
|
||||||
if srcfiles:
|
if srcfiles:
|
||||||
instfunclines = []
|
instfunclines = []
|
||||||
for newfile, origsrcfile in srcfiles.items():
|
for i, (newfile, origsrcfile) in enumerate(srcfiles.items()):
|
||||||
srcfile = origsrcfile
|
srcfile = origsrcfile
|
||||||
srcurientry = None
|
srcurientry = None
|
||||||
if not srcfile:
|
if not srcfile:
|
||||||
srcfile = os.path.basename(newfile)
|
srcfile = os.path.basename(newfile)
|
||||||
srcurientry = 'file://%s' % srcfile
|
srcurientry = 'file://%s' % srcfile
|
||||||
|
if params and params[i]:
|
||||||
|
srcurientry = '%s;%s' % (srcurientry, ';'.join('%s=%s' % (k,v) for k,v in params[i].items()))
|
||||||
# Double-check it's not there already
|
# Double-check it's not there already
|
||||||
# FIXME do we care if the entry is added by another bbappend that might go away?
|
# FIXME do we care if the entry is added by another bbappend that might go away?
|
||||||
if not srcurientry in rd.getVar('SRC_URI').split():
|
if not srcurientry in rd.getVar('SRC_URI').split():
|
||||||
|
|||||||
@@ -1606,6 +1606,19 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
|
|||||||
if not os.path.exists(append):
|
if not os.path.exists(append):
|
||||||
raise DevtoolError('unable to find workspace bbappend for recipe %s' %
|
raise DevtoolError('unable to find workspace bbappend for recipe %s' %
|
||||||
recipename)
|
recipename)
|
||||||
|
srctreebase = workspace[recipename]['srctreebase']
|
||||||
|
relpatchdir = os.path.relpath(srctreebase, srctree)
|
||||||
|
if relpatchdir == '.':
|
||||||
|
patchdir_params = {}
|
||||||
|
else:
|
||||||
|
patchdir_params = {'patchdir': relpatchdir}
|
||||||
|
|
||||||
|
def srcuri_entry(fname):
|
||||||
|
if patchdir_params:
|
||||||
|
paramstr = ';' + ';'.join('%s=%s' % (k,v) for k,v in patchdir_params.items())
|
||||||
|
else:
|
||||||
|
paramstr = ''
|
||||||
|
return 'file://%s%s' % (basepath, paramstr)
|
||||||
|
|
||||||
initial_rev, update_rev, changed_revs, filter_patches = _get_patchset_revs(srctree, append, initial_rev, force_patch_refresh)
|
initial_rev, update_rev, changed_revs, filter_patches = _get_patchset_revs(srctree, append, initial_rev, force_patch_refresh)
|
||||||
if not initial_rev:
|
if not initial_rev:
|
||||||
@@ -1627,7 +1640,6 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
|
|||||||
new_f = {}
|
new_f = {}
|
||||||
del_f = {}
|
del_f = {}
|
||||||
else:
|
else:
|
||||||
srctreebase = workspace[recipename]['srctreebase']
|
|
||||||
upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase)
|
upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase)
|
||||||
|
|
||||||
remove_files = []
|
remove_files = []
|
||||||
@@ -1663,14 +1675,15 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
|
|||||||
removedentries, remaining = _remove_file_entries(
|
removedentries, remaining = _remove_file_entries(
|
||||||
srcuri, remove_files)
|
srcuri, remove_files)
|
||||||
if removedentries or remaining:
|
if removedentries or remaining:
|
||||||
remaining = ['file://' + os.path.basename(item) for
|
remaining = [srcuri_entry(os.path.basename(item)) for
|
||||||
item in remaining]
|
item in remaining]
|
||||||
removevalues = {'SRC_URI': removedentries + remaining}
|
removevalues = {'SRC_URI': removedentries + remaining}
|
||||||
appendfile, destpath = oe.recipeutils.bbappend_recipe(
|
appendfile, destpath = oe.recipeutils.bbappend_recipe(
|
||||||
rd, appendlayerdir, files,
|
rd, appendlayerdir, files,
|
||||||
wildcardver=wildcard_version,
|
wildcardver=wildcard_version,
|
||||||
removevalues=removevalues,
|
removevalues=removevalues,
|
||||||
redirect_output=dry_run_outdir)
|
redirect_output=dry_run_outdir,
|
||||||
|
params=[patchdir_params] * len(files))
|
||||||
else:
|
else:
|
||||||
logger.info('No patches or local source files needed updating')
|
logger.info('No patches or local source files needed updating')
|
||||||
else:
|
else:
|
||||||
@@ -1694,7 +1707,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
|
|||||||
# replace the entry in SRC_URI with our local version
|
# replace the entry in SRC_URI with our local version
|
||||||
logger.info('Replacing remote patch %s with updated local version' % basepath)
|
logger.info('Replacing remote patch %s with updated local version' % basepath)
|
||||||
path = os.path.join(files_dir, basepath)
|
path = os.path.join(files_dir, basepath)
|
||||||
_replace_srcuri_entry(srcuri, basepath, 'file://%s' % basepath)
|
_replace_srcuri_entry(srcuri, basepath, srcuri_entry(basepath))
|
||||||
updaterecipe = True
|
updaterecipe = True
|
||||||
else:
|
else:
|
||||||
logger.info('Updating patch %s%s' % (basepath, dry_run_suffix))
|
logger.info('Updating patch %s%s' % (basepath, dry_run_suffix))
|
||||||
@@ -1708,7 +1721,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
|
|||||||
os.path.join(files_dir, basepath),
|
os.path.join(files_dir, basepath),
|
||||||
dry_run_outdir=dry_run_outdir,
|
dry_run_outdir=dry_run_outdir,
|
||||||
base_outdir=recipedir)
|
base_outdir=recipedir)
|
||||||
srcuri.append('file://%s' % basepath)
|
srcuri.append(srcuri_entry(basepath))
|
||||||
updaterecipe = True
|
updaterecipe = True
|
||||||
for basepath, path in new_p.items():
|
for basepath, path in new_p.items():
|
||||||
logger.info('Adding new patch %s%s' % (basepath, dry_run_suffix))
|
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
|
|||||||
os.path.join(files_dir, basepath),
|
os.path.join(files_dir, basepath),
|
||||||
dry_run_outdir=dry_run_outdir,
|
dry_run_outdir=dry_run_outdir,
|
||||||
base_outdir=recipedir)
|
base_outdir=recipedir)
|
||||||
srcuri.append('file://%s' % basepath)
|
srcuri.append(srcuri_entry(basepath))
|
||||||
updaterecipe = True
|
updaterecipe = True
|
||||||
# Update recipe, if needed
|
# Update recipe, if needed
|
||||||
if _remove_file_entries(srcuri, remove_files)[0]:
|
if _remove_file_entries(srcuri, remove_files)[0]:
|
||||||
|
|||||||
Reference in New Issue
Block a user