diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-10-31 16:59:49 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-11-07 11:04:22 +0000 |
commit | 43e652f3d1fee5ce7fad67e6400315eab1b34270 (patch) | |
tree | 9ae959057d9a6725fcb53b9023fa32f0920f6545 /meta/lib | |
parent | 7aebaa4204c89a60db5e6a691672849fcb392010 (diff) | |
download | poky-43e652f3d1fee5ce7fad67e6400315eab1b34270.tar.gz |
devtool: add "rename" subcommand
When you run devtool add on a source tree we attempt to figure out the
correct name and version for the recipe. However, despite our best
efforts, sometimes the name and/or version we come up with isn't
correct, and the only way to remedy that up until now was to reset the
recipe, delete the source tree and start again, specifying the name this
time. To avoid this slightly painful procedure, add a "rename"
subcommand that lets you rename the recipe and/or change the version.
(From OE-Core rev: 9303d8055c45a0f6af295d70a6f6a8b9d8d8a7c9)
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/oeqa/selftest/devtool.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py index 71d205c73f..46f5a0b998 100644 --- a/meta/lib/oeqa/selftest/devtool.py +++ b/meta/lib/oeqa/selftest/devtool.py | |||
@@ -1349,3 +1349,63 @@ class DevtoolTests(DevtoolBase): | |||
1349 | files.remove(foundpatch) | 1349 | files.remove(foundpatch) |
1350 | if files: | 1350 | if files: |
1351 | self.fail('Unexpected file(s) copied next to bbappend: %s' % ', '.join(files)) | 1351 | self.fail('Unexpected file(s) copied next to bbappend: %s' % ', '.join(files)) |
1352 | |||
1353 | def test_devtool_rename(self): | ||
1354 | # Check preconditions | ||
1355 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
1356 | self.track_for_cleanup(self.workspacedir) | ||
1357 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
1358 | |||
1359 | # First run devtool add | ||
1360 | # We already have this recipe in OE-Core, but that doesn't matter | ||
1361 | recipename = 'i2c-tools' | ||
1362 | recipever = '3.1.2' | ||
1363 | recipefile = os.path.join(self.workspacedir, 'recipes', recipename, '%s_%s.bb' % (recipename, recipever)) | ||
1364 | url = 'http://downloads.yoctoproject.org/mirror/sources/i2c-tools-%s.tar.bz2' % recipever | ||
1365 | def add_recipe(): | ||
1366 | result = runCmd('devtool add %s' % url) | ||
1367 | self.assertTrue(os.path.exists(recipefile), 'Expected recipe file not created') | ||
1368 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'sources', recipename)), 'Source directory not created') | ||
1369 | checkvars = {} | ||
1370 | checkvars['S'] = None | ||
1371 | checkvars['SRC_URI'] = url.replace(recipever, '${PV}') | ||
1372 | self._test_recipe_contents(recipefile, checkvars, []) | ||
1373 | add_recipe() | ||
1374 | # Now rename it - change both name and version | ||
1375 | newrecipename = 'mynewrecipe' | ||
1376 | newrecipever = '456' | ||
1377 | newrecipefile = os.path.join(self.workspacedir, 'recipes', newrecipename, '%s_%s.bb' % (newrecipename, newrecipever)) | ||
1378 | result = runCmd('devtool rename %s %s -V %s' % (recipename, newrecipename, newrecipever)) | ||
1379 | self.assertTrue(os.path.exists(newrecipefile), 'Recipe file not renamed') | ||
1380 | self.assertFalse(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipename)), 'Old recipe directory still exists') | ||
1381 | newsrctree = os.path.join(self.workspacedir, 'sources', newrecipename) | ||
1382 | self.assertTrue(os.path.exists(newsrctree), 'Source directory not renamed') | ||
1383 | checkvars = {} | ||
1384 | checkvars['S'] = '${WORKDIR}/%s-%s' % (recipename, recipever) | ||
1385 | checkvars['SRC_URI'] = url | ||
1386 | self._test_recipe_contents(newrecipefile, checkvars, []) | ||
1387 | # Try again - change just name this time | ||
1388 | result = runCmd('devtool reset -n %s' % newrecipename) | ||
1389 | shutil.rmtree(newsrctree) | ||
1390 | add_recipe() | ||
1391 | newrecipefile = os.path.join(self.workspacedir, 'recipes', newrecipename, '%s_%s.bb' % (newrecipename, recipever)) | ||
1392 | result = runCmd('devtool rename %s %s' % (recipename, newrecipename)) | ||
1393 | self.assertTrue(os.path.exists(newrecipefile), 'Recipe file not renamed') | ||
1394 | self.assertFalse(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipename)), 'Old recipe directory still exists') | ||
1395 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'sources', newrecipename)), 'Source directory not renamed') | ||
1396 | checkvars = {} | ||
1397 | checkvars['S'] = '${WORKDIR}/%s-${PV}' % recipename | ||
1398 | checkvars['SRC_URI'] = url.replace(recipever, '${PV}') | ||
1399 | self._test_recipe_contents(newrecipefile, checkvars, []) | ||
1400 | # Try again - change just version this time | ||
1401 | result = runCmd('devtool reset -n %s' % newrecipename) | ||
1402 | shutil.rmtree(newsrctree) | ||
1403 | add_recipe() | ||
1404 | newrecipefile = os.path.join(self.workspacedir, 'recipes', recipename, '%s_%s.bb' % (recipename, newrecipever)) | ||
1405 | result = runCmd('devtool rename %s -V %s' % (recipename, newrecipever)) | ||
1406 | self.assertTrue(os.path.exists(newrecipefile), 'Recipe file not renamed') | ||
1407 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'sources', recipename)), 'Source directory no longer exists') | ||
1408 | checkvars = {} | ||
1409 | checkvars['S'] = '${WORKDIR}/${BPN}-%s' % recipever | ||
1410 | checkvars['SRC_URI'] = url | ||
1411 | self._test_recipe_contents(newrecipefile, checkvars, []) | ||