]> code.ossystems Code Review - openembedded-core.git/commitdiff
devtool: disable creating workspace for extract and search subcommands
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Sun, 11 Oct 2015 15:13:18 +0000 (16:13 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 1 Dec 2015 21:30:54 +0000 (21:30 +0000)
For subcommands that don't actually involve the workspace, don't
auto-create the workspace.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/selftest/devtool.py
scripts/devtool
scripts/lib/devtool/search.py
scripts/lib/devtool/standard.py

index dcdef5a14be9d6753d117e16cfc72f31551ddcf4..0a44ae71c828c1b99d11d6b3d9793e098504af4e 100644 (file)
@@ -823,10 +823,10 @@ class DevtoolTests(DevtoolBase):
         tempdir = tempfile.mkdtemp(prefix='devtoolqa')
         # Try devtool extract
         self.track_for_cleanup(tempdir)
-        self.track_for_cleanup(self.workspacedir)
-        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
         result = runCmd('devtool extract remake %s' % tempdir)
         self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile.am')), 'Extracted source could not be found')
+        # devtool extract shouldn't create the workspace
+        self.assertFalse(os.path.exists(self.workspacedir))
         self._check_src_repo(tempdir)
 
     @testcase(1379)
@@ -834,10 +834,10 @@ class DevtoolTests(DevtoolBase):
         tempdir = tempfile.mkdtemp(prefix='devtoolqa')
         # Try devtool extract
         self.track_for_cleanup(tempdir)
-        self.track_for_cleanup(self.workspacedir)
-        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
         result = runCmd('devtool extract virtual/libx11 %s' % tempdir)
         self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile.am')), 'Extracted source could not be found')
+        # devtool extract shouldn't create the workspace
+        self.assertFalse(os.path.exists(self.workspacedir))
         self._check_src_repo(tempdir)
 
     @testcase(1168)
index e4d9db301a827a76517fb38d3f49bfa40860bd8a..2a5a3d41c17521c3152a7374978dd39f29c052d3 100755 (executable)
@@ -261,7 +261,7 @@ def main():
                                                         description='Sets up a new workspace. NOTE: other devtool subcommands will create a workspace automatically as needed, so you only need to use %(prog)s if you want to specify where the workspace should be located.')
         parser_create_workspace.add_argument('layerpath', nargs='?', help='Path in which the workspace layer should be created')
         parser_create_workspace.add_argument('--create-only', action="store_true", help='Only create the workspace layer, do not alter configuration')
-        parser_create_workspace.set_defaults(func=create_workspace)
+        parser_create_workspace.set_defaults(func=create_workspace, no_workspace=True)
 
     for plugin in plugins:
         if hasattr(plugin, 'register_commands'):
@@ -269,7 +269,7 @@ def main():
 
     args = parser.parse_args(unparsed_args, namespace=global_args)
 
-    if args.subparser_name != 'create-workspace':
+    if not getattr(args, 'no_workspace', False):
         read_workspace()
 
     try:
index c2f420c33ce6dde67f38594330b69e7c2901495c..1c8eaff49b66b1a82f03c325821bb9403cc30566 100644 (file)
@@ -77,4 +77,4 @@ def register_commands(subparsers, context):
     parser_search = subparsers.add_parser('search', help='Search available recipes',
                                             description='Searches for available target recipes. Matches on recipe name, package name, description and installed files, and prints the recipe name on match.')
     parser_search.add_argument('keyword', help='Keyword to search for (regular expression syntax allowed)')
-    parser_search.set_defaults(func=search)
+    parser_search.set_defaults(func=search, no_workspace=True)
index 9fd936f1461e57ee704c2c70a0ade90be5d57960..6de24eb524968d8367b9736efa8e8eb72d73ce60 100644 (file)
@@ -1166,7 +1166,7 @@ def register_commands(subparsers, context):
     parser_extract.add_argument('srctree', help='Path to where to extract the source tree')
     parser_extract.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout')
     parser_extract.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)')
-    parser_extract.set_defaults(func=extract)
+    parser_extract.set_defaults(func=extract, no_workspace=True)
 
     parser_sync = subparsers.add_parser('sync', help='Synchronize the source for an existing recipe',
                                        description='Synchronize the source for an existing recipe',