summaryrefslogtreecommitdiffstats
path: root/meta/classes/insane.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-04-22 21:22:11 +0000
committerRichard Purdie <richard@openedhand.com>2008-04-22 21:22:11 +0000
commit1e53b0f578d415624bfec2c977a6e6c1dc3ae010 (patch)
tree14efe4f6f1f5fb9e2b595e321209e3c570dd4476 /meta/classes/insane.bbclass
parent9dc0c9fe0f6802478160d4beb883db6380f384ce (diff)
downloadpoky-1e53b0f578d415624bfec2c977a6e6c1dc3ae010.tar.gz
insane.bbclass: Drop pointless QA_LOG variable, add QA_LOGFILE so QA errors can optionally end up logged in one place for ease of reference. Add sanity check searching for tmpdir references within built packages, not fatal at present.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4309 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r--meta/classes/insane.bbclass48
1 files changed, 41 insertions, 7 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index d1bea89133..1f136d78ce 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -178,16 +178,13 @@ def package_qa_make_fatal_error(error_class, name, path,d):
178 178
179 TODO: Load a whitelist of known errors 179 TODO: Load a whitelist of known errors
180 """ 180 """
181 return not error_class in [0, 5, 7, 8] 181 return not error_class in [0, 5, 7, 8, 9]
182 182
183def package_qa_write_error(error_class, name, path, d): 183def package_qa_write_error(error_class, name, path, d):
184 """ 184 """
185 Log the error 185 Log the error
186 """ 186 """
187 import bb, os 187 import bb, os
188 if not bb.data.getVar('QA_LOG', d):
189 bb.note("a QA error occured but will not be logged because QA_LOG is not set")
190 return
191 188
192 ERROR_NAMES =[ 189 ERROR_NAMES =[
193 "non dev contains .so", 190 "non dev contains .so",
@@ -199,6 +196,7 @@ def package_qa_write_error(error_class, name, path, d):
199 "evil hides inside the .pc", 196 "evil hides inside the .pc",
200 "the desktop file is not valid", 197 "the desktop file is not valid",
201 ".la contains reference to the workdir", 198 ".la contains reference to the workdir",
199 "package contains reference to tmpdir paths",
202 ] 200 ]
203 201
204 log_path = os.path.join( bb.data.getVar('T', d, True), "log.qa_package" ) 202 log_path = os.path.join( bb.data.getVar('T', d, True), "log.qa_package" )
@@ -207,11 +205,25 @@ def package_qa_write_error(error_class, name, path, d):
207 (ERROR_NAMES[error_class], name, package_qa_clean_path(path,d)) 205 (ERROR_NAMES[error_class], name, package_qa_clean_path(path,d))
208 f.close() 206 f.close()
209 207
208 logfile = bb.data.getVar('QA_LOGFILE', d, True)
209 if logfile:
210 p = bb.data.getVar('P', d, True)
211 f = file( logfile, "a+")
212 print >> f, "%s, %s, %s, %s" % \
213 (p, ERROR_NAMES[error_class], name, package_qa_clean_path(path,d))
214 f.close()
215
210def package_qa_handle_error(error_class, error_msg, name, path, d): 216def package_qa_handle_error(error_class, error_msg, name, path, d):
211 import bb 217 import bb
212 bb.error("QA Issue: %s" % error_msg) 218 fatal = package_qa_make_fatal_error(error_class, name, path, d)
219 if fatal:
220 bb.error("QA Issue: %s" % error_msg)
221 else:
222 # Use bb.warn here when it works
223 bb.note("QA Issue: %s" % error_msg)
213 package_qa_write_error(error_class, name, path, d) 224 package_qa_write_error(error_class, name, path, d)
214 return not package_qa_make_fatal_error(error_class, name, path, d) 225
226 return not fatal
215 227
216def package_qa_check_rpath(file,name,d): 228def package_qa_check_rpath(file,name,d):
217 """ 229 """
@@ -321,6 +333,28 @@ def package_qa_check_desktop(path, name, d):
321 333
322 return sane 334 return sane
323 335
336def package_qa_check_buildpaths(path, name, d):
337 """
338 Check for build paths inside target files and error if not found in the whitelist
339 """
340 import bb, os
341 sane = True
342
343 # Ignore .debug files, not interesting
344 if path.find(".debug") != -1:
345 return True
346
347 # Ignore symlinks
348 if os.path.islink(path):
349 return True
350
351 tmpdir = bb.data.getVar('TMPDIR', d, True)
352 file_content = open(path).read()
353 if tmpdir in file_content:
354 error_msg = "File %s in package contained reference to tmpdir" % package_qa_clean_path(path,d)
355 sane = package_qa_handle_error(9, error_msg, name, path, d)
356 return sane
357
324def package_qa_check_staged(path,d): 358def package_qa_check_staged(path,d):
325 """ 359 """
326 Check staged la and pc files for sanity 360 Check staged la and pc files for sanity
@@ -428,7 +462,7 @@ python do_package_qa () {
428 462
429 checks = [package_qa_check_rpath, package_qa_check_devdbg, 463 checks = [package_qa_check_rpath, package_qa_check_devdbg,
430 package_qa_check_perm, package_qa_check_arch, 464 package_qa_check_perm, package_qa_check_arch,
431 package_qa_check_desktop] 465 package_qa_check_desktop, package_qa_check_buildpaths]
432 walk_sane = True 466 walk_sane = True
433 rdepends_sane = True 467 rdepends_sane = True
434 for package in packages.split(): 468 for package in packages.split():