Skip to contentSkip to conversation

Minor devtool / recipetool fixes

PATCH New Paul Eggleton 1 participant 4 messages Jun 13, 2016

lore
Share & tools
lore
#0 lore raw

cover Minor devtool / recipetool fixes

The following changes since commit 2fdd2c1434e7c741b8048145bd460c68bea7ee53:

systemtap: add build dependency on ncurses (2016-06-12 23:47:00 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib paule/devtool17-oe
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/devtool17-oe

Paul Eggleton (3):
devtool: tweak README in created workspace layer
devtool: reset: allow specifying multiple recipes
scripts: ensure not specifying subcommand shows help text

 scripts/contrib/devtool-stress.py |  1 +
 scripts/devtool                   | 12 ++++++++----
 scripts/lib/devtool/standard.py   |  9 +++++----
 scripts/recipetool                |  1 +
 4 files changed, 15 insertions(+), 8 deletions(-)
Signature · 1 line
2.5.5
#1 lore raw

PATCH 1/3 devtool: tweak README in created workspace layer

Clarify slightly the intended usage of the workspace layer.

---
 scripts/devtool | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
scripts/devtool +7 -4
index ff368dc..63d2ef9 100755
@@ -179,13 +179,16 @@ def _create_workspace(workspacedir, config, basepath):
         # Add a README file
         with open(os.path.join(workspacedir, 'README'), 'w') as f:
             f.write('This layer was created by the OpenEmbedded devtool utility in order to\n')
-            f.write('contain recipes and bbappends. In most instances you should use the\n')
+            f.write('contain recipes and bbappends that are currently being worked on. The idea\n')
+            f.write('is that the contents is temporary - once you have finished working on a\n')
+            f.write('recipe you use the appropriate method to move the files you have been\n')
+            f.write('working on to a proper layer. In most instances you should use the\n')
             f.write('devtool utility to manage files within it rather than modifying files\n')
             f.write('directly (although recipes added with "devtool add" will often need\n')
             f.write('direct modification.)\n')
-            f.write('\nIf you no longer need to use devtool you can remove the path to this\n')
-            f.write('workspace layer from your conf/bblayers.conf file (and then delete the\n')
-            f.write('layer, if you wish).\n')
+            f.write('\nIf you no longer need to use devtool or the workspace layer\'s contents\n')
+            f.write('you can remove the path to this workspace layer from your conf/bblayers.conf')
+            f.write('file (and then delete the layer, if you wish).\n')
             f.write('\nNote that by default, if devtool fetches and unpacks source code, it\n')
             f.write('will place it in a subdirectory of a "sources" subdirectory of the\n')
             f.write('layer. If you prefer it to be elsewhere you can specify the source\n')
Signature · 1 line
2.5.5
#2 lore raw

PATCH 2/3 devtool: reset: allow specifying multiple recipes

In reply to Paul Eggleton

Allow specifying more than one recipe on the devtool reset command line.

Also tweak the help text slightly.

---
 scripts/lib/devtool/standard.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
scripts/lib/devtool/standard.py +5 -4
index a2516d6..ed49a93 100644
@@ -1304,14 +1304,15 @@ def reset(args, config, basepath, workspace):
         if args.all:
             raise DevtoolError("Recipe cannot be specified if -a/--all is used")
         else:
-            check_workspace_recipe(workspace, args.recipename, checksrc=False)
+            for recipe in args.recipename:
+                check_workspace_recipe(workspace, recipe, checksrc=False)
     elif not args.all:
         raise DevtoolError("Recipe must be specified, or specify -a/--all to "
                            "reset all recipes")
     if args.all:
         recipes = list(workspace.keys())
     else:
-        recipes = [args.recipename]
+        recipes = args.recipename
 
     if recipes and not args.no_clean:
         if len(recipes) == 1:
@@ -1449,9 +1450,9 @@ def register_commands(subparsers, context):
     parser_status.set_defaults(func=status)
 
     parser_reset = subparsers.add_parser('reset', help='Remove a recipe from your workspace',
-                                         description='Removes the specified recipe from your workspace (resetting its state)',
+                                         description='Removes the specified recipe(s) from your workspace (resetting its state back to that defined by the metadata).',
                                          group='working', order=-100)
-    parser_reset.add_argument('recipename', nargs='?', help='Recipe to reset')
+    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.set_defaults(func=reset)
Signature · 1 line
2.5.5
#3 lore raw

PATCH 3/3 scripts: ensure not specifying subcommand shows help text

In reply to Paul Eggleton

With Python 2, argparse subparsers behaviour in Python 2 was to print the usage information if the subparsers argument wasn't specified. However, with Python 3.2.3 and later a subparsers argument is not required by default, leading to errors when no arguments are specified:

AttributeError: 'Namespace' object has no attribute 'func'

Restore the previous desired behaviour of showing the help text for devtool, recipetool and the devtool-stress script by setting subparsers.required to True.

---
 scripts/contrib/devtool-stress.py | 1 +
 scripts/devtool                   | 1 +
 scripts/recipetool                | 1 +
 3 files changed, 3 insertions(+)
scripts/contrib/devtool-stress.py +1 -0
index 2723491..ab77a2d 100755
@@ -213,6 +213,7 @@ def main():
     parser.add_argument('-s', '--skip', help='Skip specified recipes (comma-separated without spaces, wildcards allowed)', metavar='PNLIST')
     parser.add_argument('-c', '--skip-classes', help='Skip recipes inheriting specified classes (comma-separated) - default %(default)s', metavar='CLASSLIST', default='native,nativesdk,cross,cross-canadian,image,populate_sdk,meta,packagegroup')
     subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>')
+    subparsers.required = True
 
     parser_modify = subparsers.add_parser('modify',
                                           help='Run "devtool modify" followed by a build with bitbake on matching recipes',
scripts/devtool +1 -0
index 63d2ef9..a93a11f 100755
@@ -301,6 +301,7 @@ def main():
         tinfoil.shutdown()
 
     subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>')
+    subparsers.required = True
 
     subparsers.add_subparser_group('sdk', 'SDK maintenance', -2)
     subparsers.add_subparser_group('advanced', 'Advanced', -1)
scripts/recipetool +1 -0
index 0e8bffb..17233d4 100755
@@ -60,6 +60,7 @@ def main():
     parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS,
                         help='show this help message and exit')
     subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>')
+    subparsers.required = True
 
     if global_args.debug:
         logger.setLevel(logging.DEBUG)
Signature · 1 line
2.5.5