aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/pysh
AgeCommit message (Collapse)Author
2020-07-12pyshyacc: allow double COMMA statementsKonrad Weihmann
this allows shell statements like '; ;' to pass the parser. As it may be bad code but still valid enough to execute Signed-off-by: Konrad Weihmann <kweihmann@outlook.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08bitbake: pysh: Improve error handling for shell codeRobert Yang
The p_error() is used for printing errors when parse shell code, but it can't the EOF error correctly - Add the following lines to quilt.inc do_configure_prepend () { find ${s} -name "*.in" -exec sed -i -e "1s,^#\!.*@perl@ -w$,#\! @perl@\nuse warnings;," {} \; if [ hello ]; then } - Before the patch: $ rm -fr cache/ tmp/cache/; bitbake -p [snip] WARNING: /path/to/quilt/quilt-native_0.65.bb: Error during finalise of /path/to/quilt/quilt-native_0.65.bb [snip] bb.pysh.sherrors.ShellSyntaxError: None followed by: We can see that this isn't easy to debug, let p_error() check wheter it is EOF and print appropriate errors can improve the error message. And don't let codeparser.py except pyshlex.NeedMore (in fact, it never worked since p_error() only raise ShellSyntaxError), but make it print the last 5 lines which might be useful for debuging. - After the patch $ rm -fr cache/ tmp/cache/; bitbake -p [snip] ERROR: /path/to/quilt/quilt_0.65.bb: Error during parse shell code, the last 5 lines are: find /path/to/quilt/0.65-r0/quilt-0.65 -name "*.in" -exec sed -i -e "1s,^#\!.*@PERL@ -w$,#\! @PERL@\nuse warnings;," {} \; if [ hello ]; then autotools_do_configure sed -e 's,^COMPAT_SYMLINKS.*:=.*,COMPAT_SYMLINKS :=,' -i /path/to/quilt/0.65-r0/quilt-0.65/Makefile [snip] File "/path/to/bb/pysh/pyshyacc.py", line 649, in p_error(p=None): w('Unexpected EOF') > raise sherrors.ShellSyntaxError(''.join(msg)) bb.pysh.sherrors.ShellSyntaxError: Unexpected EOF Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08pysh/pyshlex.py: Set is not importableRobert Yang
>>> from Set import Set Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'Set' So remove related code. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08pysh/sherrors.py: Remove unused classesRobert Yang
The only two that we need are ShellSyntaxError and ShellError, others are not used, so remove them. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-08pysh: Remove unused modulesRobert Yang
We don't use these modules in bitbake, so remove them. And pysh's author declared that pysh is no longer maintained: http://pysh.sourceforge.net/ Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-01bitbake: Convert to python 3Richard Purdie
Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-07-03lib: fix no newline at end of fileRobert Yang
Add a '\n' to the last line of the file to fix: No newline at end of file Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-10pysh: Say what kind of token isn't implementedOlof Johansson
When the shell lexer finds an unrecognized dollar token, the error message should contain what kind of token it is having problems with. Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-15make exception handling syntax consistentScott Garman
Update exception handling syntax to use the modern style: except ExcType as localvar Signed-off-by: Scott Garman <scott.a.garman@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2010-12-22pysh: add missing os.path importChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-11-11bb.pysh: add Case support to format_commandsChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-11-11bb.pysh: fix writing pyshtables all over the placeChris Larson
Signed-off-by: Chris Larson <chris_larson@mentor.com>
2010-11-11Move the pysh package into the bb packageChris Larson
The pysh we're using is modified, and we don't want to risk it conflicting with one from elsewhere. Signed-off-by: Chris Larson <chris_larson@mentor.com>