summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorChong Lu <Chong.Lu@windriver.com>2014-08-01 17:03:36 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-06 10:23:39 +0100
commit7c85585bf6d436ee874e63cf375d4262ebe204a9 (patch)
treeed79d89d0db5d0e0e6c380f1723b26b94c8889b4 /meta/classes
parentc3dedbeb4bc34e830ffd66733fa55ddad9983ac4 (diff)
downloadpoky-7c85585bf6d436ee874e63cf375d4262ebe204a9.tar.gz
oelint.bbclass: make oelint bbclass work
Remove LICENSE, MAINTAINER, PRIORITY and valid SECTION checking. Convert tab indentation into four-space. [YOCTO #5427] (From OE-Core rev: 184baa681b3381b7f1f289c3e0c3a0f1096368f6) Signed-off-by: Chong Lu <Chong.Lu@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/oelint.bbclass198
1 files changed, 28 insertions, 170 deletions
diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass
index f2e7540dcf..d14e3783f3 100644
--- a/meta/classes/oelint.bbclass
+++ b/meta/classes/oelint.bbclass
@@ -1,174 +1,32 @@
1addtask lint before do_fetch 1addtask lint before do_fetch
2do_lint[nostamp] = "1" 2do_lint[nostamp] = "1"
3python do_lint() { 3python do_lint() {
4 def testVar(var, explain=None): 4 pkgname = d.getVar("PN", True)
5 try: 5
6 s = d[var] 6 ##############################
7 return s["content"] 7 # Test that DESCRIPTION exists
8 except KeyError: 8 #
9 bb.error("%s is not set" % var) 9 description = d.getVar("DESCRIPTION")
10 if explain: bb.note(explain) 10 if description[1:10] == '{SUMMARY}':
11 return None 11 bb.warn("%s: DESCRIPTION is not set" % pkgname)
12 12
13 13
14 ############################## 14 ##############################
15 # Test that DESCRIPTION exists 15 # Test that HOMEPAGE exists
16 # 16 #
17 testVar("DESCRIPTION") 17 homepage = d.getVar("HOMEPAGE")
18 18 if homepage == '':
19 19 bb.warn("%s: HOMEPAGE is not set" % pkgname)
20 ############################## 20 elif not homepage.startswith("http://") and not homepage.startswith("https://"):
21 # Test that HOMEPAGE exists 21 bb.warn("%s: HOMEPAGE doesn't start with http:// or https://" % pkgname)
22 # 22
23 s = testVar("HOMEPAGE") 23
24 if s=="unknown": 24 ##############################
25 bb.error("HOMEPAGE is not set") 25 # Test for valid SECTION
26 elif not s.startswith("http://"): 26 #
27 bb.error("HOMEPAGE doesn't start with http://") 27 section = d.getVar("SECTION")
28 28 if section == '':
29 29 bb.warn("%s: SECTION is not set" % pkgname)
30 30 elif not section.islower():
31 ############################## 31 bb.warn("%s: SECTION should only use lower case" % pkgname)
32 # Test for valid LICENSE
33 #
34 valid_licenses = {
35 "GPL-2" : "GPLv2",
36 "GPL LGPL FDL" : True,
37 "GPL PSF" : True,
38 "GPL/QPL" : True,
39 "GPL" : True,
40 "GPLv2" : True,
41 "IBM" : True,
42 "LGPL GPL" : True,
43 "LGPL" : True,
44 "MIT" : True,
45 "OSL" : True,
46 "Perl" : True,
47 "Public Domain" : True,
48 "QPL" : "GPL/QPL",
49 }
50 s = testVar("LICENSE")
51 if s=="unknown":
52 bb.error("LICENSE is not set")
53 elif s.startswith("Vendor"):
54 pass
55 else:
56 try:
57 newlic = valid_licenses[s]
58 if newlic == False:
59 bb.note("LICENSE '%s' is not recommended" % s)
60 elif newlic != True:
61 bb.note("LICENSE '%s' is not recommended, better use '%s'" % (s, newsect))
62 except:
63 bb.note("LICENSE '%s' is not recommended" % s)
64
65
66 ##############################
67 # Test for valid MAINTAINER
68 #
69 s = testVar("MAINTAINER")
70 if s=="OpenEmbedded Team <openembedded-devel@openembedded.org>":
71 bb.error("explicit MAINTAINER is missing, using default")
72 elif s and s.find("@") == -1:
73 bb.error("You forgot to put an e-mail address into MAINTAINER")
74
75
76 ##############################
77 # Test for valid SECTION
78 #
79 # if Correct section: True section name is valid
80 # False section name is invalid, no suggestion
81 # string section name is invalid, better name suggested
82 #
83 valid_sections = {
84 # Current Section Correct section
85 "apps" : True,
86 "audio" : True,
87 "base" : True,
88 "console/games" : True,
89 "console/net" : "console/network",
90 "console/network" : True,
91 "console/utils" : True,
92 "devel" : True,
93 "developing" : "devel",
94 "devel/python" : True,
95 "fonts" : True,
96 "games" : True,
97 "games/libs" : True,
98 "gnome/base" : True,
99 "gnome/libs" : True,
100 "gpe" : True,
101 "gpe/libs" : True,
102 "gui" : False,
103 "libc" : "libs",
104 "libs" : True,
105 "libs/net" : True,
106 "multimedia" : True,
107 "net" : "network",
108 "NET" : "network",
109 "network" : True,
110 "opie/applets" : True,
111 "opie/applications" : True,
112 "opie/base" : True,
113 "opie/codecs" : True,
114 "opie/decorations" : True,
115 "opie/fontfactories" : True,
116 "opie/fonts" : True,
117 "opie/games" : True,
118 "opie/help" : True,
119 "opie/inputmethods" : True,
120 "opie/libs" : True,
121 "opie/multimedia" : True,
122 "opie/pim" : True,
123 "opie/setting" : "opie/settings",
124 "opie/settings" : True,
125 "opie/Shell" : False,
126 "opie/styles" : True,
127 "opie/today" : True,
128 "scientific" : True,
129 "utils" : True,
130 "x11" : True,
131 "x11/libs" : True,
132 "x11/wm" : True,
133 }
134 s = testVar("SECTION")
135 if s:
136 try:
137 newsect = valid_sections[s]
138 if newsect == False:
139 bb.note("SECTION '%s' is not recommended" % s)
140 elif newsect != True:
141 bb.note("SECTION '%s' is not recommended, better use '%s'" % (s, newsect))
142 except:
143 bb.note("SECTION '%s' is not recommended" % s)
144
145 if not s.islower():
146 bb.error("SECTION should only use lower case")
147
148
149
150
151 ##############################
152 # Test for valid PRIORITY
153 #
154 valid_priorities = {
155 "standard" : True,
156 "required" : True,
157 "optional" : True,
158 "extra" : True,
159 }
160 s = testVar("PRIORITY")
161 if s:
162 try:
163 newprio = valid_priorities[s]
164 if newprio == False:
165 bb.note("PRIORITY '%s' is not recommended" % s)
166 elif newprio != True:
167 bb.note("PRIORITY '%s' is not recommended, better use '%s'" % (s, newprio))
168 except:
169 bb.note("PRIORITY '%s' is not recommended" % s)
170
171 if not s.islower():
172 bb.error("PRIORITY should only use lower case")
173
174} 32}