aboutsummaryrefslogtreecommitdiffstats
path: root/classes/oelint.oeclass
blob: c4f24002e183d922dd1e5b7a7e377131252876e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
addtask lint before do_fetch
do_lint[nostamp] = 1
python do_lint() {
	def testVar(var, explain=None):
		try:
			s = d[var]
			return s["content"]
		except KeyError:
			oe.error("%s is not set" % var)
			if explain: oe.note(explain)
			return None


	##############################
	# Test that DESCRIPTION exists
	#
	testVar("DESCRIPTION")


	##############################
	# Test for valid LICENSE
	#
	s = testVar("LICENSE")
	if s=="unknown":
		oe.error("LICENSE is not set")


	##############################
	# Test for valid MAINTAINER
	#
	s = testVar("MAINTAINER")
	if s and s.find("@") == -1:
		oe.error("You forgot to put an e-mail address into MAINTAINER")


	##############################
	# Test for valid SECTION
	#
	# if Correct section: True	section name is valid
	#                     False	section name is invalid, no suggestion
	#                     string	section name is invalid, better name suggested
	#
	valid_sections = {
		# Current Section         Correct section
		"apps"			: True,
		"audio"			: True,
		"base"			: True,
		"console/games"		: True,
		"console/net"		: "network",
		"console/network"	: True,
		"console/utils"		: True,
		"devel"			: True,
		"developing"		: "devel",
		"devel/python"		: True,
		"fonts"			: True,
		"games"			: True,
		"games/libs"		: True,
		"gnome/base"		: True,
		"gnome/libs"		: True,
		"gpe"			: True,
		"gpe/libs"		: True,
		"gui"			: False,
		"libc"			: "libs",
		"libs"			: True,
		"libs/net"		: True,
		"multimedia"		: True,
		"net"			: "network",
		"NET"			: "network",
		"network"		: True,
		"opie/applets"		: True,
		"opie/applications"	: True,
		"opie/base"		: True,
		"opie/codecs"		: True,
		"opie/decorations"	: True,
		"opie/fontfactories"	: True,
		"opie/fonts"		: True,
		"opie/games"		: True,
		"opie/help"		: True,
		"opie/inputmethods"	: True,
		"opie/libs"		: True,
		"opie/multimedia"	: True,
		"opie/pim"		: True,
		"opie/setting"		: "opie/settings",
		"opie/settings"		: True,
		"opie/Shell"		: False,
		"opie/styles"		: True,
		"opie/today"		: True,
		"scientific"		: True,
		"utils"			: True,
		"x11"			: True,
		"x11/libs"		: True,
		"x11/wm"		: True,
		}
	s = testVar("SECTION")
	if s:
		try:
			newsect = valid_sections[s]
			if newsect == False:
				oe.note("SECTION '%s' is not recommended" % s)
			elif newsect != True:
				oe.note("SECTION '%s' is not recommended, better use '%s'" % (s, newsect))
		except:
			oe.note("SECTION '%s' is not recommended" % s)

		if not s.islower():
			oe.error("SECTION should only use lower case")



	
	##############################
	# Test for valid PRIORITY
	#
	valid_priorities = {
		"standard"		: True,
		"required"		: True,
		"optional"		: True,
		"extra"			: True,
		}
	s = testVar("PRIORITY")
	if s:
		try:
			newprio = valid_priorities[s]
			if newprio == False:
				oe.note("PRIORITY '%s' is not recommended" % s)
			elif newprio != True:
				oe.note("PRIORITY '%s' is not recommended, better use '%s'" % (s, newprio))
		except:
			oe.note("PRIORITY '%s' is not recommended" % s)

		if not s.islower():
			oe.error("PRIORITY should only use lower case")
	
}