summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-10-14 19:19:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-21 22:56:03 +0100
commitdb55d31dc2cc5336c09d379e5da5d2d67cc2619a (patch)
tree6367222d6efa600a7b7f417987bffe0d878b7e60 /meta/lib
parent8578bc17b54da97d42b257b3c8f398ac52b91a9f (diff)
downloadpoky-db55d31dc2cc5336c09d379e5da5d2d67cc2619a.tar.gz
devtool: handle virtual providers
For modify / extract / upgrade, if the specified "recipe" is not actually a recipe but a virtual target such as virtual/kernel, map it correctly to the actual recipe and make sure we use that name within the workspace. Thanks to Chris Larson for reminding me this was still broken and for a hint on how to fix it. (From OE-Core rev: 1f7752282ffb47d2621030ddb2fa42a5e491d6d2) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/recipeutils.py6
-rw-r--r--meta/lib/oeqa/selftest/devtool.py32
2 files changed, 37 insertions, 1 deletions
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 207c300667..119a68821b 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -31,9 +31,13 @@ def pn_to_recipe(cooker, pn):
31 import bb.providers 31 import bb.providers
32 32
33 if pn in cooker.recipecache.pkg_pn: 33 if pn in cooker.recipecache.pkg_pn:
34 filenames = cooker.recipecache.pkg_pn[pn]
35 best = bb.providers.findBestProvider(pn, cooker.data, cooker.recipecache, cooker.recipecache.pkg_pn) 34 best = bb.providers.findBestProvider(pn, cooker.data, cooker.recipecache, cooker.recipecache.pkg_pn)
36 return best[3] 35 return best[3]
36 elif pn in cooker.recipecache.providers:
37 filenames = cooker.recipecache.providers[pn]
38 eligible, foundUnique = bb.providers.filterProviders(filenames, pn, cooker.expanded_data, cooker.recipecache)
39 filename = eligible[0]
40 return filename
37 else: 41 else:
38 return None 42 return None
39 43
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index baa56d6dc1..e4de309e72 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -466,6 +466,28 @@ class DevtoolTests(DevtoolBase):
466 # Try building 466 # Try building
467 bitbake(testrecipe) 467 bitbake(testrecipe)
468 468
469 def test_devtool_modify_virtual(self):
470 # Try modifying a virtual recipe
471 virtrecipe = 'virtual/libx11'
472 realrecipe = 'libx11'
473 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
474 self.track_for_cleanup(tempdir)
475 self.track_for_cleanup(self.workspacedir)
476 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
477 result = runCmd('devtool modify %s -x %s' % (virtrecipe, tempdir))
478 self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile.am')), 'Extracted source could not be found')
479 self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created')
480 matches = glob.glob(os.path.join(self.workspacedir, 'appends', '%s_*.bbappend' % realrecipe))
481 self.assertTrue(matches, 'bbappend not created %s' % result.output)
482 # Test devtool status
483 result = runCmd('devtool status')
484 self.assertNotIn(virtrecipe, result.output)
485 self.assertIn(realrecipe, result.output)
486 # Check git repo
487 self._check_src_repo(tempdir)
488 # This is probably sufficient
489
490
469 @testcase(1169) 491 @testcase(1169)
470 def test_devtool_update_recipe(self): 492 def test_devtool_update_recipe(self):
471 # Check preconditions 493 # Check preconditions
@@ -805,6 +827,16 @@ class DevtoolTests(DevtoolBase):
805 self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile.am')), 'Extracted source could not be found') 827 self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile.am')), 'Extracted source could not be found')
806 self._check_src_repo(tempdir) 828 self._check_src_repo(tempdir)
807 829
830 def test_devtool_extract_virtual(self):
831 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
832 # Try devtool extract
833 self.track_for_cleanup(tempdir)
834 self.track_for_cleanup(self.workspacedir)
835 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
836 result = runCmd('devtool extract virtual/libx11 %s' % tempdir)
837 self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile.am')), 'Extracted source could not be found')
838 self._check_src_repo(tempdir)
839
808 @testcase(1168) 840 @testcase(1168)
809 def test_devtool_reset_all(self): 841 def test_devtool_reset_all(self):
810 tempdir = tempfile.mkdtemp(prefix='devtoolqa') 842 tempdir = tempfile.mkdtemp(prefix='devtoolqa')