devtool: modify: Catch git submodule error for go code
PATCH 1/3 devtool: modify: Catch git submodule error for go code
From: Anton Almqvist <[email protected]>
One of the git submodule commands failed for source extracted for recipes using go.bbclass. The root cause is probably the path set up by go_do_unpack which makes S and gitroot not match.
This patch does not fix the root problem, but at least it is no worse than before the git submodule support.
The extracted source will still have two .git folders, one in S created by devtool and one in the go path which will contain the tru git history.
[ YOCTO #15483 ]
--- scripts/lib/devtool/standard.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/lib/devtool/standard.py +4 -1
@@ -893,7 +893,10 @@ def modify(args, config, basepath, workspace): (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_revs["."], cwd=srctree) commits["."] = stdout.split() check_commits = True - (stdout, _) = bb.process.run('git submodule --quiet foreach --recursive \'echo `git rev-parse devtool-base` $PWD\'', cwd=srctree) + try: + (stdout, _) = bb.process.run('git submodule --quiet foreach --recursive \'echo `git rev-parse devtool-base` $PWD\'', cwd=srctree) + except bb.process.ExecutionError: + stdout = "" for line in stdout.splitlines(): (rev, submodule_path) = line.split() submodule = os.path.relpath(submodule_path, srctree)
PATCH 2/3 oeqa/selftest/devtool: add test for modifying recipes using go.bbclass
From: Ola x Nilsson <[email protected]>
go.bbclass uses a special do_unpack function that causes the git root to be different from S. Verify that it unpacks as expected.
[ YOCTO #15483 ]
--- meta/lib/oeqa/selftest/cases/devtool.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
meta/lib/oeqa/selftest/cases/devtool.py +19 -0
@@ -749,6 +749,25 @@ class DevtoolModifyTests(DevtoolBase): result = runCmd('devtool status') self.assertNotIn('mdadm', result.output) + def test_devtool_modify_go(self): + import oe.path + from tempfile import TemporaryDirectory + with TemporaryDirectory(prefix='devtoolqa') as tempdir: + self.track_for_cleanup(self.workspacedir) + self.add_command_to_tearDown('bitbake -c clean go-helloworld') + self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') + result = runCmd('devtool modify go-helloworld -x %s' % tempdir) + self.assertExists( + oe.path.join(tempdir, 'src', 'golang.org', 'x', 'example', 'go.mod'), + 'Extracted source could not be found' + ) + self.assertExists( + oe.path.join(self.workspacedir, 'conf', 'layer.conf'), + 'Workspace directory not created' + ) + matches = glob.glob(oe.path.join(self.workspacedir, 'appends', 'go-helloworld_*.bbappend')) + self.assertTrue(matches, 'bbappend not created %s' % result.output) + def test_devtool_buildclean(self): def assertFile(path, *paths): f = os.path.join(path, *paths)
PATCH 3/3 base-files: profile: fix error sh: 1: unknown operand
In reply to Peter KjellerstedtFrom: Felix Nilsson <[email protected]>
Handle errors when SHLVL isn't set.
--- meta/recipes-core/base-files/base-files/profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/base-files/base-files/profile +1 -1
@@ -58,7 +58,7 @@ resize() { fi # only do this for /dev/tty[A-z] which are typically # serial ports - if [ $FIRSTTIMESETUP -eq 1 -a $SHLVL -eq 1 ] ; then + if [ $FIRSTTIMESETUP -eq 1 -a ${SHLVL:-1} -eq 1 ] ; then case $(tty 2>/dev/null) in /dev/tty[A-z]*) resize >/dev/null;; esac