summaryrefslogtreecommitdiffstats
path: root/bitbake/contrib
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2011-01-01 23:52:50 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:54 +0000
commite8c48e668c7525257926ab7db9b6e44aa2705483 (patch)
tree488cff5fe50da4a077f959959bd0f64b855744f9 /bitbake/contrib
parent043adbfa0902dd06ed44a610a48ae3712e3ac1d3 (diff)
downloadpoky-e8c48e668c7525257926ab7db9b6e44aa2705483.tar.gz
bitbake/contrib: Sync with bitbake upstream
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/contrib')
-rw-r--r--bitbake/contrib/vim/ftdetect/bitbake.vim28
-rwxr-xr-xbitbake/contrib/vim/plugin/newbb.vim85
-rw-r--r--bitbake/contrib/vim/syntax/bitbake.vim195
3 files changed, 204 insertions, 104 deletions
diff --git a/bitbake/contrib/vim/ftdetect/bitbake.vim b/bitbake/contrib/vim/ftdetect/bitbake.vim
index 3882a9a08d..179e4d9888 100644
--- a/bitbake/contrib/vim/ftdetect/bitbake.vim
+++ b/bitbake/contrib/vim/ftdetect/bitbake.vim
@@ -1,4 +1,24 @@
1au BufNewFile,BufRead *.bb setfiletype bitbake 1" Vim filetype detection file
2au BufNewFile,BufRead *.bbclass setfiletype bitbake 2" Language: BitBake
3au BufNewFile,BufRead *.inc setfiletype bitbake 3" Author: Ricardo Salveti <rsalveti@rsalveti.net>
4" au BufNewFile,BufRead *.conf setfiletype bitbake 4" Copyright: Copyright (C) 2008 Ricardo Salveti <rsalveti@rsalveti.net>
5" Licence: You may redistribute this under the same terms as Vim itself
6"
7" This sets up the syntax highlighting for BitBake files, like .bb, .bbclass and .inc
8
9if &compatible || version < 600
10 finish
11endif
12
13" .bb and .bbclass
14au BufNewFile,BufRead *.b{b,bclass} set filetype=bitbake
15
16" .inc
17au BufNewFile,BufRead *.inc set filetype=bitbake
18
19" .conf
20au BufNewFile,BufRead *.conf
21 \ if (match(expand("%:p:h"), "conf") > 0) |
22 \ set filetype=bitbake |
23 \ endif
24
diff --git a/bitbake/contrib/vim/plugin/newbb.vim b/bitbake/contrib/vim/plugin/newbb.vim
new file mode 100755
index 0000000000..afba1d9aa4
--- /dev/null
+++ b/bitbake/contrib/vim/plugin/newbb.vim
@@ -0,0 +1,85 @@
1" Vim plugin file
2" Purpose: Create a template for new bb files
3" Author: Ricardo Salveti <rsalveti@gmail.com>
4" Copyright: Copyright (C) 2008 Ricardo Salveti <rsalveti@gmail.com>
5"
6" This file is licensed under the MIT license, see COPYING.MIT in
7" this source distribution for the terms.
8"
9" Based on the gentoo-syntax package
10"
11" Will try to use git to find the user name and email
12
13if &compatible || v:version < 600
14 finish
15endif
16
17fun! <SID>GetUserName()
18 let l:user_name = system("git-config --get user.name")
19 if v:shell_error
20 return "Unknow User"
21 else
22 return substitute(l:user_name, "\n", "", "")
23endfun
24
25fun! <SID>GetUserEmail()
26 let l:user_email = system("git-config --get user.email")
27 if v:shell_error
28 return "unknow@user.org"
29 else
30 return substitute(l:user_email, "\n", "", "")
31endfun
32
33fun! BBHeader()
34 let l:current_year = strftime("%Y")
35 let l:user_name = <SID>GetUserName()
36 let l:user_email = <SID>GetUserEmail()
37 0 put ='# Copyright (C) ' . l:current_year .
38 \ ' ' . l:user_name . ' <' . l:user_email . '>'
39 put ='# Released under the MIT license (see COPYING.MIT for the terms)'
40 $
41endfun
42
43fun! NewBBTemplate()
44 let l:paste = &paste
45 set nopaste
46
47 " Get the header
48 call BBHeader()
49
50 " New the bb template
51 put ='DESCRIPTION = \"\"'
52 put ='HOMEPAGE = \"\"'
53 put ='LICENSE = \"\"'
54 put ='SECTION = \"\"'
55 put ='DEPENDS = \"\"'
56 put ='PR = \"r0\"'
57 put =''
58 put ='SRC_URI = \"\"'
59
60 " Go to the first place to edit
61 0
62 /^DESCRIPTION =/
63 exec "normal 2f\""
64
65 if paste == 1
66 set paste
67 endif
68endfun
69
70if !exists("g:bb_create_on_empty")
71 let g:bb_create_on_empty = 1
72endif
73
74" disable in case of vimdiff
75if v:progname =~ "vimdiff"
76 let g:bb_create_on_empty = 0
77endif
78
79augroup NewBB
80 au BufNewFile *.bb
81 \ if g:bb_create_on_empty |
82 \ call NewBBTemplate() |
83 \ endif
84augroup END
85
diff --git a/bitbake/contrib/vim/syntax/bitbake.vim b/bitbake/contrib/vim/syntax/bitbake.vim
index be55980b3a..b46436a567 100644
--- a/bitbake/contrib/vim/syntax/bitbake.vim
+++ b/bitbake/contrib/vim/syntax/bitbake.vim
@@ -1,127 +1,122 @@
1" Vim syntax file 1" Vim syntax file
2" Language: BitBake bb/bbclasses/inc
3" Author: Chris Larson <kergoth@handhelds.org>
4" Ricardo Salveti <rsalveti@rsalveti.net>
5" Copyright: Copyright (C) 2004 Chris Larson <kergoth@handhelds.org>
6" Copyright (C) 2008 Ricardo Salveti <rsalveti@rsalveti.net>
2" 7"
3" Copyright (C) 2004 Chris Larson <kergoth@handhelds.org>
4" This file is licensed under the MIT license, see COPYING.MIT in 8" This file is licensed under the MIT license, see COPYING.MIT in
5" this source distribution for the terms. 9" this source distribution for the terms.
6" 10"
7" Language: BitBake 11" Syntax highlighting for bb, bbclasses and inc files.
8" Maintainer: Chris Larson <kergoth@handhelds.org>
9" Filenames: *.bb, *.bbclass
10
11if version < 600
12 syntax clear
13elseif exists("b:current_syntax")
14 finish
15endif
16
17syn case match
18
19" Catch incorrect syntax (only matches if nothing else does)
20" 12"
21syn match bbUnmatched "." 13" It's an entirely new type, just has specific syntax in shell and python code
22
23 14
24syn include @python syntax/python.vim 15if &compatible || v:version < 600
16 finish
17endif
25if exists("b:current_syntax") 18if exists("b:current_syntax")
26 unlet b:current_syntax 19 finish
27endif 20endif
28 21
22" BitBake syntax
29 23
30" Other 24" Matching case
31 25syn case match
32syn match bbComment "^#.*$" display contains=bbTodo
33syn keyword bbTodo TODO FIXME XXX contained
34syn match bbDelimiter "[(){}=]" contained
35syn match bbQuote /['"]/ contained
36syn match bbArrayBrackets "[\[\]]" contained
37
38
39" BitBake strings
40
41syn match bbContinue "\\$"
42syn region bbString matchgroup=bbQuote start=/"/ skip=/\\$/ excludenl end=/"/ contained keepend contains=bbTodo,bbContinue,bbVarInlinePy,bbVarDeref
43syn region bbString matchgroup=bbQuote start=/'/ skip=/\\$/ excludenl end=/'/ contained keepend contains=bbTodo,bbContinue,bbVarInlinePy,bbVarDeref
44
45" BitBake variable metadata
46
47syn match bbVarBraces "[\${}]"
48syn region bbVarDeref matchgroup=bbVarBraces start="${" end="}" contained
49" syn region bbVarDeref start="${" end="}" contained
50" syn region bbVarInlinePy start="${@" end="}" contained contains=@python
51syn region bbVarInlinePy matchgroup=bbVarBraces start="${@" end="}" contained contains=@python
52
53syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite
54" syn match bbVarDeref "${[a-zA-Z0-9\-_\.]\+}" contained
55syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.]\+\(_[${}a-zA/-Z0-9\-_\.]\+\)\?\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbVarDeref nextgroup=bbVarEq
56
57syn match bbIdentifier "[a-zA-Z0-9\-_\./]\+" display contained
58"syn keyword bbVarEq = display contained nextgroup=bbVarValue
59syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|=\)" contained nextgroup=bbVarValue
60syn match bbVarValue ".*$" contained contains=bbString
61
62" BitBake variable metadata flags
63syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag
64syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(=\)\@=" keepend excludenl contained contains=bbIdentifier nextgroup=bbVarEq
65"syn match bbVarFlagFlag "\[\([a-zA-Z0-9\-_\.]\+\)\]\s*\(=\)\@=" contains=bbIdentifier nextgroup=bbVarEq
66
67
68" Functions!
69syn match bbFunction "\h\w*" display contained
70 26
27" Indicates the error when nothing is matched
28syn match bbUnmatched "."
71 29
72" BitBake python metadata 30" Comments
31syn cluster bbCommentGroup contains=bbTodo,@Spell
32syn keyword bbTodo COMBAK FIXME TODO XXX contained
33syn match bbComment "#.*$" contains=@bbCommentGroup
73 34
74syn keyword bbPythonFlag python contained nextgroup=bbFunction 35" String helpers
75syn match bbPythonFuncDef "^\(python\s\+\)\(\w\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbPythonFlag,bbFunction,bbDelimiter nextgroup=bbPythonFuncRegion skipwhite 36syn match bbQuote +['"]+ contained
76syn region bbPythonFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" keepend contained contains=@python 37syn match bbDelimiter "[(){}=]" contained
77"hi def link bbPythonFuncRegion Comment 38syn match bbArrayBrackets "[\[\]]" contained
78 39
40" BitBake strings
41syn match bbContinue "\\$"
42syn region bbString matchgroup=bbQuote start=+"+ skip=+\\$+ excludenl end=+"+ contained keepend contains=bbTodo,bbContinue,bbVarDeref,@Spell
43syn region bbString matchgroup=bbQuote start=+'+ skip=+\\$+ excludenl end=+'+ contained keepend contains=bbTodo,bbContinue,bbVarDeref,@Spell
44
45" Vars definition
46syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite
47syn match bbIdentifier "[a-zA-Z0-9\-_\.\/\+]\+" display contained
48syn match bbVarDeref "${[a-zA-Z0-9\-_\.\/\+]\+}" contained
49syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|=\)" contained nextgroup=bbVarValue
50syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.\/\+]\+\(_[${}a-zA-Z0-9\-_\.\/\+]\+\)\?\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbVarDeref nextgroup=bbVarEq
51syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbVarPyValue
52syn match bbVarPyValue "${@[a-zA-Z0-9\-_\.\(\)]\+}" contained
53
54" Vars metadata flags
55syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag
56syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(=\)\@=" keepend excludenl contained contains=bbIdentifier nextgroup=bbVarEq
57
58" Includes and requires
59syn keyword bbInclude inherit include require contained
60syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref
61syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest
62
63" Add taks and similar
64syn keyword bbStatement addtask addhandler after before EXPORT_FUNCTIONS contained
65syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement
66syn match bbStatementLine "^\(addtask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest
67
68" OE Important Functions
69syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained
70
71" Generic Functions
72syn match bbFunction "\h[0-9A-Za-z_-]*" display contained contains=bbOEFunctions
79 73
80" BitBake shell metadata 74" BitBake shell metadata
81syn include @shell syntax/sh.vim 75syn include @shell syntax/sh.vim
82if exists("b:current_syntax") 76if exists("b:current_syntax")
83 unlet b:current_syntax 77 unlet b:current_syntax
84endif 78endif
79syn keyword bbShFakeRootFlag fakeroot contained
80syn match bbShFuncDef "^\(fakeroot\s*\)\?\([0-9A-Za-z_}${-]\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbFunction,bbDelimiter nextgroup=bbShFuncRegion skipwhite
81syn region bbShFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" keepend contained contains=@shell
85 82
86syn keyword bbFakerootFlag fakeroot contained nextgroup=bbFunction 83" BitBake python metadata
87syn match bbShellFuncDef "^\(fakeroot\s*\)\?\(\w\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbFakerootFlag,bbFunction,bbDelimiter nextgroup=bbShellFuncRegion skipwhite 84syn include @python syntax/python.vim
88syn region bbShellFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" keepend contained contains=@shell 85if exists("b:current_syntax")
89"hi def link bbShellFuncRegion Comment 86 unlet b:current_syntax
90 87endif
88syn keyword bbPyFlag python contained
89syn match bbPyFuncDef "^\(python\s\+\)\([0-9A-Za-z_-]\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbPyFlag,bbFunction,bbDelimiter nextgroup=bbPyFuncRegion skipwhite
90syn region bbPyFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" keepend contained contains=@python
91 91
92" BitBake 'def'd python functions 92" BitBake 'def'd python functions
93syn keyword bbDef def contained 93syn keyword bbPyDef def contained
94syn region bbDefRegion start='^def\s\+\w\+\s*([^)]*)\s*:\s*$' end='^\(\s\|$\)\@!' contains=@python 94syn region bbPyDefRegion start='^\(def\s\+\)\([0-9A-Za-z_-]\+\)\(\s*(.*)\s*\):\s*$' end='^\(\s\|$\)\@!' contains=@python
95
96" Highlighting Definitions
97hi def link bbUnmatched Error
98hi def link bbInclude Include
99hi def link bbTodo Todo
100hi def link bbComment Comment
101hi def link bbQuote String
102hi def link bbString String
103hi def link bbDelimiter Keyword
104hi def link bbArrayBrackets Statement
105hi def link bbContinue Special
106hi def link bbExportFlag Type
107hi def link bbIdentifier Identifier
108hi def link bbVarDeref PreProc
109hi def link bbVarDef Identifier
110hi def link bbVarValue String
111hi def link bbShFakeRootFlag Type
112hi def link bbFunction Function
113hi def link bbPyFlag Type
114hi def link bbPyDef Statement
115hi def link bbStatement Statement
116hi def link bbStatementRest Identifier
117hi def link bbOEFunctions Special
118hi def link bbVarPyValue PreProc
95 119
120let b:current_syntax = "bb"
96 121
97" BitBake statements
98syn keyword bbStatement include inherit require addtask addhandler EXPORT_FUNCTIONS display contained
99syn match bbStatementLine "^\(include\|inherit\|require\|addtask\|addhandler\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest
100syn match bbStatementRest ".*$" contained contains=bbString,bbVarDeref
101
102" Highlight
103"
104hi def link bbArrayBrackets Statement
105hi def link bbUnmatched Error
106hi def link bbContinue Special
107hi def link bbDef Statement
108hi def link bbPythonFlag Type
109hi def link bbExportFlag Type
110hi def link bbFakerootFlag Type
111hi def link bbStatement Statement
112hi def link bbString String
113hi def link bbTodo Todo
114hi def link bbComment Comment
115hi def link bbOperator Operator
116hi def link bbError Error
117hi def link bbFunction Function
118hi def link bbDelimiter Delimiter
119hi def link bbIdentifier Identifier
120hi def link bbVarEq Operator
121hi def link bbQuote String
122hi def link bbVarValue String
123" hi def link bbVarInlinePy PreProc
124hi def link bbVarDeref PreProc
125hi def link bbVarBraces PreProc
126 122
127let b:current_syntax = "bb"