bitbake-prserv-tool: check file name

Fixed:
$ bitbake-prserv-tool import /tmp/1
  File "/path/to/lib/bb/parse/__init__.py", line 114, in handle(fn='/tmp/1', data=<bb.data_smart.DataSmart object at 0x2369bd0>, include=True):
                     return h['handle'](fn, data, include)
    >    raise ParseError("not a BitBake file", fn)

ParseError: ParseError in /tmp/1: not a BitBake file

But 1.conf or 1.inc works well, check the filename and print proper
error message.

(From OE-Core rev: 273eee7a3614caea17c5bc93b720353641293cf7)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang 2015-11-11 23:34:40 -08:00 committed by Richard Purdie
parent 4e2c5e171c
commit e67c5b0ccf
1 changed files with 9 additions and 0 deletions

View File

@ -86,6 +86,15 @@ do_migrate_localcount ()
[ $# -eq 0 ] && help && exit 1
case $2 in
*.conf|*.inc)
;;
*)
echo ERROR: $2 must end with .conf or .inc!
exit 1
;;
esac
case $1 in
export)
do_export $2