All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] scriptutils: remove the useless import line
@ 2019-12-02  6:03 Chen Qi
  2019-12-02  6:03 ` [PATCH 2/2] devtool: add option to remove backported patch automatically during upgrade Chen Qi
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Qi @ 2019-12-02  6:03 UTC (permalink / raw)
  To: openembedded-core

imp was replaced by importlib as it's deprecated, but the import
line was left, so remove this useless line.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 scripts/lib/scriptutils.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py
index 45bdaf5f4e..f92255d8dc 100644
--- a/scripts/lib/scriptutils.py
+++ b/scripts/lib/scriptutils.py
@@ -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)
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] devtool: add option to remove backported patch automatically during upgrade
  2019-12-02  6:03 [PATCH 1/2] scriptutils: remove the useless import line Chen Qi
@ 2019-12-02  6:03 ` Chen Qi
  2019-12-02 11:35   ` Alexander Kanavin
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Qi @ 2019-12-02  6:03 UTC (permalink / raw)
  To: openembedded-core

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 <Qi.Chen@windriver.com>
---
 scripts/lib/devtool/standard.py | 14 +++++++++++++-
 scripts/lib/devtool/upgrade.py  |  3 ++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 1c0cd8ab51..5fe848b6b8 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -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])
 
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index cb6dce378a..d5e04ecdc5 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -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")
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] devtool: add option to remove backported patch automatically during upgrade
  2019-12-02  6:03 ` [PATCH 2/2] devtool: add option to remove backported patch automatically during upgrade Chen Qi
@ 2019-12-02 11:35   ` Alexander Kanavin
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Kanavin @ 2019-12-02 11:35 UTC (permalink / raw)
  To: Chen Qi; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 5521 bytes --]

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

On Mon, 2 Dec 2019 at 07:03, Chen Qi <Qi.Chen@windriver.com> wrote:

> 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 <Qi.Chen@windriver.com>
> ---
>  scripts/lib/devtool/standard.py | 14 +++++++++++++-
>  scripts/lib/devtool/upgrade.py  |  3 ++-
>  2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/lib/devtool/standard.py
> b/scripts/lib/devtool/standard.py
> index 1c0cd8ab51..5fe848b6b8 100644
> --- a/scripts/lib/devtool/standard.py
> +++ b/scripts/lib/devtool/standard.py
> @@ -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])
>
> diff --git a/scripts/lib/devtool/upgrade.py
> b/scripts/lib/devtool/upgrade.py
> index cb6dce378a..d5e04ecdc5 100644
> --- a/scripts/lib/devtool/upgrade.py
> +++ b/scripts/lib/devtool/upgrade.py
> @@ -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")
> --
> 2.17.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 6989 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-02 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02  6:03 [PATCH 1/2] scriptutils: remove the useless import line Chen Qi
2019-12-02  6:03 ` [PATCH 2/2] devtool: add option to remove backported patch automatically during upgrade Chen Qi
2019-12-02 11:35   ` Alexander Kanavin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.