scriptutils: remove the useless import line
PATCH 1/2 scriptutils: remove the useless import line
imp was replaced by importlib as it's deprecated, but the import line was left, so remove this useless line.
--- scripts/lib/scriptutils.py | 1 - 1 file changed, 1 deletion(-)
scripts/lib/scriptutils.py +0 -1
@@ -77,7 +77,6 @@ def logger_setup_color(logger, color='auto'): def load_plugins(logger, plugins, pluginpath): - import imp def load_plugin(name): logger.debug('Loading plugin %s' % name)
Signature · 1 line
2.17.1
PATCH 2/2 devtool: add option to remove backported patch automatically during upgrade
When upgrading a package, most likely the backported patches are not needed any more, so add an option to `devtool upgrade' to handle such situation.
--- scripts/lib/devtool/standard.py | 14 +++++++++++++- scripts/lib/devtool/upgrade.py | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-)
scripts/lib/devtool/standard.py +13 -1
@@ -487,7 +487,7 @@ def symlink_oelocal_files_srctree(rd,srctree): bb.process.run('git %s commit -m "Committing local file symlinks\n\n%s"' % (' '.join(useroptions), oe.patch.GitApplyTree.ignore_commit_prefix), cwd=srctree) -def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, workspace, fixed_setup, d, tinfoil, no_overrides=False): +def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, workspace, fixed_setup, d, tinfoil, no_overrides=False, no_backported=False): """Extract sources of a recipe""" import oe.recipeutils import oe.patch
@@ -555,6 +555,14 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works tempbasedir = d.getVar('WORKDIR') bb.utils.mkdirhier(tempbasedir) tempdir = tempfile.mkdtemp(prefix='devtooltmp-', dir=tempbasedir) + patches = oe.recipeutils.get_recipe_patches(d) + backported_patches = [] + for patch in patches: + with open(patch, 'r') as pf: + for line in pf.readlines(): + if 'Upstream-Status: Backport' in line: + backported_patches.append(os.path.basename(patch)) + break try: tinfoil.logger.setLevel(logging.WARNING)
@@ -579,6 +587,10 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works f.write('DEVTOOL_EXTRA_OVERRIDES = "%s"\n' % ':'.join(extra_overrides)) f.write('inherit devtool-source\n') f.write('###--- _extract_source\n') + # deal with backported patches + if no_backported and len(backported_patches) > 0: + for patch_name in backported_patches: + f.write('SRC_URI_remove = "file://%s"' % patch_name) update_unlockedsigs(basepath, workspace, fixed_setup, [pn])
scripts/lib/devtool/upgrade.py +2 -1
@@ -549,7 +549,7 @@ def upgrade(args, config, basepath, workspace): license_diff = None try: logger.info('Extracting current version source...') - rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides) + rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides, no_backported=args.no_backported) old_licenses = _extract_licenses(srctree, rd.getVar('LIC_FILES_CHKSUM')) logger.info('Extracting upgraded version source...') rev2, md5, sha256, srcbranch, srcsubdir2 = _extract_new_source(args.version, srctree, args.no_patch,
@@ -628,6 +628,7 @@ def register_commands(subparsers, context): parser_upgrade.add_argument('--branch', '-b', default="devtool", help='Name for new development branch to checkout (default "%(default)s")') parser_upgrade.add_argument('--no-patch', action="store_true", help='Do not apply patches from the recipe to the new source code') parser_upgrade.add_argument('--no-overrides', '-O', action="store_true", help='Do not create branches for other override configurations') + parser_upgrade.add_argument('--no-backported', action="store_true", help='Do not apply backported patches to the new source code') group = parser_upgrade.add_mutually_exclusive_group() group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true")
Signature · 1 line
2.17.1
Re: [PATCH 2/2] devtool: add option to remove backported patch automatically during upgrade
I would say this is a dangerous option, and I wouldn't want to have or use it. Backported patches may not actually be present in the newer version if they were taken from a development branch that has not yet been released.
Also, 'devtool upgrade' is using 'git rebase' to rebase all patches onto the newer code base, and most backports are dropped automatically at that step. If they aren't there's usually a merge conflict, where you can easily issue 'git rebase --skip' to remove the backport, or resolve conflicts if the backport needs to stay.
What prompted you to implement this?
Alex
Quoted 102 lines · Chen Qi
When upgrading a package, most likely the backported patches are not needed any more, so add an option to `devtool upgrade' to handle such situation.
Signed-off-by Chen Qi <[email protected]>--- scripts/lib/devtool/standard.py | 14 +++++++++++++- scripts/lib/devtool/upgrade.py | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-)scripts/lib/devtool/standard.py +0
-1@@ -487,7 +487,7 @@ def symlink_oelocal_files_srctree(rd,srctree): bb.process.run('git %s commit -m "Committing local file symlinks\n\n%s"' % (' '.join(useroptions), oe.patch.GitApplyTree.ignore_commit_prefix), cwd=srctree) -def _extract_source(srctree, keep_temp, devbranch, sync, config,basepath, workspace,
fixed_setup, d, tinfoil, no_overrides=False):
+def _extract_source(srctree,keep_temp, devbranch, sync, config, basepath, workspace,fixed_setup, d, tinfoil, no_overrides=False, no_backported=False):
"""Extract sources of a recipe"""
import oe.recipeutils
import oe.patchscripts/lib/devtool/standard.py +0
-0@@ -555,6 +555,14 @@ def _extract_source(srctree, keep_temp, devbranch,sync, config, basepath, works
tempbasedir =d.getVar('WORKDIR')bb.utils.mkdirhier(tempbasedir)
tempdir =tempfile.mkdtemp(prefix='devtooltmp-', dir=tempbasedir)scripts/lib/devtool/standard.py +8
-0+ patches = oe.recipeutils.get_recipe_patches(d) + backported_patches = [] + for patch in patches: + with open(patch, 'r') as pf: + for line in pf.readlines(): + if 'Upstream-Status: Backport' in line: + backported_patches.append(os.path.basename(patch)) + break try: tinfoil.logger.setLevel(logging.WARNING)@@ -579,6 +587,10 @@ def _extract_source(srctree, keep_temp, devbranch,sync, config, basepath, works
f.write('DEVTOOL_EXTRA_OVERRIDES = "%s"\n' % ':'.join(extra_overrides)) f.write('inherit devtool-source\n') f.write('###--- _extract_source\n')scripts/lib/devtool/standard.py +4
-0+ # deal with backported patches + if no_backported and len(backported_patches) > 0: + for patch_name in backported_patches: + f.write('SRC_URI_remove = "file://%s"' % patch_name) update_unlockedsigs(basepath, workspace, fixed_setup, [pn])scripts/lib/devtool/upgrade.py +1
-1@@ -549,7 +549,7 @@ def upgrade(args, config, basepath, workspace): license_diff = None try: logger.info('Extracting current version source...') - rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides) + rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd,tinfoil, no_overrides=args.no_overrides, no_backported=args.no_backported)
old_licenses= _extract_licenses(srctree,rd.getVar('LIC_FILES_CHKSUM'))
logger.info('Extracting upgraded version source...')rev2, md5, sha256, srcbranch, srcsubdir2 =
_extract_new_source(args.version, srctree, args.no_patch,scripts/lib/devtool/upgrade.py +0
-0@@ -628,6 +628,7 @@ def register_commands(subparsers, context): parser_upgrade.add_argument('--branch', '-b', default="devtool", help='Name for new development branch to checkout (default "%(default)s")') parser_upgrade.add_argument('--no-patch', action="store_true", help='Do not apply patches from the recipe to the new source code') parser_upgrade.add_argument('--no-overrides', '-O',action="store_true", help='Do not create branches for other override configurations')
+ parser_upgrade.add_argument('--no-backported', action="store_true",
help='Do not apply backported patches to the new source code')
group =parser_upgrade.add_mutually_exclusive_group()group.add_argument('--same-dir', '-s', help='Build in same directory
as source', action="store_true")
group.add_argument('--no-same-dir', help='Force build in a separate
build directory', action="store_true")
--
2.17.1--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core