All of lore.kernel.org
 help / color / mirror / Atom feed
* [master][PATCH] devtool: Add --remove-work option for devtool reset command
@ 2019-10-07 18:35 Sai Hari Chandana Kalluri
  2019-10-07 18:39 ` Khem Raj
  2019-10-09  2:03 ` Paul Eggleton
  0 siblings, 2 replies; 8+ messages in thread
From: Sai Hari Chandana Kalluri @ 2019-10-07 18:35 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sai Hari Chandana Kalluri

Enable --remove-work option for devtool reset command that allows user
to clean up source directory within workspace.

Currently devtool reset command only removes recipes and user is forced
to manually remove the sources directory within the workspace before
running devtool modify again.

Using devtool reset -r or devtool reset --remove-work option, user can
cleanup the sources directory along with the recipe instead of manually
cleaning it.

syntax: devtool reset -r <recipename>
    Ex: devtool reset -r zip

	devtool finish -r <recipename> <layer-name>
    Ex: devtool finish -r zip meta-yocto-bsp

Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
---
 scripts/lib/devtool/standard.py | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 60c9a04..1c0cd8a 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1852,7 +1852,7 @@ def status(args, config, basepath, workspace):
     return 0
 
 
-def _reset(recipes, no_clean, config, basepath, workspace):
+def _reset(recipes, no_clean, remove_work, config, basepath, workspace):
     """Reset one or more recipes"""
     import oe.path
 
@@ -1930,10 +1930,15 @@ def _reset(recipes, no_clean, config, basepath, workspace):
         srctreebase = workspace[pn]['srctreebase']
         if os.path.isdir(srctreebase):
             if os.listdir(srctreebase):
-                # We don't want to risk wiping out any work in progress
-                logger.info('Leaving source tree %s as-is; if you no '
-                            'longer need it then please delete it manually'
-                            % srctreebase)
+                    if remove_work:
+                        logger.info('-r argument used on %s, removing source tree.'
+                                    ' You will lose any unsaved work' %pn)
+                        shutil.rmtree(srctreebase)
+                    else:
+                        # We don't want to risk wiping out any work in progress
+                        logger.info('Leaving source tree %s as-is; if you no '
+                                    'longer need it then please delete it manually'
+                                    % srctreebase)
             else:
                 # This is unlikely, but if it's empty we can just remove it
                 os.rmdir(srctreebase)
@@ -1943,6 +1948,10 @@ def _reset(recipes, no_clean, config, basepath, workspace):
 def reset(args, config, basepath, workspace):
     """Entry point for the devtool 'reset' subcommand"""
     import bb
+    import shutil
+
+    recipes = ""
+
     if args.recipename:
         if args.all:
             raise DevtoolError("Recipe cannot be specified if -a/--all is used")
@@ -1957,7 +1966,7 @@ def reset(args, config, basepath, workspace):
     else:
         recipes = args.recipename
 
-    _reset(recipes, args.no_clean, config, basepath, workspace)
+    _reset(recipes, args.no_clean, args.remove_work, config, basepath, workspace)
 
     return 0
 
@@ -2009,6 +2018,7 @@ def finish(args, config, basepath, workspace):
             raise DevtoolError('Source tree is not clean:\n\n%s\nEnsure you have committed your changes or use -f/--force if you are sure there\'s nothing that needs to be committed' % dirty)
 
     no_clean = args.no_clean
+    remove_work=args.remove_work
     tinfoil = setup_tinfoil(basepath=basepath, tracking=True)
     try:
         rd = parse_recipe(config, tinfoil, args.recipename, True)
@@ -2160,7 +2170,7 @@ def finish(args, config, basepath, workspace):
     if args.dry_run:
         logger.info('Resetting recipe (dry-run)')
     else:
-        _reset([args.recipename], no_clean=no_clean, config=config, basepath=basepath, workspace=workspace)
+        _reset([args.recipename], no_clean=no_clean, remove_work=remove_work, config=config, basepath=basepath, workspace=workspace)
 
     return 0
 
@@ -2272,6 +2282,7 @@ def register_commands(subparsers, context):
     parser_reset.add_argument('recipename', nargs='*', help='Recipe to reset')
     parser_reset.add_argument('--all', '-a', action="store_true", help='Reset all recipes (clear workspace)')
     parser_reset.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output')
+    parser_reset.add_argument('--remove-work', '-r', action="store_true", help='Clean the sources directory along with append')
     parser_reset.set_defaults(func=reset)
 
     parser_finish = subparsers.add_parser('finish', help='Finish working on a recipe in your workspace',
@@ -2282,6 +2293,7 @@ def register_commands(subparsers, context):
     parser_finish.add_argument('--mode', '-m', choices=['patch', 'srcrev', 'auto'], default='auto', help='Update mode (where %(metavar)s is %(choices)s; default is %(default)s)', metavar='MODE')
     parser_finish.add_argument('--initial-rev', help='Override starting revision for patches')
     parser_finish.add_argument('--force', '-f', action="store_true", help='Force continuing even if there are uncommitted changes in the source tree repository')
+    parser_finish.add_argument('--remove-work', '-r', action="store_true", help='Clean the sources directory under workspace')
     parser_finish.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output')
     parser_finish.add_argument('--no-overrides', '-O', action="store_true", help='Do not handle other override branches (if they exist)')
     parser_finish.add_argument('--dry-run', '-N', action="store_true", help='Dry-run (just report changes instead of writing them)')
-- 
2.7.4



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

* Re: [master][PATCH] devtool: Add --remove-work option for devtool reset command
  2019-10-07 18:35 [master][PATCH] devtool: Add --remove-work option for devtool reset command Sai Hari Chandana Kalluri
@ 2019-10-07 18:39 ` Khem Raj
  2019-10-08  2:14   ` Chandana Kalluri
  2019-10-09  2:03 ` Paul Eggleton
  1 sibling, 1 reply; 8+ messages in thread
From: Khem Raj @ 2019-10-07 18:39 UTC (permalink / raw)
  To: Sai Hari Chandana Kalluri; +Cc: Patches and discussions about the oe-core layer

On Mon, Oct 7, 2019 at 11:36 AM Sai Hari Chandana Kalluri
<chandana.kalluri@xilinx.com> wrote:
>
> Enable --remove-work option for devtool reset command that allows user
> to clean up source directory within workspace.
>
> Currently devtool reset command only removes recipes and user is forced
> to manually remove the sources directory within the workspace before
> running devtool modify again.
>
> Using devtool reset -r or devtool reset --remove-work option, user can
> cleanup the sources directory along with the recipe instead of manually
> cleaning it.

perhaps we can have another cmd like "reset-all" like cleanall ?
which would remove everything that devtool did external to bblayers
for that recipe.

>
> syntax: devtool reset -r <recipename>
>     Ex: devtool reset -r zip
>
>         devtool finish -r <recipename> <layer-name>
>     Ex: devtool finish -r zip meta-yocto-bsp
>
> Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
> ---
>  scripts/lib/devtool/standard.py | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
> index 60c9a04..1c0cd8a 100644
> --- a/scripts/lib/devtool/standard.py
> +++ b/scripts/lib/devtool/standard.py
> @@ -1852,7 +1852,7 @@ def status(args, config, basepath, workspace):
>      return 0
>
>
> -def _reset(recipes, no_clean, config, basepath, workspace):
> +def _reset(recipes, no_clean, remove_work, config, basepath, workspace):
>      """Reset one or more recipes"""
>      import oe.path
>
> @@ -1930,10 +1930,15 @@ def _reset(recipes, no_clean, config, basepath, workspace):
>          srctreebase = workspace[pn]['srctreebase']
>          if os.path.isdir(srctreebase):
>              if os.listdir(srctreebase):
> -                # We don't want to risk wiping out any work in progress
> -                logger.info('Leaving source tree %s as-is; if you no '
> -                            'longer need it then please delete it manually'
> -                            % srctreebase)
> +                    if remove_work:
> +                        logger.info('-r argument used on %s, removing source tree.'
> +                                    ' You will lose any unsaved work' %pn)
> +                        shutil.rmtree(srctreebase)
> +                    else:
> +                        # We don't want to risk wiping out any work in progress
> +                        logger.info('Leaving source tree %s as-is; if you no '
> +                                    'longer need it then please delete it manually'
> +                                    % srctreebase)
>              else:
>                  # This is unlikely, but if it's empty we can just remove it
>                  os.rmdir(srctreebase)
> @@ -1943,6 +1948,10 @@ def _reset(recipes, no_clean, config, basepath, workspace):
>  def reset(args, config, basepath, workspace):
>      """Entry point for the devtool 'reset' subcommand"""
>      import bb
> +    import shutil
> +
> +    recipes = ""
> +
>      if args.recipename:
>          if args.all:
>              raise DevtoolError("Recipe cannot be specified if -a/--all is used")
> @@ -1957,7 +1966,7 @@ def reset(args, config, basepath, workspace):
>      else:
>          recipes = args.recipename
>
> -    _reset(recipes, args.no_clean, config, basepath, workspace)
> +    _reset(recipes, args.no_clean, args.remove_work, config, basepath, workspace)
>
>      return 0
>
> @@ -2009,6 +2018,7 @@ def finish(args, config, basepath, workspace):
>              raise DevtoolError('Source tree is not clean:\n\n%s\nEnsure you have committed your changes or use -f/--force if you are sure there\'s nothing that needs to be committed' % dirty)
>
>      no_clean = args.no_clean
> +    remove_work=args.remove_work
>      tinfoil = setup_tinfoil(basepath=basepath, tracking=True)
>      try:
>          rd = parse_recipe(config, tinfoil, args.recipename, True)
> @@ -2160,7 +2170,7 @@ def finish(args, config, basepath, workspace):
>      if args.dry_run:
>          logger.info('Resetting recipe (dry-run)')
>      else:
> -        _reset([args.recipename], no_clean=no_clean, config=config, basepath=basepath, workspace=workspace)
> +        _reset([args.recipename], no_clean=no_clean, remove_work=remove_work, config=config, basepath=basepath, workspace=workspace)
>
>      return 0
>
> @@ -2272,6 +2282,7 @@ def register_commands(subparsers, context):
>      parser_reset.add_argument('recipename', nargs='*', help='Recipe to reset')
>      parser_reset.add_argument('--all', '-a', action="store_true", help='Reset all recipes (clear workspace)')
>      parser_reset.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output')
> +    parser_reset.add_argument('--remove-work', '-r', action="store_true", help='Clean the sources directory along with append')
>      parser_reset.set_defaults(func=reset)
>
>      parser_finish = subparsers.add_parser('finish', help='Finish working on a recipe in your workspace',
> @@ -2282,6 +2293,7 @@ def register_commands(subparsers, context):
>      parser_finish.add_argument('--mode', '-m', choices=['patch', 'srcrev', 'auto'], default='auto', help='Update mode (where %(metavar)s is %(choices)s; default is %(default)s)', metavar='MODE')
>      parser_finish.add_argument('--initial-rev', help='Override starting revision for patches')
>      parser_finish.add_argument('--force', '-f', action="store_true", help='Force continuing even if there are uncommitted changes in the source tree repository')
> +    parser_finish.add_argument('--remove-work', '-r', action="store_true", help='Clean the sources directory under workspace')
>      parser_finish.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output')
>      parser_finish.add_argument('--no-overrides', '-O', action="store_true", help='Do not handle other override branches (if they exist)')
>      parser_finish.add_argument('--dry-run', '-N', action="store_true", help='Dry-run (just report changes instead of writing them)')
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [master][PATCH] devtool: Add --remove-work option for devtool reset command
  2019-10-07 18:39 ` Khem Raj
@ 2019-10-08  2:14   ` Chandana Kalluri
  2019-10-08 17:37     ` Peter Kjellerstedt
  0 siblings, 1 reply; 8+ messages in thread
From: Chandana Kalluri @ 2019-10-08  2:14 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: Patches and discussions about the oe-core layer

Hi Paul,

Any thoughts on implementing this as a separate command  as suggested by Khem?

> -----Original Message-----
> From: Khem Raj <raj.khem@gmail.com>
> Sent: Monday, October 7, 2019 11:40 AM
> To: Chandana Kalluri <ckalluri@xilinx.com>
> Cc: Patches and discussions about the oe-core layer <openembedded-
> core@lists.openembedded.org>
> Subject: Re: [OE-core] [OE-Core][master][PATCH] devtool: Add --remove-work
> option for devtool reset command
> 
> On Mon, Oct 7, 2019 at 11:36 AM Sai Hari Chandana Kalluri
> <chandana.kalluri@xilinx.com> wrote:
> >
> > Enable --remove-work option for devtool reset command that allows user
> > to clean up source directory within workspace.
> >
> > Currently devtool reset command only removes recipes and user is
> > forced to manually remove the sources directory within the workspace
> > before running devtool modify again.
> >
> > Using devtool reset -r or devtool reset --remove-work option, user can
> > cleanup the sources directory along with the recipe instead of
> > manually cleaning it.
> 
> perhaps we can have another cmd like "reset-all" like cleanall ?
> which would remove everything that devtool did external to bblayers for that
> recipe.
> 
> >
> > syntax: devtool reset -r <recipename>
> >     Ex: devtool reset -r zip
> >
> >         devtool finish -r <recipename> <layer-name>
> >     Ex: devtool finish -r zip meta-yocto-bsp
> >
> > Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
> > ---
> >  scripts/lib/devtool/standard.py | 26 +++++++++++++++++++-------
> >  1 file changed, 19 insertions(+), 7 deletions(-)
> >
> > diff --git a/scripts/lib/devtool/standard.py
> > b/scripts/lib/devtool/standard.py index 60c9a04..1c0cd8a 100644
> > --- a/scripts/lib/devtool/standard.py
> > +++ b/scripts/lib/devtool/standard.py
> > @@ -1852,7 +1852,7 @@ def status(args, config, basepath, workspace):
> >      return 0
> >
> >
> > -def _reset(recipes, no_clean, config, basepath, workspace):
> > +def _reset(recipes, no_clean, remove_work, config, basepath, workspace):
> >      """Reset one or more recipes"""
> >      import oe.path
> >
> > @@ -1930,10 +1930,15 @@ def _reset(recipes, no_clean, config, basepath,
> workspace):
> >          srctreebase = workspace[pn]['srctreebase']
> >          if os.path.isdir(srctreebase):
> >              if os.listdir(srctreebase):
> > -                # We don't want to risk wiping out any work in progress
> > -                logger.info('Leaving source tree %s as-is; if you no '
> > -                            'longer need it then please delete it manually'
> > -                            % srctreebase)
> > +                    if remove_work:
> > +                        logger.info('-r argument used on %s, removing source tree.'
> > +                                    ' You will lose any unsaved work' %pn)
> > +                        shutil.rmtree(srctreebase)
> > +                    else:
> > +                        # We don't want to risk wiping out any work in progress
> > +                        logger.info('Leaving source tree %s as-is; if you no '
> > +                                    'longer need it then please delete it manually'
> > +                                    % srctreebase)
> >              else:
> >                  # This is unlikely, but if it's empty we can just remove it
> >                  os.rmdir(srctreebase) @@ -1943,6 +1948,10 @@ def
> > _reset(recipes, no_clean, config, basepath, workspace):
> >  def reset(args, config, basepath, workspace):
> >      """Entry point for the devtool 'reset' subcommand"""
> >      import bb
> > +    import shutil
> > +
> > +    recipes = ""
> > +
> >      if args.recipename:
> >          if args.all:
> >              raise DevtoolError("Recipe cannot be specified if
> > -a/--all is used") @@ -1957,7 +1966,7 @@ def reset(args, config, basepath,
> workspace):
> >      else:
> >          recipes = args.recipename
> >
> > -    _reset(recipes, args.no_clean, config, basepath, workspace)
> > +    _reset(recipes, args.no_clean, args.remove_work, config,
> > + basepath, workspace)
> >
> >      return 0
> >
> > @@ -2009,6 +2018,7 @@ def finish(args, config, basepath, workspace):
> >              raise DevtoolError('Source tree is not
> > clean:\n\n%s\nEnsure you have committed your changes or use -f/--force
> > if you are sure there\'s nothing that needs to be committed' % dirty)
> >
> >      no_clean = args.no_clean
> > +    remove_work=args.remove_work
> >      tinfoil = setup_tinfoil(basepath=basepath, tracking=True)
> >      try:
> >          rd = parse_recipe(config, tinfoil, args.recipename, True) @@
> > -2160,7 +2170,7 @@ def finish(args, config, basepath, workspace):
> >      if args.dry_run:
> >          logger.info('Resetting recipe (dry-run)')
> >      else:
> > -        _reset([args.recipename], no_clean=no_clean, config=config,
> basepath=basepath, workspace=workspace)
> > +        _reset([args.recipename], no_clean=no_clean,
> > + remove_work=remove_work, config=config, basepath=basepath,
> > + workspace=workspace)
> >
> >      return 0
> >
> > @@ -2272,6 +2282,7 @@ def register_commands(subparsers, context):
> >      parser_reset.add_argument('recipename', nargs='*', help='Recipe to
> reset')
> >      parser_reset.add_argument('--all', '-a', action="store_true", help='Reset all
> recipes (clear workspace)')
> >      parser_reset.add_argument('--no-clean', '-n',
> > action="store_true", help='Don\'t clean the sysroot to remove recipe
> > output')
> > +    parser_reset.add_argument('--remove-work', '-r',
> > + action="store_true", help='Clean the sources directory along with
> > + append')
> >      parser_reset.set_defaults(func=reset)
> >
> >      parser_finish = subparsers.add_parser('finish', help='Finish
> > working on a recipe in your workspace', @@ -2282,6 +2293,7 @@ def
> register_commands(subparsers, context):
> >      parser_finish.add_argument('--mode', '-m', choices=['patch', 'srcrev',
> 'auto'], default='auto', help='Update mode (where %(metavar)s is %(choices)s;
> default is %(default)s)', metavar='MODE')
> >      parser_finish.add_argument('--initial-rev', help='Override starting revision
> for patches')
> >      parser_finish.add_argument('--force', '-f', action="store_true",
> > help='Force continuing even if there are uncommitted changes in the
> > source tree repository')
> > +    parser_finish.add_argument('--remove-work', '-r',
> > + action="store_true", help='Clean the sources directory under
> > + workspace')
> >      parser_finish.add_argument('--no-clean', '-n', action="store_true",
> help='Don\'t clean the sysroot to remove recipe output')
> >      parser_finish.add_argument('--no-overrides', '-O', action="store_true",
> help='Do not handle other override branches (if they exist)')
> >      parser_finish.add_argument('--dry-run', '-N',
> > action="store_true", help='Dry-run (just report changes instead of
> > writing them)')
> > --
> > 2.7.4
> >
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core

Thanks,
Chandana

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

* Re: [master][PATCH] devtool: Add --remove-work option for devtool reset command
  2019-10-08  2:14   ` Chandana Kalluri
@ 2019-10-08 17:37     ` Peter Kjellerstedt
  2019-10-08 17:39       ` Khem Raj
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Kjellerstedt @ 2019-10-08 17:37 UTC (permalink / raw)
  To: Chandana Kalluri, Paul Eggleton
  Cc: Patches and discussions about the oe-core layer

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
> core-bounces@lists.openembedded.org> On Behalf Of Chandana Kalluri
> Sent: den 8 oktober 2019 04:14
> To: Paul Eggleton <paul.eggleton@linux.intel.com>
> Cc: Patches and discussions about the oe-core layer <openembedded-
> core@lists.openembedded.org>
> Subject: Re: [OE-core] [OE-Core][master][PATCH] devtool: Add --remove-
> work option for devtool reset command
> 
> Hi Paul,
> 
> Any thoughts on implementing this as a separate command  as suggested
> by Khem?

For what it's worth, I think the original suggested solution with a new 
option to the existing `devtool reset` and `devtool finish` commands is 
the better one.

> > -----Original Message-----
> > From: Khem Raj <raj.khem@gmail.com>
> > Sent: Monday, October 7, 2019 11:40 AM
> > To: Chandana Kalluri <ckalluri@xilinx.com>
> > Cc: Patches and discussions about the oe-core layer <openembedded-
> > core@lists.openembedded.org>
> > Subject: Re: [OE-core] [OE-Core][master][PATCH] devtool: Add --
> remove-work
> > option for devtool reset command
> >
> > On Mon, Oct 7, 2019 at 11:36 AM Sai Hari Chandana Kalluri
> > <chandana.kalluri@xilinx.com> wrote:
> > >
> > > Enable --remove-work option for devtool reset command that allows
> user
> > > to clean up source directory within workspace.
> > >
> > > Currently devtool reset command only removes recipes and user is
> > > forced to manually remove the sources directory within the
> workspace
> > > before running devtool modify again.
> > >
> > > Using devtool reset -r or devtool reset --remove-work option, user
> can
> > > cleanup the sources directory along with the recipe instead of
> > > manually cleaning it.
> >
> > perhaps we can have another cmd like "reset-all" like cleanall ?
> > which would remove everything that devtool did external to bblayers
> for that
> > recipe.
> >
> > >
> > > syntax: devtool reset -r <recipename>
> > >     Ex: devtool reset -r zip
> > >
> > >         devtool finish -r <recipename> <layer-name>
> > >     Ex: devtool finish -r zip meta-yocto-bsp
> > >
> > > Signed-off-by: Sai Hari Chandana Kalluri
> <chandana.kalluri@xilinx.com>
> > > ---
> > >  scripts/lib/devtool/standard.py | 26 +++++++++++++++++++-------
> > >  1 file changed, 19 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/scripts/lib/devtool/standard.py
> > > b/scripts/lib/devtool/standard.py index 60c9a04..1c0cd8a 100644
> > > --- a/scripts/lib/devtool/standard.py
> > > +++ b/scripts/lib/devtool/standard.py
> > > @@ -1852,7 +1852,7 @@ def status(args, config, basepath,
> workspace):
> > >      return 0
> > >
> > >
> > > -def _reset(recipes, no_clean, config, basepath, workspace):
> > > +def _reset(recipes, no_clean, remove_work, config, basepath,
> workspace):
> > >      """Reset one or more recipes"""
> > >      import oe.path
> > >
> > > @@ -1930,10 +1930,15 @@ def _reset(recipes, no_clean, config,
> basepath,
> > workspace):
> > >          srctreebase = workspace[pn]['srctreebase']
> > >          if os.path.isdir(srctreebase):
> > >              if os.listdir(srctreebase):
> > > -                # We don't want to risk wiping out any work in
> progress
> > > -                logger.info('Leaving source tree %s as-is; if you
> no '
> > > -                            'longer need it then please delete it
> manually'
> > > -                            % srctreebase)
> > > +                    if remove_work:
> > > +                        logger.info('-r argument used on %s,
> removing source tree.'
> > > +                                    ' You will lose any unsaved
> work' %pn)
> > > +                        shutil.rmtree(srctreebase)
> > > +                    else:
> > > +                        # We don't want to risk wiping out any
> work in progress
> > > +                        logger.info('Leaving source tree %s as-is;
> if you no '
> > > +                                    'longer need it then please
> delete it manually'
> > > +                                    % srctreebase)
> > >              else:
> > >                  # This is unlikely, but if it's empty we can just
> remove it
> > >                  os.rmdir(srctreebase) @@ -1943,6 +1948,10 @@ def
> > > _reset(recipes, no_clean, config, basepath, workspace):
> > >  def reset(args, config, basepath, workspace):
> > >      """Entry point for the devtool 'reset' subcommand"""
> > >      import bb
> > > +    import shutil
> > > +
> > > +    recipes = ""
> > > +
> > >      if args.recipename:
> > >          if args.all:
> > >              raise DevtoolError("Recipe cannot be specified if
> > > -a/--all is used") @@ -1957,7 +1966,7 @@ def reset(args, config,
> basepath,
> > workspace):
> > >      else:
> > >          recipes = args.recipename
> > >
> > > -    _reset(recipes, args.no_clean, config, basepath, workspace)
> > > +    _reset(recipes, args.no_clean, args.remove_work, config,
> > > + basepath, workspace)
> > >
> > >      return 0
> > >
> > > @@ -2009,6 +2018,7 @@ def finish(args, config, basepath,
> workspace):
> > >              raise DevtoolError('Source tree is not
> > > clean:\n\n%s\nEnsure you have committed your changes or use -f/--
> force
> > > if you are sure there\'s nothing that needs to be committed' %
> dirty)
> > >
> > >      no_clean = args.no_clean
> > > +    remove_work=args.remove_work
> > >      tinfoil = setup_tinfoil(basepath=basepath, tracking=True)
> > >      try:
> > >          rd = parse_recipe(config, tinfoil, args.recipename, True)
> @@
> > > -2160,7 +2170,7 @@ def finish(args, config, basepath, workspace):
> > >      if args.dry_run:
> > >          logger.info('Resetting recipe (dry-run)')
> > >      else:
> > > -        _reset([args.recipename], no_clean=no_clean,
> config=config,
> > basepath=basepath, workspace=workspace)
> > > +        _reset([args.recipename], no_clean=no_clean,
> > > + remove_work=remove_work, config=config, basepath=basepath,
> > > + workspace=workspace)
> > >
> > >      return 0
> > >
> > > @@ -2272,6 +2282,7 @@ def register_commands(subparsers, context):
> > >      parser_reset.add_argument('recipename', nargs='*',
> help='Recipe to
> > reset')
> > >      parser_reset.add_argument('--all', '-a', action="store_true",
> help='Reset all
> > recipes (clear workspace)')
> > >      parser_reset.add_argument('--no-clean', '-n',
> > > action="store_true", help='Don\'t clean the sysroot to remove
> recipe
> > > output')
> > > +    parser_reset.add_argument('--remove-work', '-r',
> > > + action="store_true", help='Clean the sources directory along with
> > > + append')
> > >      parser_reset.set_defaults(func=reset)
> > >
> > >      parser_finish = subparsers.add_parser('finish', help='Finish
> > > working on a recipe in your workspace', @@ -2282,6 +2293,7 @@ def
> > register_commands(subparsers, context):
> > >      parser_finish.add_argument('--mode', '-m', choices=['patch',
> 'srcrev',
> > 'auto'], default='auto', help='Update mode (where %(metavar)s is
> %(choices)s;
> > default is %(default)s)', metavar='MODE')
> > >      parser_finish.add_argument('--initial-rev', help='Override
> starting revision
> > for patches')
> > >      parser_finish.add_argument('--force', '-f',
> action="store_true",
> > > help='Force continuing even if there are uncommitted changes in the
> > > source tree repository')
> > > +    parser_finish.add_argument('--remove-work', '-r',
> > > + action="store_true", help='Clean the sources directory under
> > > + workspace')
> > >      parser_finish.add_argument('--no-clean', '-n',
> action="store_true",
> > help='Don\'t clean the sysroot to remove recipe output')
> > >      parser_finish.add_argument('--no-overrides', '-O',
> action="store_true",
> > help='Do not handle other override branches (if they exist)')
> > >      parser_finish.add_argument('--dry-run', '-N',
> > > action="store_true", help='Dry-run (just report changes instead of
> > > writing them)')
> > > --
> > > 2.7.4
> > >
> 
> Thanks,
> Chandana

//Peter


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

* Re: [master][PATCH] devtool: Add --remove-work option for devtool reset command
  2019-10-08 17:37     ` Peter Kjellerstedt
@ 2019-10-08 17:39       ` Khem Raj
  2019-10-09  2:02         ` Paul Eggleton
  0 siblings, 1 reply; 8+ messages in thread
From: Khem Raj @ 2019-10-08 17:39 UTC (permalink / raw)
  To: Peter Kjellerstedt
  Cc: Paul Eggleton, Patches and discussions about the oe-core layer

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

On Tue, Oct 8, 2019 at 10:37 AM Peter Kjellerstedt <
peter.kjellerstedt@axis.com> wrote:

> > -----Original Message-----
> > From: openembedded-core-bounces@lists.openembedded.org <openembedded-
> > core-bounces@lists.openembedded.org> On Behalf Of Chandana Kalluri
> > Sent: den 8 oktober 2019 04:14
> > To: Paul Eggleton <paul.eggleton@linux.intel.com>
> > Cc: Patches and discussions about the oe-core layer <openembedded-
> > core@lists.openembedded.org>
> > Subject: Re: [OE-core] [OE-Core][master][PATCH] devtool: Add --remove-
> > work option for devtool reset command
> >
> > Hi Paul,
> >
> > Any thoughts on implementing this as a separate command  as suggested
> > by Khem?
>
> For what it's worth, I think the original suggested solution with a new
> option to the existing `devtool reset` and `devtool finish` commands is
> the better one.


Yeah thinking about it again we already have two commands which would need
same functionality it’s not good to introduce a third one although I think
the usability of current solution will be a bit nicer if it was independent
option

>
>
> > > -----Original Message-----
> > > From: Khem Raj <raj.khem@gmail.com>
> > > Sent: Monday, October 7, 2019 11:40 AM
> > > To: Chandana Kalluri <ckalluri@xilinx.com>
> > > Cc: Patches and discussions about the oe-core layer <openembedded-
> > > core@lists.openembedded.org>
> > > Subject: Re: [OE-core] [OE-Core][master][PATCH] devtool: Add --
> > remove-work
> > > option for devtool reset command
> > >
> > > On Mon, Oct 7, 2019 at 11:36 AM Sai Hari Chandana Kalluri
> > > <chandana.kalluri@xilinx.com> wrote:
> > > >
> > > > Enable --remove-work option for devtool reset command that allows
> > user
> > > > to clean up source directory within workspace.
> > > >
> > > > Currently devtool reset command only removes recipes and user is
> > > > forced to manually remove the sources directory within the
> > workspace
> > > > before running devtool modify again.
> > > >
> > > > Using devtool reset -r or devtool reset --remove-work option, user
> > can
> > > > cleanup the sources directory along with the recipe instead of
> > > > manually cleaning it.
> > >
> > > perhaps we can have another cmd like "reset-all" like cleanall ?
> > > which would remove everything that devtool did external to bblayers
> > for that
> > > recipe.
> > >
> > > >
> > > > syntax: devtool reset -r <recipename>
> > > >     Ex: devtool reset -r zip
> > > >
> > > >         devtool finish -r <recipename> <layer-name>
> > > >     Ex: devtool finish -r zip meta-yocto-bsp
> > > >
> > > > Signed-off-by: Sai Hari Chandana Kalluri
> > <chandana.kalluri@xilinx.com>
> > > > ---
> > > >  scripts/lib/devtool/standard.py | 26 +++++++++++++++++++-------
> > > >  1 file changed, 19 insertions(+), 7 deletions(-)
> > > >
> > > > diff --git a/scripts/lib/devtool/standard.py
> > > > b/scripts/lib/devtool/standard.py index 60c9a04..1c0cd8a 100644
> > > > --- a/scripts/lib/devtool/standard.py
> > > > +++ b/scripts/lib/devtool/standard.py
> > > > @@ -1852,7 +1852,7 @@ def status(args, config, basepath,
> > workspace):
> > > >      return 0
> > > >
> > > >
> > > > -def _reset(recipes, no_clean, config, basepath, workspace):
> > > > +def _reset(recipes, no_clean, remove_work, config, basepath,
> > workspace):
> > > >      """Reset one or more recipes"""
> > > >      import oe.path
> > > >
> > > > @@ -1930,10 +1930,15 @@ def _reset(recipes, no_clean, config,
> > basepath,
> > > workspace):
> > > >          srctreebase = workspace[pn]['srctreebase']
> > > >          if os.path.isdir(srctreebase):
> > > >              if os.listdir(srctreebase):
> > > > -                # We don't want to risk wiping out any work in
> > progress
> > > > -                logger.info('Leaving source tree %s as-is; if you
> > no '
> > > > -                            'longer need it then please delete it
> > manually'
> > > > -                            % srctreebase)
> > > > +                    if remove_work:
> > > > +                        logger.info('-r argument used on %s,
> > removing source tree.'
> > > > +                                    ' You will lose any unsaved
> > work' %pn)
> > > > +                        shutil.rmtree(srctreebase)
> > > > +                    else:
> > > > +                        # We don't want to risk wiping out any
> > work in progress
> > > > +                        logger.info('Leaving source tree %s as-is;
> > if you no '
> > > > +                                    'longer need it then please
> > delete it manually'
> > > > +                                    % srctreebase)
> > > >              else:
> > > >                  # This is unlikely, but if it's empty we can just
> > remove it
> > > >                  os.rmdir(srctreebase) @@ -1943,6 +1948,10 @@ def
> > > > _reset(recipes, no_clean, config, basepath, workspace):
> > > >  def reset(args, config, basepath, workspace):
> > > >      """Entry point for the devtool 'reset' subcommand"""
> > > >      import bb
> > > > +    import shutil
> > > > +
> > > > +    recipes = ""
> > > > +
> > > >      if args.recipename:
> > > >          if args.all:
> > > >              raise DevtoolError("Recipe cannot be specified if
> > > > -a/--all is used") @@ -1957,7 +1966,7 @@ def reset(args, config,
> > basepath,
> > > workspace):
> > > >      else:
> > > >          recipes = args.recipename
> > > >
> > > > -    _reset(recipes, args.no_clean, config, basepath, workspace)
> > > > +    _reset(recipes, args.no_clean, args.remove_work, config,
> > > > + basepath, workspace)
> > > >
> > > >      return 0
> > > >
> > > > @@ -2009,6 +2018,7 @@ def finish(args, config, basepath,
> > workspace):
> > > >              raise DevtoolError('Source tree is not
> > > > clean:\n\n%s\nEnsure you have committed your changes or use -f/--
> > force
> > > > if you are sure there\'s nothing that needs to be committed' %
> > dirty)
> > > >
> > > >      no_clean = args.no_clean
> > > > +    remove_work=args.remove_work
> > > >      tinfoil = setup_tinfoil(basepath=basepath, tracking=True)
> > > >      try:
> > > >          rd = parse_recipe(config, tinfoil, args.recipename, True)
> > @@
> > > > -2160,7 +2170,7 @@ def finish(args, config, basepath, workspace):
> > > >      if args.dry_run:
> > > >          logger.info('Resetting recipe (dry-run)')
> > > >      else:
> > > > -        _reset([args.recipename], no_clean=no_clean,
> > config=config,
> > > basepath=basepath, workspace=workspace)
> > > > +        _reset([args.recipename], no_clean=no_clean,
> > > > + remove_work=remove_work, config=config, basepath=basepath,
> > > > + workspace=workspace)
> > > >
> > > >      return 0
> > > >
> > > > @@ -2272,6 +2282,7 @@ def register_commands(subparsers, context):
> > > >      parser_reset.add_argument('recipename', nargs='*',
> > help='Recipe to
> > > reset')
> > > >      parser_reset.add_argument('--all', '-a', action="store_true",
> > help='Reset all
> > > recipes (clear workspace)')
> > > >      parser_reset.add_argument('--no-clean', '-n',
> > > > action="store_true", help='Don\'t clean the sysroot to remove
> > recipe
> > > > output')
> > > > +    parser_reset.add_argument('--remove-work', '-r',
> > > > + action="store_true", help='Clean the sources directory along with
> > > > + append')
> > > >      parser_reset.set_defaults(func=reset)
> > > >
> > > >      parser_finish = subparsers.add_parser('finish', help='Finish
> > > > working on a recipe in your workspace', @@ -2282,6 +2293,7 @@ def
> > > register_commands(subparsers, context):
> > > >      parser_finish.add_argument('--mode', '-m', choices=['patch',
> > 'srcrev',
> > > 'auto'], default='auto', help='Update mode (where %(metavar)s is
> > %(choices)s;
> > > default is %(default)s)', metavar='MODE')
> > > >      parser_finish.add_argument('--initial-rev', help='Override
> > starting revision
> > > for patches')
> > > >      parser_finish.add_argument('--force', '-f',
> > action="store_true",
> > > > help='Force continuing even if there are uncommitted changes in the
> > > > source tree repository')
> > > > +    parser_finish.add_argument('--remove-work', '-r',
> > > > + action="store_true", help='Clean the sources directory under
> > > > + workspace')
> > > >      parser_finish.add_argument('--no-clean', '-n',
> > action="store_true",
> > > help='Don\'t clean the sysroot to remove recipe output')
> > > >      parser_finish.add_argument('--no-overrides', '-O',
> > action="store_true",
> > > help='Do not handle other override branches (if they exist)')
> > > >      parser_finish.add_argument('--dry-run', '-N',
> > > > action="store_true", help='Dry-run (just report changes instead of
> > > > writing them)')
> > > > --
> > > > 2.7.4
> > > >
> >
> > Thanks,
> > Chandana
>
> //Peter
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

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

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

* Re: [master][PATCH] devtool: Add --remove-work option for devtool reset command
  2019-10-08 17:39       ` Khem Raj
@ 2019-10-09  2:02         ` Paul Eggleton
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Eggleton @ 2019-10-09  2:02 UTC (permalink / raw)
  To: Khem Raj, Peter Kjellerstedt; +Cc: openembedded-core

On Wednesday, 9 October 2019 6:39:34 AM NZDT Khem Raj wrote:
> On Tue, Oct 8, 2019 at 10:37 AM Peter Kjellerstedt <
> peter.kjellerstedt@axis.com> wrote:
> 
> > > -----Original Message-----
> > > From: openembedded-core-bounces@lists.openembedded.org <openembedded-
> > > core-bounces@lists.openembedded.org> On Behalf Of Chandana Kalluri
> > > Sent: den 8 oktober 2019 04:14
> > > To: Paul Eggleton <paul.eggleton@linux.intel.com>
> > > Cc: Patches and discussions about the oe-core layer <openembedded-
> > > core@lists.openembedded.org>
> > > Subject: Re: [OE-core] [OE-Core][master][PATCH] devtool: Add --remove-
> > > work option for devtool reset command
> > >
> > > Hi Paul,
> > >
> > > Any thoughts on implementing this as a separate command  as suggested
> > > by Khem?
> >
> > For what it's worth, I think the original suggested solution with a new
> > option to the existing `devtool reset` and `devtool finish` commands is
> > the better one.
> 
> 
> Yeah thinking about it again we already have two commands which would need
> same functionality it’s not good to introduce a third one although I think
> the usability of current solution will be a bit nicer if it was independent
> option

devtool reset does have a -a option:
  --all, -a       Reset all recipes (clear workspace)

It won't delete anything that no longer corresponds to a recipe in the 
workspace (i.e. previously reset/finished), but is that the issue that people 
are trying to solve here?

(I could see the utility of having an option to completely remove the 
workspace and everything in it - I've had to write a script to do that to save 
time for running the devtool oe-selftest tests for example, but I don't know 
how common that use case actually is for others.)

Cheers
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre




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

* Re: [master][PATCH] devtool: Add --remove-work option for devtool reset command
  2019-10-07 18:35 [master][PATCH] devtool: Add --remove-work option for devtool reset command Sai Hari Chandana Kalluri
  2019-10-07 18:39 ` Khem Raj
@ 2019-10-09  2:03 ` Paul Eggleton
  1 sibling, 0 replies; 8+ messages in thread
From: Paul Eggleton @ 2019-10-09  2:03 UTC (permalink / raw)
  To: Sai Hari Chandana Kalluri; +Cc: openembedded-core

Hi Chandana,

On Saturday, 5 October 2019 11:52:29 AM NZDT Sai Hari Chandana Kalluri wrote:
> Enable --remove-work option for devtool reset command that allows user
> to clean up source directory within workspace.
> 
> Currently devtool reset command only removes recipes and user is forced
> to manually remove the sources directory within the workspace before
> running devtool modify again.
> 
> Using devtool reset -r or devtool reset --remove-work option, user can
> cleanup the sources directory along with the recipe instead of manually
> cleaning it.

Thanks for adding this, some comments below.
 
> syntax: devtool reset -r <recipename>
>     Ex: devtool reset -r zip
> 
> 	devtool finish -r <recipename> <layer-name>
>     Ex: devtool finish -r zip meta-yocto-bsp
> 
> Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
> ---
>  scripts/lib/devtool/standard.py | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 
> diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
> index 60c9a04..1c0cd8a 100644
> --- a/scripts/lib/devtool/standard.py
> +++ b/scripts/lib/devtool/standard.py
> @@ -1852,7 +1852,7 @@ def status(args, config, basepath, workspace):
>      return 0
>  
>  
> -def _reset(recipes, no_clean, config, basepath, workspace):
> +def _reset(recipes, no_clean, remove_work, config, basepath, workspace):
>      """Reset one or more recipes"""
>      import oe.path
>  
> @@ -1930,10 +1930,15 @@ def _reset(recipes, no_clean, config, basepath, workspace):
>          srctreebase = workspace[pn]['srctreebase']
>          if os.path.isdir(srctreebase):
>              if os.listdir(srctreebase):
> -                # We don't want to risk wiping out any work in progress
> -                logger.info('Leaving source tree %s as-is; if you no '
> -                            'longer need it then please delete it manually'
> -                            % srctreebase)
> +                    if remove_work:
> +                        logger.info('-r argument used on %s, removing source tree.'
> +                                    ' You will lose any unsaved work' %pn)

This may be true, but isn't it a bit harsh given the user can't do anything about it at this point? I would simply say "Removing source tree as requested (-r)" and leave it at that.


> +                        shutil.rmtree(srctreebase)
> +                    else:
> +                        # We don't want to risk wiping out any work in progress
> +                        logger.info('Leaving source tree %s as-is; if you no '
> +                                    'longer need it then please delete it manually'
> +                                    % srctreebase)
>              else:
>                  # This is unlikely, but if it's empty we can just remove it
>                  os.rmdir(srctreebase)
> @@ -1943,6 +1948,10 @@ def _reset(recipes, no_clean, config, basepath, workspace):
>  def reset(args, config, basepath, workspace):
>      """Entry point for the devtool 'reset' subcommand"""
>      import bb
> +    import shutil
> +
> +    recipes = ""
> +
>      if args.recipename:
>          if args.all:
>              raise DevtoolError("Recipe cannot be specified if -a/--all is used")
> @@ -1957,7 +1966,7 @@ def reset(args, config, basepath, workspace):
>      else:
>          recipes = args.recipename
>  
> -    _reset(recipes, args.no_clean, config, basepath, workspace)
> +    _reset(recipes, args.no_clean, args.remove_work, config, basepath, workspace)
>  
>      return 0
>  
> @@ -2009,6 +2018,7 @@ def finish(args, config, basepath, workspace):
>              raise DevtoolError('Source tree is not clean:\n\n%s\nEnsure you have committed your changes or use -f/--force if you are sure there\'s nothing that needs to be committed' % dirty)
>  
>      no_clean = args.no_clean
> +    remove_work=args.remove_work

Please use PEP-8 spacing i.e. 

+    remove_work = args.remove_work

(Only for standalone assignments - named parameters in function calls don't use spaces around the equals)


> +    parser_reset.add_argument('--remove-work', '-r', action="store_true", help='Clean the sources directory along with append')

The help text should be "Also delete the working source tree (NOTE: will delete unsaved work)"

> +    parser_finish.add_argument('--remove-work', '-r', action="store_true", help='Clean the sources directory under workspace')

Similar with the help text: "Also delete the working source tree (NOTE: will delete uncommitted work)"

Also, please add oe-selftest tests for this as mentioned in my earlier reply - given we're deleting things here we need to make sure it doesn't regress in future.

Thanks,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre




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

* [master][PATCH] devtool: Add --remove-work option for devtool reset command
@ 2019-10-04 22:52 Sai Hari Chandana Kalluri
  0 siblings, 0 replies; 8+ messages in thread
From: Sai Hari Chandana Kalluri @ 2019-10-04 22:52 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sai Hari Chandana Kalluri

Enable --remove-work option for devtool reset command that allows user
to clean up source directory within workspace.

Currently devtool reset command only removes recipes and user is forced
to manually remove the sources directory within the workspace before
running devtool modify again.

Using devtool reset -r or devtool reset --remove-work option, user can
cleanup the sources directory along with the recipe instead of manually
cleaning it.

syntax: devtool reset -r <recipename>
    Ex: devtool reset -r zip

	devtool finish -r <recipename> <layer-name>
    Ex: devtool finish -r zip meta-yocto-bsp

Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
---
 scripts/lib/devtool/standard.py | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 60c9a04..1c0cd8a 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1852,7 +1852,7 @@ def status(args, config, basepath, workspace):
     return 0
 
 
-def _reset(recipes, no_clean, config, basepath, workspace):
+def _reset(recipes, no_clean, remove_work, config, basepath, workspace):
     """Reset one or more recipes"""
     import oe.path
 
@@ -1930,10 +1930,15 @@ def _reset(recipes, no_clean, config, basepath, workspace):
         srctreebase = workspace[pn]['srctreebase']
         if os.path.isdir(srctreebase):
             if os.listdir(srctreebase):
-                # We don't want to risk wiping out any work in progress
-                logger.info('Leaving source tree %s as-is; if you no '
-                            'longer need it then please delete it manually'
-                            % srctreebase)
+                    if remove_work:
+                        logger.info('-r argument used on %s, removing source tree.'
+                                    ' You will lose any unsaved work' %pn)
+                        shutil.rmtree(srctreebase)
+                    else:
+                        # We don't want to risk wiping out any work in progress
+                        logger.info('Leaving source tree %s as-is; if you no '
+                                    'longer need it then please delete it manually'
+                                    % srctreebase)
             else:
                 # This is unlikely, but if it's empty we can just remove it
                 os.rmdir(srctreebase)
@@ -1943,6 +1948,10 @@ def _reset(recipes, no_clean, config, basepath, workspace):
 def reset(args, config, basepath, workspace):
     """Entry point for the devtool 'reset' subcommand"""
     import bb
+    import shutil
+
+    recipes = ""
+
     if args.recipename:
         if args.all:
             raise DevtoolError("Recipe cannot be specified if -a/--all is used")
@@ -1957,7 +1966,7 @@ def reset(args, config, basepath, workspace):
     else:
         recipes = args.recipename
 
-    _reset(recipes, args.no_clean, config, basepath, workspace)
+    _reset(recipes, args.no_clean, args.remove_work, config, basepath, workspace)
 
     return 0
 
@@ -2009,6 +2018,7 @@ def finish(args, config, basepath, workspace):
             raise DevtoolError('Source tree is not clean:\n\n%s\nEnsure you have committed your changes or use -f/--force if you are sure there\'s nothing that needs to be committed' % dirty)
 
     no_clean = args.no_clean
+    remove_work=args.remove_work
     tinfoil = setup_tinfoil(basepath=basepath, tracking=True)
     try:
         rd = parse_recipe(config, tinfoil, args.recipename, True)
@@ -2160,7 +2170,7 @@ def finish(args, config, basepath, workspace):
     if args.dry_run:
         logger.info('Resetting recipe (dry-run)')
     else:
-        _reset([args.recipename], no_clean=no_clean, config=config, basepath=basepath, workspace=workspace)
+        _reset([args.recipename], no_clean=no_clean, remove_work=remove_work, config=config, basepath=basepath, workspace=workspace)
 
     return 0
 
@@ -2272,6 +2282,7 @@ def register_commands(subparsers, context):
     parser_reset.add_argument('recipename', nargs='*', help='Recipe to reset')
     parser_reset.add_argument('--all', '-a', action="store_true", help='Reset all recipes (clear workspace)')
     parser_reset.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output')
+    parser_reset.add_argument('--remove-work', '-r', action="store_true", help='Clean the sources directory along with append')
     parser_reset.set_defaults(func=reset)
 
     parser_finish = subparsers.add_parser('finish', help='Finish working on a recipe in your workspace',
@@ -2282,6 +2293,7 @@ def register_commands(subparsers, context):
     parser_finish.add_argument('--mode', '-m', choices=['patch', 'srcrev', 'auto'], default='auto', help='Update mode (where %(metavar)s is %(choices)s; default is %(default)s)', metavar='MODE')
     parser_finish.add_argument('--initial-rev', help='Override starting revision for patches')
     parser_finish.add_argument('--force', '-f', action="store_true", help='Force continuing even if there are uncommitted changes in the source tree repository')
+    parser_finish.add_argument('--remove-work', '-r', action="store_true", help='Clean the sources directory under workspace')
     parser_finish.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output')
     parser_finish.add_argument('--no-overrides', '-O', action="store_true", help='Do not handle other override branches (if they exist)')
     parser_finish.add_argument('--dry-run', '-N', action="store_true", help='Dry-run (just report changes instead of writing them)')
-- 
2.7.4



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

end of thread, other threads:[~2019-10-09  2:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 18:35 [master][PATCH] devtool: Add --remove-work option for devtool reset command Sai Hari Chandana Kalluri
2019-10-07 18:39 ` Khem Raj
2019-10-08  2:14   ` Chandana Kalluri
2019-10-08 17:37     ` Peter Kjellerstedt
2019-10-08 17:39       ` Khem Raj
2019-10-09  2:02         ` Paul Eggleton
2019-10-09  2:03 ` Paul Eggleton
  -- strict thread matches above, loose matches on Subject: below --
2019-10-04 22:52 Sai Hari Chandana Kalluri

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.